mirror of
https://github.com/craftaro/EpicSpawners.git
synced 2025-01-09 03:57:40 +08:00
Command syntax errors will now return correct syntax rather than leaving you confused.
CommandManager has been upgraded.
This commit is contained in:
parent
9442fab53b
commit
c2356b6bd3
@ -83,6 +83,7 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
|
||||
private SpawnerManager spawnerManager;
|
||||
private BoostManager boostManager;
|
||||
private SettingsManager settingsManager;
|
||||
private CommandManager commandManager;
|
||||
|
||||
private BlacklistHandler blacklistHandler;
|
||||
private HologramHandler hologramHandler;
|
||||
@ -154,6 +155,7 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
|
||||
this.boostManager = new BoostManager();
|
||||
this.spawnManager = new SpawnManager();
|
||||
this.spawnerManager = new ESpawnerManager();
|
||||
this.commandManager = new CommandManager(this);
|
||||
this.blacklistHandler = new BlacklistHandler();
|
||||
this.hologramHandler = new HologramHandler(this);
|
||||
this.playerActionManager = new PlayerActionManager();
|
||||
@ -237,11 +239,6 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
|
||||
this.spawnerEditor = new SpawnerEditor(this);
|
||||
this.appearanceHandler = new AppearanceHandler();
|
||||
|
||||
// Command registration
|
||||
this.getCommand("EpicSpawners").setExecutor(new CommandManager(this));
|
||||
this.getCommand("SpawnerStats").setExecutor(new CommandManager(this));
|
||||
this.getCommand("SpawnerShop").setExecutor(new CommandManager(this));
|
||||
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
|
||||
// Event registration
|
||||
@ -645,6 +642,10 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
|
||||
return spawnManager;
|
||||
}
|
||||
|
||||
public CommandManager getCommandManager() {
|
||||
return commandManager;
|
||||
}
|
||||
|
||||
public BoostManager getBoostManager() {
|
||||
return boostManager;
|
||||
}
|
||||
|
@ -5,18 +5,17 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
public abstract class AbstractCommand {
|
||||
|
||||
private final AbstractCommand parent;
|
||||
public enum ReturnType { SUCCESS, FAILURE, SYNTAX_ERROR }
|
||||
|
||||
private final String permissionNode;
|
||||
private final AbstractCommand parent;
|
||||
|
||||
private final String command;
|
||||
|
||||
private final boolean noConsole;
|
||||
|
||||
protected AbstractCommand(String command, String permissionNode, AbstractCommand parent, boolean noConsole) {
|
||||
protected AbstractCommand(String command, AbstractCommand parent, boolean noConsole) {
|
||||
this.command = command;
|
||||
this.parent = parent;
|
||||
this.permissionNode = permissionNode;
|
||||
this.noConsole = noConsole;
|
||||
}
|
||||
|
||||
@ -24,18 +23,19 @@ public abstract class AbstractCommand {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
public String getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
public String getPermissionNode() {
|
||||
return permissionNode;
|
||||
}
|
||||
|
||||
public boolean isNoConsole() {
|
||||
return noConsole;
|
||||
}
|
||||
|
||||
protected abstract boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args);
|
||||
protected abstract ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args);
|
||||
|
||||
public abstract String getPermissionNode();
|
||||
|
||||
public abstract String getSyntax();
|
||||
|
||||
public abstract String getDescription();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.songoda.epicspawners.command;
|
||||
|
||||
import com.songoda.arconix.api.methods.formatting.TextComponent;
|
||||
import com.songoda.arconix.plugin.Arconix;
|
||||
import com.songoda.epicspawners.EpicSpawnersPlugin;
|
||||
import com.songoda.epicspawners.command.commands.*;
|
||||
import org.bukkit.command.Command;
|
||||
@ -9,6 +10,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandManager implements CommandExecutor {
|
||||
@ -20,9 +22,12 @@ public class CommandManager implements CommandExecutor {
|
||||
public CommandManager(EpicSpawnersPlugin instance) {
|
||||
this.instance = instance;
|
||||
|
||||
instance.getCommand("EpicSpawners").setExecutor(this);
|
||||
instance.getCommand("SpawnerStats").setExecutor(this);
|
||||
instance.getCommand("SpawnerShop").setExecutor(this);
|
||||
|
||||
AbstractCommand commandEpicSpawners = addCommand(new CommandEpicSpawners());
|
||||
|
||||
addCommand(new CommandGive(commandEpicSpawners));
|
||||
addCommand(new CommandReload(commandEpicSpawners));
|
||||
addCommand(new CommandEditor(commandEpicSpawners));
|
||||
addCommand(new CommandGive(commandEpicSpawners));
|
||||
@ -64,10 +69,17 @@ public class CommandManager implements CommandExecutor {
|
||||
return;
|
||||
}
|
||||
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
||||
command.runCommand(instance, sender, strings);
|
||||
AbstractCommand.ReturnType returnType = command.runCommand(instance, sender, strings);
|
||||
if (returnType == AbstractCommand.ReturnType.SYNTAX_ERROR) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&cInvalid Syntax!"));
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
|
||||
}
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
|
||||
}
|
||||
|
||||
public List<AbstractCommand> getCommands() {
|
||||
return Collections.unmodifiableList(commands);
|
||||
}
|
||||
}
|
||||
|
@ -15,26 +15,26 @@ import java.util.Date;
|
||||
public class CommandBoost extends AbstractCommand {
|
||||
|
||||
public CommandBoost(AbstractCommand parent) {
|
||||
super("boost", "epicspawners.admin", parent, false);
|
||||
super("boost", parent, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
if (args.length < 3) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7Syntax error..."));
|
||||
return false;
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
}
|
||||
if (!args[1].contains("p:") && !args[1].contains("player:") &&
|
||||
!args[1].contains("f:") && !args[1].contains("faction:") &&
|
||||
!args[1].contains("t:") && !args[1].contains("town:") &&
|
||||
!args[1].contains("i:") && !args[1].contains("island:")) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[1] + " &7this is incorrect"));
|
||||
return false;
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
}
|
||||
String[] arr = (args[1]).split(":");
|
||||
if (!AMath.isInt(args[2])) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[2] + " &7is not a number..."));
|
||||
return false;
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
@ -62,7 +62,7 @@ public class CommandBoost extends AbstractCommand {
|
||||
response += " &7for &6" + arr2[1] + " years&7.";
|
||||
} else {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7" + args[3] + " &7is invalid."));
|
||||
return false;
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
}
|
||||
} else {
|
||||
c.add(Calendar.YEAR, 10);
|
||||
@ -86,7 +86,7 @@ public class CommandBoost extends AbstractCommand {
|
||||
} else if (arr[0].equalsIgnoreCase("f") || arr[0].equalsIgnoreCase("faction")) {
|
||||
if (instance.getFactionId(arr[1]) == null) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat faction does not exist..."));
|
||||
return false;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
start += "The faction";
|
||||
@ -95,7 +95,7 @@ public class CommandBoost extends AbstractCommand {
|
||||
} else if (arr[0].equalsIgnoreCase("t") || arr[0].equalsIgnoreCase("town")) {
|
||||
if (instance.getTownId(arr[1]) == null) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat town does not exist..."));
|
||||
return false;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
start += "The town";
|
||||
@ -104,7 +104,7 @@ public class CommandBoost extends AbstractCommand {
|
||||
} else if (arr[0].equalsIgnoreCase("i") || arr[0].equalsIgnoreCase("island")) {
|
||||
if (instance.getIslandId(arr[1]) == null) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat island does not exist..."));
|
||||
return false;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
start += "The island";
|
||||
@ -113,14 +113,28 @@ public class CommandBoost extends AbstractCommand {
|
||||
}
|
||||
|
||||
if (boostType == null || boostObject == null) {
|
||||
sender.sendMessage("Syntax error.");
|
||||
return false;
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
BoostData boostData = new BoostData(boostType, Integer.parseInt(args[2]), c.getTime().getTime(), boostObject);
|
||||
instance.getBoostManager().addBoostToSpawner(boostData);
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + start + response));
|
||||
|
||||
return true;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.admin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/es boost <p:player, f:faction, t:town, i:islandOwner> <amount> [m:minute, h:hour, d:day, y:year]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "This allows you to boost the amount of spawns that are got from placed spawners.";
|
||||
}
|
||||
}
|
||||
|
@ -16,25 +16,25 @@ import org.bukkit.entity.Player;
|
||||
public class CommandChange extends AbstractCommand {
|
||||
|
||||
public CommandChange(AbstractCommand abstractCommand) {
|
||||
super("change", null, abstractCommand, true);
|
||||
super("change", abstractCommand, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
|
||||
if (!sender.hasPermission("epicspawners.admin") && !sender.hasPermission("epicspawners.change.*") && !sender.hasPermission("epicspawners.change." + args[1].toUpperCase())) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
|
||||
return false;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
Block b = p.getTargetBlock(null, 200);
|
||||
Player player = (Player) sender;
|
||||
Block block = player.getTargetBlock(null, 200);
|
||||
|
||||
if (b.getType() != Material.SPAWNER) {
|
||||
if (block.getType() != Material.SPAWNER) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThis is not a spawner."));
|
||||
return false;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
Spawner spawner = instance.getSpawnerManager().getSpawnerFromWorld(b.getLocation());
|
||||
Spawner spawner = instance.getSpawnerManager().getSpawnerFromWorld(block.getLocation());
|
||||
|
||||
SpawnerData data = null;
|
||||
for (SpawnerData spawnerData : instance.getSpawnerManager().getAllSpawnerData()) {
|
||||
@ -45,8 +45,8 @@ public class CommandChange extends AbstractCommand {
|
||||
}
|
||||
|
||||
if (data == null) {
|
||||
p.sendMessage("This type does not exist.");
|
||||
return true;
|
||||
player.sendMessage("This type does not exist.");
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -60,11 +60,27 @@ public class CommandChange extends AbstractCommand {
|
||||
spawner.getCreatureSpawner().setSpawnedType(EntityType.valueOf("PIG"));
|
||||
}
|
||||
spawner.getCreatureSpawner().update();
|
||||
instance.getHologramHandler().processChange(b);
|
||||
instance.getHologramHandler().processChange(block);
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Successfully changed this spawner to &6" + args[1] + "&7."));
|
||||
return ReturnType.SUCCESS;
|
||||
} catch (Exception ee) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7That entity does not exist."));
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/es change <Type>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Changes the entity for the spawner you are looking at.";
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,27 @@ import org.bukkit.entity.Player;
|
||||
public class CommandEditor extends AbstractCommand {
|
||||
|
||||
public CommandEditor(AbstractCommand abstractCommand) {
|
||||
super("editor", "epicspawners.admin", abstractCommand, true);
|
||||
super("editor", abstractCommand, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
instance.getSpawnerEditor().openSpawnerSelector((Player) sender, 1);
|
||||
return true;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.admin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/es editor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Opens the spawner editor.";
|
||||
}
|
||||
}
|
||||
|
@ -8,28 +8,37 @@ import org.bukkit.command.CommandSender;
|
||||
public class CommandEpicSpawners extends AbstractCommand {
|
||||
|
||||
public CommandEpicSpawners() {
|
||||
super("EpicSpawners", null, null, false);
|
||||
super("EpicSpawners", null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(TextComponent.formatText("&f>>&m------------&6&l EpicSpawners Help &f&m------------&f<<"));
|
||||
sender.sendMessage(TextComponent.formatText(" &7Version " + instance.getDescription().getVersion() + " Created by &5&l&oBrianna"));
|
||||
|
||||
sender.sendMessage(TextComponent.formatText("&6/EpicSpawners&7 - Displays this page."));
|
||||
sender.sendMessage(TextComponent.formatText("&6/SpawnerShop&7 - Opens the spawner shop."));
|
||||
sender.sendMessage(TextComponent.formatText("&6/spawnerstats&7 - Allows a player to overview their current EpicSpawners stats and see how many kills they have left to get a specific spawner drop."));
|
||||
if (sender.hasPermission("epicspawners.admin")) {
|
||||
sender.sendMessage(TextComponent.formatText("&6/es reload &7Reload the Configuration and Language files."));
|
||||
sender.sendMessage(TextComponent.formatText("&6/es editor&7 - Opens the spawner editor."));
|
||||
sender.sendMessage(TextComponent.formatText("&6/es change <Type>&7 - Changes the entity for the spawner you are looking at."));
|
||||
sender.sendMessage(TextComponent.formatText("&6/es give [player/all] [spawnertype/random] [multiplier] [amount]&7 - Gives an operator the ability to spawn a spawner of his or her choice."));
|
||||
sender.sendMessage(TextComponent.formatText("&6/es settings&7 - Edit the EpicSpawners Settings."));
|
||||
sender.sendMessage(TextComponent.formatText("&6/es boost <p:player, f:faction, t:town, i:islandOwner> <amount> [m:minute, h:hour, d:day, y:year]&7 - This allows you to boost the amount of spawns that are got from placed spawners."));
|
||||
for (AbstractCommand command : instance.getCommandManager().getCommands()) {
|
||||
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
||||
sender.sendMessage(TextComponent.formatText("&6" + command.getSyntax() + "&7 - " + command.getDescription()));
|
||||
}
|
||||
}
|
||||
sender.sendMessage("");
|
||||
|
||||
return false;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/EpicSpawners";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Displays this page.";
|
||||
}
|
||||
}
|
||||
|
@ -18,18 +18,17 @@ import java.util.Random;
|
||||
public class CommandGive extends AbstractCommand {
|
||||
|
||||
public CommandGive(AbstractCommand abstractCommand) {
|
||||
super("give", "epicspawners.admin", abstractCommand, false);
|
||||
super("give", abstractCommand, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
if (args.length <= 3 && args.length != 6) {
|
||||
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7Syntax error..."));
|
||||
return true;
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
}
|
||||
if (Bukkit.getPlayerExact(args[1]) == null && !args[1].toLowerCase().equals("all")) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat username does not exist, or the user is not online!"));
|
||||
return true;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
int multi = 1;
|
||||
|
||||
@ -58,7 +57,7 @@ public class CommandGive extends AbstractCommand {
|
||||
if (args.length == 4) {
|
||||
if (!AMath.isInt(args[3])) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[3] + "&7 is not a number."));
|
||||
return true;
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
}
|
||||
int amt = Integer.parseInt(args[3]);
|
||||
ItemStack spawnerItem = data.toItemStack(Integer.parseInt(args[3]));
|
||||
@ -76,11 +75,11 @@ public class CommandGive extends AbstractCommand {
|
||||
} else {
|
||||
if (!AMath.isInt(args[3])) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[3] + "&7 is not a number."));
|
||||
return true;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
if (!AMath.isInt(args[4])) {
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[4] + "&7 is not a number."));
|
||||
return true;
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
int amt = Integer.parseInt(args[3]);
|
||||
multi = Integer.parseInt(args[4]);
|
||||
@ -98,6 +97,21 @@ public class CommandGive extends AbstractCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.admin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/es give [player/all] [spawnertype/random] [multiplier] [amount]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Gives an operator the ability to spawn a spawner of his or her choice.";
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,28 @@ import org.bukkit.command.CommandSender;
|
||||
public class CommandReload extends AbstractCommand {
|
||||
|
||||
public CommandReload(AbstractCommand parent) {
|
||||
super("reload", "epicspawners.admin", parent, false);
|
||||
super("reload", parent, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
instance.reload();
|
||||
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Configuration and Language files reloaded."));
|
||||
return false;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.admin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/es reload";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Reload the Configuration and Language files.";
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,27 @@ import org.bukkit.entity.Player;
|
||||
public class CommandSettings extends AbstractCommand {
|
||||
|
||||
public CommandSettings(AbstractCommand parent) {
|
||||
super("settings", "epicspawners.admin", parent, true);
|
||||
super("settings", parent, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
instance.getSettingsManager().openSettingsManager((Player)sender);
|
||||
return false;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.admin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/es settings";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Edit the EpicSpawners Settings.";
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,27 @@ import org.bukkit.entity.Player;
|
||||
public class CommandSpawnerShop extends AbstractCommand {
|
||||
|
||||
public CommandSpawnerShop() {
|
||||
super("spawnershop", "epicspawners.openshop", null, true);
|
||||
super("spawnershop", null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
instance.getShop().open((Player) sender, 1);
|
||||
return false;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.openshop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/SpawnerShop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Opens the spawner shop.";
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ import java.util.Map;
|
||||
public class CommandSpawnerStats extends AbstractCommand {
|
||||
|
||||
public CommandSpawnerStats() {
|
||||
super("spawnerstats", "epicspawners.stats", null, true);
|
||||
super("spawnerstats", null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
int size = 0;
|
||||
@ -65,7 +65,7 @@ public class CommandSpawnerStats extends AbstractCommand {
|
||||
|
||||
if (instance.getPlayerActionManager().getPlayerAction(player).getEntityKills().size() == 0) {
|
||||
player.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("interface.spawnerstats.nokills"));
|
||||
return true;
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
player.sendMessage(instance.getReferences().getPrefix());
|
||||
@ -98,7 +98,21 @@ public class CommandSpawnerStats extends AbstractCommand {
|
||||
|
||||
player.openInventory(i);
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
return false;
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.stats";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/SpawnerStats";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "This allows you to boost the amount of spawns that are got from placed spawners.";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user