Removed old unused kitpreview command

This commit is contained in:
Brianna O'Keefe 2018-05-24 16:59:38 -04:00
parent 8225e58ca4
commit bb68a17abc
3 changed files with 6 additions and 32 deletions

View File

@ -104,17 +104,11 @@ public class UltimateKits extends JavaPlugin {
new com.massivestats.MassiveStats(this, 900);
if (!getConfig().getBoolean("Main.Enabled Custom Kits And Kit Commands")) {
console.sendMessage(Arconix.pl().getApi().format().formatText("&7The &a/kit&7 and &a/kit &7features have been &cdisabled&7."));
} else {
registerCommandDynamically("kits", new CommandHandler(this));
registerCommandDynamically("kit", new CommandHandler(this));
}
console.sendMessage(Arconix.pl().getApi().format().formatText("&a============================="));
this.getCommand("UltimateKits").setExecutor(new CommandHandler(this));
this.getCommand("PreviewKit").setExecutor(new CommandHandler(this));
this.getCommand("Kits").setExecutor(new CommandHandler(this));
getServer().getPluginManager().registerEvents(new BlockListeners(this), this);
getServer().getPluginManager().registerEvents(new ChatListeners(this), this);
@ -140,30 +134,6 @@ public class UltimateKits extends JavaPlugin {
console.sendMessage(Arconix.pl().getApi().format().formatText("&a============================="));
}
private void registerCommandDynamically(String command, CommandExecutor executor) {
try {
// Retrieve the SimpleCommandMap from the server
Class<?> classCraftServer = Bukkit.getServer().getClass();
Field fieldCommandMap = classCraftServer.getDeclaredField("commandMap");
fieldCommandMap.setAccessible(true);
SimpleCommandMap commandMap = (SimpleCommandMap) fieldCommandMap.get(Bukkit.getServer());
// Construct a new Command object
Constructor<PluginCommand> constructorPluginCommand = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
constructorPluginCommand.setAccessible(true);
PluginCommand commandObject = constructorPluginCommand.newInstance(command, this);
commandObject.setExecutor(executor);
// Register the command
Field fieldKnownCommands = commandMap.getClass().getDeclaredField("knownCommands");
fieldKnownCommands.setAccessible(true);
Map<String, Command> knownCommands = (Map<String, Command>) fieldKnownCommands.get(commandMap);
knownCommands.put(command, commandObject);
} catch (ReflectiveOperationException e) {
Debugger.runReport(e);
}
}
/*
* Load configuration files into memory.
*/

View File

@ -223,7 +223,6 @@ public class SettingsManager implements Listener {
public enum settings {
o1("Lock-KP-Commands", "Main.Block Help Page For Non Admins", false),
o2("Enabled-Kits", "Main.Enabled Custom Kits And Kit Commands", true),
o3("Only-Show-Kits-With-Perms", "Main.Only Show Players Kits They Have Permission To Use", false),
o4("Kits-Free-With-Perms", "Main.Allow Players To Receive Kits For Free If They Have Permission", true),
o5("Dont-Preview-Commands", "Main.Dont Preview Commands In Kits", false),

View File

@ -16,6 +16,11 @@ commands:
default: true
aliases: [pk, preview]
usage: /<command> [kit]
kits:
description: Preview a kit
default: true
aliases: [kits]
usage: /<command>
permissions:
ultimatekits.use:
description: allows the user to preview kit