名副其实
本帖最后由 名副其实 于 2024-1-2 21:41 编辑

xCommands

这是什么?

一个相当简单但是有效的自定义命令插件,可以替代 DeluxeCommandsGuoGroupCommands(下称“GGC”)。
它拥有与 GGC 相同的单独冷却与全局冷却,不仅支持发送消息,还支持命令条件,让你在包装服务器命令时能拥有更大的开放性!
虽然不如 MyCommands 有着强大的自定义动作,但在小而精辟上却游刃有余。

授权搬运!










点击图片可直达对话。

功能介绍

按喜好创建数量不限的自定义命令及其子命令;支持子命令 tab 补全,可单独设置;支持 JSON 格式文本;支持命令执行限制所在世界;支持 1.8+ 的所有版本;支持 PlaceholderAPI(非常推荐你安装!)以及 Vault

命令&权限列表

插件只内置了一个命令,即 /xc。
使用这条命令的权限为 xcommands.admin,这也是本插件默认携带的唯一一个权限。


必需参数,[] 为可选参数/xc - 插件主命令。
enable - 启用指定的自定义命令。disable - 禁用指定的自定义命令。help - 显示帮助页面。list - 列出自定义命令列表。reload - 重载插件。run - 以指定玩家的身份执行特定的自定义命令。


配置文件

插件的所有消息均可在 config.yml 中修改!
对于自定义命令,每条自定义命令均会以一个 .yml 文件的形式存储在 xCommands/commands 文件夹下。
我推荐你自行复制默认配置文件并基于此修改,达到你所需要的效果。

enabled: true
# 是否启用该自定义命令
name: 'socials'
# 此为主命令的名称,例如这里写了 socials,那么在游戏内就是 /socials [子命令]。

# 是否在消息提示中使用 JSON 格式文本
json: true

# 执行主命令所需的权限,若不需要请设置为 'none'
permission: 'xcommands.command.socials'

# 全局冷却(单位为毫秒)
globalCooldown: 0

# 单独冷却(单位为毫秒)
cooldown: 10000

# 设置命令只能在某些特定的世界执行
worldWhiteList:
  - "world"
# 设置命令禁止在某些特定的世界执行
worldBlackList: []

# text:
# 每一行都是发送给玩家的文本
# 若启用了上述 json: 设置,你设置的文本应当看起来像这样:
# {"text":"youtube","bold":true,"color":"red","clickEvent":{"action":"open_url","value":"http://www.youtube.com/"}}
# 若禁用了 json:,则插件会正常识别和替换彩色代码
# %player% 可以返回玩家名称
# 如果安装了 PlaceholderAPI,那么用户将可以在这里配置变量
# commands:
# 服务器执行的命令 (开头不需要斜杠 /)
# 将 [player] 加在开头表示以玩家身份执行命令
# %player% 可以返回玩家名称
# conditions:
# 当前支持的条件有: cost(vault 金币), xp(经验), xpLevel(经验等级), isOP(玩家是否为 OP)
# 确保设置 failureMessage 使得玩家可以在未满足条件却执行命令时收到相关消息
# tabComplete 设置决定了子命令是否在 tab 补全中出现
subcommands:
  default:
  # 默认,触发这条子命令模块只需直接执行 /social
    text:
      - '["",{"text":"-----","bold":true,"strikethrough":true,"color":"dark_gray"},{"text":"[","color":"dark_gray"},{"text":"Socials","color":"red"},{"text":"]","color":"dark_gray"},{"text":"-----","bold":true,"strikethrough":true,"color":"dark_gray"}]'
      - '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"Youtube: ","color":"red"},{"text":"/socials youtube","color":"gray","clickEvent":{"action":"suggest_command","value":"/socials youtube"}}]'
      - '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"Twitch: ","color":"red"},{"text":"/socials twitch","color":"gray","clickEvent":{"action":"suggest_command","value":"/socials twitch"}}]'
    commands: []
    conditions: []
  twitch:
  # 触发这条子命令模块则需要执行 /social twitch
    tabComplete: true
    default:
      text:
        - '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"Click ","color":"red","clickEvent":{"action":"open_url","value":"https://twitch.tv/"}},{"text":"to open my ","color":"gray","clickEvent":{"action":"open_url","value":"https://twitch.tv/"}},{"text":"Twitch","bold":true,"color":"dark_purple","clickEvent":{"action":"open_url","value":"https://twitch.tv/"}}]'
      commands: []
      conditions:
        xpLevel:
          value: 5
          deduct: true
          failureMessage: '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"You need 5 xp levels to run that command","italic":true,"color":"red"}]'
  youtube:
    tabComplete: true
    default:
      text:
        - '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"Click ","color":"red","clickEvent":{"action":"open_url","value":"https://youtube.com/"}},{"text":"to open my ","color":"gray","clickEvent":{"action":"open_url","value":"https://youtube.com/"}},{"text":"Youtube","bold":true,"color":"red","clickEvent":{"action":"open_url","value":"https://youtube.com/"}}]'
      commands: []
      conditions:
        cost:
          value: 5
          deduct: true
          failureMessage: '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"You need $5 to run that command","italic":true,"color":"red"}]'
    secret:
      tabComplete: false
      default:
        text:
          - '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"You found my secret :o","color":"gray"}]'
        commands:
          - 'give %player% diamond 1'
        conditions:
          cooldown:
            value: 30000
            failureMessage: '["",{"text":"» ","bold":true,"color":"dark_gray"},{"text":"On cooldown for another {0}s","italic":true,"color":"red"}]'复制代码


config.yml
[code=yaml]# 消息文本
messageNoPermissions: "&8&l» &c你没有使用此命令的权限."
messageCommandNotEnabled: "&8&l» &c该命令尚未启用."
# 使用 {0} 表示剩余冷却时间 (单位为秒)
messageCommandOnCooldown: "&8&l» &c该命令再次使用仍需等待 &e{0}s&c."
messageCommandOnGlobalCooldown: "&8&l» &c该命令再次使用仍需等待 &e{0}s&c."
messageWorldNotInWhitelist: "&8&l» &c该命令在此世界不可用."
messageWorldInBlacklist: "&8&l» &c该命令在此世界不可用."[/code]

第一页 上一页 下一页 最后一页