New command system.

This commit is contained in:
Brianna 2020-07-27 12:03:14 -05:00
parent 56008872b1
commit 9a5f01800e
11 changed files with 10 additions and 64 deletions

View File

@ -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))

View File

@ -40,7 +40,7 @@ public class CommandCategories extends AbstractCommand {
@Override
public String getSyntax() {
return "/KitAdmin categories";
return "categories";
}
@Override

View File

@ -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

View File

@ -52,7 +52,7 @@ public class CommandCreatekit extends AbstractCommand {
@Override
public String getSyntax() {
return "/KitAdmin createkit <name>";
return "createkit <name>";
}
@Override

View File

@ -67,7 +67,7 @@ public class CommandEdit extends AbstractCommand {
@Override
public String getSyntax() {
return "/KitAdmin edit <kit>";
return "edit <kit>";
}
@Override

View File

@ -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

View File

@ -33,7 +33,7 @@ public class CommandReload extends AbstractCommand {
@Override
public String getSyntax() {
return "/KitAdmin reload";
return "reload";
}
@Override

View File

@ -47,7 +47,7 @@ public class CommandRemove extends AbstractCommand {
@Override
public String getSyntax() {
return "/KitAdmin remove";
return "remove";
}
@Override

View File

@ -63,7 +63,7 @@ public class CommandSet extends AbstractCommand {
@Override
public String getSyntax() {
return "/KitAdmin set <kit>";
return "set <kit>";
}
@Override

View File

@ -38,7 +38,7 @@ public class CommandSettings extends AbstractCommand {
@Override
public String getSyntax() {
return "/KitAdmin settings";
return "settings";
}
@Override

View File

@ -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.";
}
}