From 393c9c9b08ade70c1ec1f6e091bcd9d5d91d9346 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Mon, 24 Feb 2020 19:18:53 +0100 Subject: [PATCH] Fix command register Also deleted plugin updater stuff in last commit --- .../main/java/buttondevteam/lib/chat/Command2MC.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Chroma-Core/src/main/java/buttondevteam/lib/chat/Command2MC.java b/Chroma-Core/src/main/java/buttondevteam/lib/chat/Command2MC.java index 25138c7..0604ef1 100644 --- a/Chroma-Core/src/main/java/buttondevteam/lib/chat/Command2MC.java +++ b/Chroma-Core/src/main/java/buttondevteam/lib/chat/Command2MC.java @@ -7,6 +7,7 @@ import buttondevteam.lib.architecture.Component; import lombok.val; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; +import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.SimpleCommandMap; @@ -266,7 +267,15 @@ public class Command2MC extends Command2 implemen if(!shouldRegisterOfficially) return; try { var cmdmap=(SimpleCommandMap)Bukkit.getServer().getClass().getMethod("getCommandMap").invoke(Bukkit.getServer()); - //cmdmap.register(command.getPlugin()) + var path = command.getCommandPath(); + int x = path.indexOf(' '); + var mainPath = path.substring(0, x == -1 ? path.length() : x); + cmdmap.register(command.getPlugin().getName(), new Command(mainPath) { + @Override + public boolean execute(CommandSender commandSender, String s, String[] strings) { + return true; + } + }); } catch (Exception e) { TBMCCoreAPI.SendException("Failed to register command in command map!", e); shouldRegisterOfficially=false;