mirror of
https://github.com/songoda/UltimateKits.git
synced 2025-02-17 03:41:21 +01:00
Removed old unused kitpreview command
This commit is contained in:
parent
8225e58ca4
commit
bb68a17abc
@ -104,17 +104,11 @@ public class UltimateKits extends JavaPlugin {
|
|||||||
|
|
||||||
new com.massivestats.MassiveStats(this, 900);
|
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============================="));
|
console.sendMessage(Arconix.pl().getApi().format().formatText("&a============================="));
|
||||||
|
|
||||||
this.getCommand("UltimateKits").setExecutor(new CommandHandler(this));
|
this.getCommand("UltimateKits").setExecutor(new CommandHandler(this));
|
||||||
this.getCommand("PreviewKit").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 BlockListeners(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new ChatListeners(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============================="));
|
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.
|
* Load configuration files into memory.
|
||||||
*/
|
*/
|
||||||
|
@ -223,7 +223,6 @@ public class SettingsManager implements Listener {
|
|||||||
public enum settings {
|
public enum settings {
|
||||||
|
|
||||||
o1("Lock-KP-Commands", "Main.Block Help Page For Non Admins", false),
|
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),
|
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),
|
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),
|
o5("Dont-Preview-Commands", "Main.Dont Preview Commands In Kits", false),
|
||||||
|
@ -16,6 +16,11 @@ commands:
|
|||||||
default: true
|
default: true
|
||||||
aliases: [pk, preview]
|
aliases: [pk, preview]
|
||||||
usage: /<command> [kit]
|
usage: /<command> [kit]
|
||||||
|
kits:
|
||||||
|
description: Preview a kit
|
||||||
|
default: true
|
||||||
|
aliases: [kits]
|
||||||
|
usage: /<command>
|
||||||
permissions:
|
permissions:
|
||||||
ultimatekits.use:
|
ultimatekits.use:
|
||||||
description: allows the user to preview kit
|
description: allows the user to preview kit
|
||||||
|
Loading…
Reference in New Issue
Block a user