mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-17 04:51:28 +01:00
Remove set/remove class commands.
Similar to a88556771f
.
This specific change may stir the pot a bit, since some people may rely on the set command. However, class chests solve a lot of the problems that the initial command set out to tackle, and we can probably do better in a rewrite of the command if it's missed anyway.
The removed commands render a few methods in ArenaMaster obsolete.
This commit is contained in:
parent
baf709b446
commit
51b4b25094
@ -17,11 +17,9 @@ import com.garbagemule.MobArena.commands.setup.ConfigCommand;
|
|||||||
import com.garbagemule.MobArena.commands.setup.EditArenaCommand;
|
import com.garbagemule.MobArena.commands.setup.EditArenaCommand;
|
||||||
import com.garbagemule.MobArena.commands.setup.ListClassesCommand;
|
import com.garbagemule.MobArena.commands.setup.ListClassesCommand;
|
||||||
import com.garbagemule.MobArena.commands.setup.RemoveArenaCommand;
|
import com.garbagemule.MobArena.commands.setup.RemoveArenaCommand;
|
||||||
import com.garbagemule.MobArena.commands.setup.RemoveClassCommand;
|
|
||||||
import com.garbagemule.MobArena.commands.setup.RemoveContainerCommand;
|
import com.garbagemule.MobArena.commands.setup.RemoveContainerCommand;
|
||||||
import com.garbagemule.MobArena.commands.setup.RemoveLeaderboardCommand;
|
import com.garbagemule.MobArena.commands.setup.RemoveLeaderboardCommand;
|
||||||
import com.garbagemule.MobArena.commands.setup.RemoveSpawnpointCommand;
|
import com.garbagemule.MobArena.commands.setup.RemoveSpawnpointCommand;
|
||||||
import com.garbagemule.MobArena.commands.setup.SetClassCommand;
|
|
||||||
import com.garbagemule.MobArena.commands.setup.SettingCommand;
|
import com.garbagemule.MobArena.commands.setup.SettingCommand;
|
||||||
import com.garbagemule.MobArena.commands.setup.SetupCommand;
|
import com.garbagemule.MobArena.commands.setup.SetupCommand;
|
||||||
import com.garbagemule.MobArena.commands.user.ArenaListCommand;
|
import com.garbagemule.MobArena.commands.user.ArenaListCommand;
|
||||||
@ -238,8 +236,6 @@ public class CommandHandler implements CommandExecutor
|
|||||||
register(RemoveContainerCommand.class);
|
register(RemoveContainerCommand.class);
|
||||||
|
|
||||||
register(ListClassesCommand.class);
|
register(ListClassesCommand.class);
|
||||||
register(SetClassCommand.class);
|
|
||||||
register(RemoveClassCommand.class);
|
|
||||||
register(ClassChestCommand.class);
|
register(ClassChestCommand.class);
|
||||||
|
|
||||||
register(RemoveLeaderboardCommand.class);
|
register(RemoveLeaderboardCommand.class);
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
package com.garbagemule.MobArena.commands.setup;
|
|
||||||
|
|
||||||
import com.garbagemule.MobArena.ArenaClass;
|
|
||||||
import com.garbagemule.MobArena.commands.Command;
|
|
||||||
import com.garbagemule.MobArena.commands.CommandInfo;
|
|
||||||
import com.garbagemule.MobArena.framework.ArenaMaster;
|
|
||||||
import com.garbagemule.MobArena.util.TextUtils;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
@CommandInfo(
|
|
||||||
name = "removeclass",
|
|
||||||
pattern = "(del(.)*|r(e)?m(ove)?)class",
|
|
||||||
usage = "/ma removeclass <classname>",
|
|
||||||
desc = "remove the given class",
|
|
||||||
permission = "mobarena.setup.classes"
|
|
||||||
)
|
|
||||||
public class RemoveClassCommand implements Command
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean execute(ArenaMaster am, CommandSender sender, String... args) {
|
|
||||||
// Require a class name
|
|
||||||
if (args.length != 1) return false;
|
|
||||||
|
|
||||||
// Find the class
|
|
||||||
ArenaClass arenaClass = am.getClasses().get(args[0]);
|
|
||||||
String className = TextUtils.camelCase(args[0]);
|
|
||||||
if (arenaClass == null) {
|
|
||||||
am.getGlobalMessenger().tell(sender, "The class '" + className + "' does not exist.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
am.removeClassNode(className);
|
|
||||||
am.getGlobalMessenger().tell(sender, "Removed class '" + className + "'.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package com.garbagemule.MobArena.commands.setup;
|
|
||||||
|
|
||||||
import com.garbagemule.MobArena.ArenaClass;
|
|
||||||
import com.garbagemule.MobArena.Msg;
|
|
||||||
import com.garbagemule.MobArena.commands.Command;
|
|
||||||
import com.garbagemule.MobArena.commands.CommandInfo;
|
|
||||||
import com.garbagemule.MobArena.commands.Commands;
|
|
||||||
import com.garbagemule.MobArena.framework.ArenaMaster;
|
|
||||||
import com.garbagemule.MobArena.util.TextUtils;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandInfo(
|
|
||||||
name = "setclass",
|
|
||||||
pattern = "setclass|saveclass",
|
|
||||||
usage = "/ma setclass (safe) <classname>",
|
|
||||||
desc = "save your inventory as a class",
|
|
||||||
permission = "mobarena.setup.classes"
|
|
||||||
)
|
|
||||||
public class SetClassCommand implements Command
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean execute(ArenaMaster am, CommandSender sender, String... args) {
|
|
||||||
if (!Commands.isPlayer(sender)) {
|
|
||||||
am.getGlobalMessenger().tell(sender, Msg.MISC_NOT_FROM_CONSOLE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Require at least a class name
|
|
||||||
if (args.length < 1) return false;
|
|
||||||
|
|
||||||
// Grab the argument, if any.
|
|
||||||
String arg1 = (args.length > 0 ? args[0] : "");
|
|
||||||
String arg2 = (args.length > 1 ? args[1] : "");
|
|
||||||
|
|
||||||
// Unwrap the sender.
|
|
||||||
Player p = Commands.unwrap(sender);
|
|
||||||
|
|
||||||
// Check if we're overwriting.
|
|
||||||
boolean safe = arg1.equals("safe");
|
|
||||||
if (safe && arg2.equals("")) return false;
|
|
||||||
|
|
||||||
// If so, use arg2, otherwise, use arg1
|
|
||||||
String className = TextUtils.camelCase(safe ? arg2 : arg1);
|
|
||||||
|
|
||||||
// Create the class.
|
|
||||||
ArenaClass arenaClass = am.createClassNode(className, p.getInventory(), safe);
|
|
||||||
|
|
||||||
// If the class is null, it was not created.
|
|
||||||
if (arenaClass == null) {
|
|
||||||
am.getGlobalMessenger().tell(p, "That class already exists!");
|
|
||||||
am.getGlobalMessenger().tell(p, "To overwrite, omit the 'safe' parameter.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, yay!
|
|
||||||
am.getGlobalMessenger().tell(p, "Class '" + className + "' set with your current inventory.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user