mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-08 11:41:28 +01:00
New command system.
This commit is contained in:
parent
56008872b1
commit
9a5f01800e
@ -129,7 +129,7 @@ public class UltimateKits extends SongodaPlugin {
|
||||
this.commandManager = new CommandManager(this);
|
||||
this.commandManager.addCommand(new CommandKit(guiManager));
|
||||
this.commandManager.addCommand(new CommandPreviewKit(guiManager));
|
||||
this.commandManager.addCommand(new CommandUltimateKits())
|
||||
this.commandManager.addMainCommand("KitAdmin")
|
||||
.addSubCommand(new CommandReload())
|
||||
.addSubCommand(new CommandSettings(guiManager))
|
||||
.addSubCommand(new CommandCreatekit(guiManager))
|
||||
|
@ -40,7 +40,7 @@ public class CommandCategories extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin categories";
|
||||
return "categories";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,7 +122,7 @@ public class CommandCrate extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin crate <player/all> <kit> <crate> (amount)";
|
||||
return "crate <player/all> <kit> <crate> (amount)";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,7 +52,7 @@ public class CommandCreatekit extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin createkit <name>";
|
||||
return "createkit <name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,7 +67,7 @@ public class CommandEdit extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin edit <kit>";
|
||||
return "edit <kit>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,7 +108,7 @@ public class CommandKey extends AbstractCommand {
|
||||
for (Key key : UltimateKits.getInstance().getKeyManager().getKeys()) {
|
||||
keys.append("/").append(key.getName());
|
||||
}
|
||||
return "/KitAdmin key <kit/all> <" + keys.substring(1) + "> <player/all> <amount>";
|
||||
return "key <kit/all> <" + keys.substring(1) + "> <player/all> <amount>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,7 +33,7 @@ public class CommandReload extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin reload";
|
||||
return "reload";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,7 @@ public class CommandRemove extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin remove";
|
||||
return "remove";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +63,7 @@ public class CommandSet extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin set <kit>";
|
||||
return "set <kit>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ public class CommandSettings extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin settings";
|
||||
return "settings";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,54 +0,0 @@
|
||||
package com.songoda.ultimatekits.commands;
|
||||
|
||||
import com.songoda.core.commands.AbstractCommand;
|
||||
import com.songoda.ultimatekits.UltimateKits;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandUltimateKits extends AbstractCommand {
|
||||
|
||||
final UltimateKits instance = UltimateKits.getInstance();
|
||||
|
||||
public CommandUltimateKits() {
|
||||
super(false, "KitAdmin");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractCommand.ReturnType runCommand(CommandSender sender, String... args) {
|
||||
sender.sendMessage("");
|
||||
instance.getLocale().newMessage("&7Version " + instance.getDescription().getVersion()
|
||||
+ " Created with <3 by &5&l&oSongoda").sendPrefixedMessage(sender);
|
||||
|
||||
for (AbstractCommand command : instance.getCommandManager().getAllCommands()) {
|
||||
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
|
||||
}
|
||||
}
|
||||
sender.sendMessage("");
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(CommandSender sender, String... args) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/KitAdmin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Displays this page.";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user