mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 02:19:05 +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
|
name: VentureChat
|
||||||
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
||||||
version: 2.23.1
|
version: 2.23.2
|
||||||
author: Aust1n46
|
author: Aust1n46
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
|
||||||
@ -104,31 +105,38 @@ public class VentureCommandExecutor implements TabExecutor {
|
|||||||
commands.put("messagetoggle", new MessageToggle());
|
commands.put("messagetoggle", new MessageToggle());
|
||||||
commands.put("bungeetoggle", new BungeeToggle());
|
commands.put("bungeetoggle", new BungeeToggle());
|
||||||
for(String command : commands.keySet()) {
|
for(String command : commands.keySet()) {
|
||||||
plugin.getCommand(command).setExecutor(commandExecutor);
|
registerCommand(command, commandExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||||
VentureCommand reply = new Reply();
|
VentureCommand reply = new Reply();
|
||||||
commands.put("reply", reply);
|
commands.put("reply", reply);
|
||||||
commands.put("r", reply);
|
commands.put("r", reply);
|
||||||
plugin.getCommand("reply").setExecutor(commandExecutor);
|
registerCommand("reply", commandExecutor);
|
||||||
plugin.getCommand("r").setExecutor(commandExecutor);
|
registerCommand("r", commandExecutor);
|
||||||
|
|
||||||
commands.put("mute", new Mute());
|
commands.put("mute", new Mute());
|
||||||
commands.put("muteall", new Muteall());
|
commands.put("muteall", new Muteall());
|
||||||
commands.put("unmute", new Unmute());
|
commands.put("unmute", new Unmute());
|
||||||
commands.put("unmuteall", new Unmuteall());
|
commands.put("unmuteall", new Unmuteall());
|
||||||
plugin.getCommand("mute").setExecutor(commandExecutor);
|
registerCommand("mute", commandExecutor);
|
||||||
plugin.getCommand("muteall").setExecutor(commandExecutor);
|
registerCommand("muteall", commandExecutor);
|
||||||
plugin.getCommand("unmute").setExecutor(commandExecutor);
|
registerCommand("unmute", commandExecutor);
|
||||||
plugin.getCommand("unmuteall").setExecutor(commandExecutor);
|
registerCommand("unmuteall", commandExecutor);
|
||||||
|
|
||||||
MessageCommandExecutor messageCommandExecutor = new MessageCommandExecutor();
|
MessageCommandExecutor messageCommandExecutor = new MessageCommandExecutor();
|
||||||
plugin.getCommand("message").setExecutor(messageCommandExecutor);
|
registerCommand("message", messageCommandExecutor);
|
||||||
plugin.getCommand("msg").setExecutor(messageCommandExecutor);
|
registerCommand("msg", messageCommandExecutor);
|
||||||
plugin.getCommand("tell").setExecutor(messageCommandExecutor);
|
registerCommand("tell", messageCommandExecutor);
|
||||||
plugin.getCommand("whisper").setExecutor(messageCommandExecutor);
|
registerCommand("whisper", messageCommandExecutor);
|
||||||
plugin.getCommand("ignore").setExecutor(new IgnoreCommandExecutor());
|
|
||||||
|
registerCommand("ignore", new IgnoreCommandExecutor());
|
||||||
}, 0);
|
}, 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
|
name: VentureChat
|
||||||
version: 2.23.1
|
version: 2.23.2
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
main: mineverse.Aust1n46.chat.MineverseChat
|
main: mineverse.Aust1n46.chat.MineverseChat
|
||||||
depend: [Vault, ProtocolLib, PlaceholderAPI]
|
depend: [Vault, ProtocolLib, PlaceholderAPI]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user