|
| 1 | +package me.skymc.taboolib.commands.sub; |
| 2 | + |
| 3 | +import java.util.HashMap; |
| 4 | +import java.util.LinkedHashMap; |
| 5 | +import java.util.Map.Entry; |
| 6 | + |
| 7 | +import org.bukkit.command.CommandSender; |
| 8 | +import org.bukkit.command.ConsoleCommandSender; |
| 9 | +import org.bukkit.entity.Player; |
| 10 | +import org.bukkit.inventory.ItemFlag; |
| 11 | + |
| 12 | +import me.skymc.taboolib.TabooLib; |
| 13 | +import me.skymc.taboolib.commands.SubCommand; |
| 14 | +import me.skymc.taboolib.jsonformatter.JSONFormatter; |
| 15 | +import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent; |
| 16 | +import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent; |
| 17 | + |
| 18 | +public class HelpCommand extends SubCommand { |
| 19 | + |
| 20 | + public HelpCommand(CommandSender sender, String[] args) { |
| 21 | + super(sender, args); |
| 22 | + |
| 23 | + HashMap<String, String> helps = new LinkedHashMap<>(); |
| 24 | + helps.put("/taboolib save §8[§7名称§8]", "§e保存手中物品"); |
| 25 | + helps.put("/taboolib item §8[§7名称§8] §8<§7玩家§8> §8<§7数量§8>", "§e给予玩家物品"); |
| 26 | + helps.put("/taboolib iteminfo", "§e查看物品信息"); |
| 27 | + helps.put("/taboolib itemlist", "§e查看所有物品"); |
| 28 | + helps.put("/taboolib itemreload", "§e重载物品缓存"); |
| 29 | + helps.put("§a", null); |
| 30 | + helps.put("/taboolib attributes", "§e查看所有属性"); |
| 31 | + helps.put("/taboolib enchants", "§e查看所有附魔"); |
| 32 | + helps.put("/taboolib potions", "§e查看所有药水"); |
| 33 | + helps.put("/taboolib flags", "§e查看所有标签"); |
| 34 | + helps.put("/taboolib slots", "§e查看所有部位"); |
| 35 | + helps.put("§b", null); |
| 36 | + helps.put("/taboolib getvariable §8[§7-s|a§8] §8[§7键§8]", "§e查看变量"); |
| 37 | + helps.put("/taboolib setvariable §8[§7-s|a§8] §8[§7键§8] §8[§7值§8]", "§e更改变量"); |
| 38 | + helps.put("§c", null); |
| 39 | + helps.put("/taboolib cycle list", "§e列出所有时间检查器"); |
| 40 | + helps.put("/taboolib cycle info §8[§7名称§8]", "§e查询检查器信息"); |
| 41 | + helps.put("/taboolib cycle reset §8[§7名称§8]", "§e初始化时间检查器"); |
| 42 | + helps.put("/taboolib cycle update §8[§7名称§8]", "§e更新时间检查器"); |
| 43 | + helps.put("§d", null); |
| 44 | + helps.put("/taboolib shell load §8[§7名称§8]", "§e载入某个脚本"); |
| 45 | + helps.put("/taboolib shell unload §8[§7名称§8]", "§e卸载某个脚本"); |
| 46 | + helps.put("§e", null); |
| 47 | + helps.put("/taboolib importdata", "§4向数据库导入本地数据 §8(该操作将会清空数据库)"); |
| 48 | + |
| 49 | + if (sender instanceof ConsoleCommandSender || TabooLib.getVerint() < 10800) { |
| 50 | + sender.sendMessage("§f"); |
| 51 | + sender.sendMessage("§b§l----- §3§lTaooLib Commands §b§l-----"); |
| 52 | + sender.sendMessage("§f"); |
| 53 | + // 遍历命令 |
| 54 | + for (Entry<String, String> entry : helps.entrySet()) { |
| 55 | + if (entry.getValue() == null) { |
| 56 | + sender.sendMessage("§f"); |
| 57 | + } else { |
| 58 | + sender.sendMessage("§f " + entry.getKey() + " §6- " + entry.getValue()); |
| 59 | + } |
| 60 | + } |
| 61 | + sender.sendMessage("§f"); |
| 62 | + } |
| 63 | + else if (sender instanceof Player) { |
| 64 | + JSONFormatter json = new JSONFormatter(); |
| 65 | + json.append("§f"); json.newLine(); |
| 66 | + json.append("§b§l----- §3§lTaooLib Commands §b§l-----"); json.newLine(); |
| 67 | + json.append("§f"); json.newLine(); |
| 68 | + // 遍历命令 |
| 69 | + for (Entry<String, String> entry : helps.entrySet()) { |
| 70 | + if (entry.getValue() == null) { |
| 71 | + json.append("§f"); json.newLine(); |
| 72 | + } else { |
| 73 | + json.appendHoverClick("§f " + entry.getKey() + " §6- " + entry.getValue(), new ShowTextEvent("§f点击复制指令"), new SuggestCommandEvent(entry.getKey().split("§")[0])); json.newLine(); |
| 74 | + } |
| 75 | + } |
| 76 | + json.append("§f"); |
| 77 | + json.send((Player) sender); |
| 78 | + } |
| 79 | + } |
| 80 | +} |
0 commit comments