mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-22 18:09:06 +00:00
Check if command exists before trying to register it.
This commit is contained in:
parent
da275411fd
commit
a847a50bbe
@ -1,4 +1,4 @@
|
||||
name: VentureChat
|
||||
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
||||
version: 2.23.1
|
||||
version: 2.23.2
|
||||
author: Aust1n46
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
||||
@ -104,31 +105,38 @@ public class VentureCommandExecutor implements TabExecutor {
|
||||
commands.put("messagetoggle", new MessageToggle());
|
||||
commands.put("bungeetoggle", new BungeeToggle());
|
||||
for(String command : commands.keySet()) {
|
||||
plugin.getCommand(command).setExecutor(commandExecutor);
|
||||
registerCommand(command, commandExecutor);
|
||||
}
|
||||
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
VentureCommand reply = new Reply();
|
||||
commands.put("reply", reply);
|
||||
commands.put("r", reply);
|
||||
plugin.getCommand("reply").setExecutor(commandExecutor);
|
||||
plugin.getCommand("r").setExecutor(commandExecutor);
|
||||
registerCommand("reply", commandExecutor);
|
||||
registerCommand("r", commandExecutor);
|
||||
|
||||
commands.put("mute", new Mute());
|
||||
commands.put("muteall", new Muteall());
|
||||
commands.put("unmute", new Unmute());
|
||||
commands.put("unmuteall", new Unmuteall());
|
||||
plugin.getCommand("mute").setExecutor(commandExecutor);
|
||||
plugin.getCommand("muteall").setExecutor(commandExecutor);
|
||||
plugin.getCommand("unmute").setExecutor(commandExecutor);
|
||||
plugin.getCommand("unmuteall").setExecutor(commandExecutor);
|
||||
registerCommand("mute", commandExecutor);
|
||||
registerCommand("muteall", commandExecutor);
|
||||
registerCommand("unmute", commandExecutor);
|
||||
registerCommand("unmuteall", commandExecutor);
|
||||
|
||||
MessageCommandExecutor messageCommandExecutor = new MessageCommandExecutor();
|
||||
plugin.getCommand("message").setExecutor(messageCommandExecutor);
|
||||
plugin.getCommand("msg").setExecutor(messageCommandExecutor);
|
||||
plugin.getCommand("tell").setExecutor(messageCommandExecutor);
|
||||
plugin.getCommand("whisper").setExecutor(messageCommandExecutor);
|
||||
plugin.getCommand("ignore").setExecutor(new IgnoreCommandExecutor());
|
||||
registerCommand("message", messageCommandExecutor);
|
||||
registerCommand("msg", messageCommandExecutor);
|
||||
registerCommand("tell", messageCommandExecutor);
|
||||
registerCommand("whisper", messageCommandExecutor);
|
||||
|
||||
registerCommand("ignore", new IgnoreCommandExecutor());
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private static void registerCommand(String command, CommandExecutor commandExecutor) {
|
||||
if(plugin.getCommand(command) != null) {
|
||||
plugin.getCommand(command).setExecutor(commandExecutor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: VentureChat
|
||||
version: 2.23.1
|
||||
version: 2.23.2
|
||||
api-version: 1.13
|
||||
main: mineverse.Aust1n46.chat.MineverseChat
|
||||
depend: [Vault, ProtocolLib, PlaceholderAPI]
|
||||
|
Loading…
x
Reference in New Issue
Block a user