v0.88.3 - Added new commands: config reload, force end, enabled true|false

This commit is contained in:
Garbage Mule 2011-06-04 23:14:45 +02:00
parent 4145c4f5d7
commit 0ccbc22fca
6 changed files with 62 additions and 6 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: MobArena
main: com.garbagemule.MobArena.MobArena
version: 0.88.2
version: 0.88.3
commands:
ma:
description: Base command for MobArena

View File

@ -33,6 +33,7 @@ public class ArenaManager
protected static Location spectatorLoc = null;
protected static boolean isRunning = false;
protected static boolean isSetup = false;
protected static boolean isEnabled = true;
protected static boolean isProtected = true;
// Location variables for the arena region.
@ -176,6 +177,11 @@ public class ArenaManager
*/
public static void playerJoin(Player p)
{
if (!isEnabled)
{
tellPlayer(p, "MobArena is not enabled.");
return;
}
if (!isSetup)
{
tellPlayer(p, "MobArena has not been set up yet!");

View File

@ -103,6 +103,52 @@ public class MACommands implements CommandExecutor
String cmd = args[0].toLowerCase();
String arg = args[1].toLowerCase();
// ma enabled [true|false]
if (cmd.equals("enabled"))
{
if (!arg.equals("true") && !arg.equals("false"))
{
ArenaManager.tellPlayer(p, "/ma enabled [true|false]");
return true;
}
// Set the boolean
ArenaManager.isEnabled = Boolean.valueOf(arg);
ArenaManager.tellPlayer(p, "Enabled: " + arg);
return true;
}
// ma force end
if (cmd.equals("force"))
{
if (!arg.equals("end"))
{
ArenaManager.tellPlayer(p, "/ma force end");
return true;
}
// End the arena.
for (Player player : ArenaManager.playerSet)
ArenaManager.playerLeave(player);
ArenaManager.tellPlayer(p, "Forced arena end.");
return true;
}
// ma config reload
if (cmd.equals("config"))
{
if (!arg.equals("reload"))
{
ArenaManager.tellPlayer(p, "/ma config reload");
return true;
}
// End the arena.
ArenaManager.init(ArenaManager.plugin);
ArenaManager.tellPlayer(p, "Config-file was reloaded.");
return true;
}
// ma setwarp [arena|lobby|spectator]
if (cmd.equals("setwarp"))
{

View File

@ -72,7 +72,12 @@ public class MAUtils
ItemStack stack, current;
int id, amount;
PlayerInventory inv = clearInventory(p);
PlayerInventory inv;
if (reward)
inv = p.getInventory();
else
inv = clearInventory(p);
for (String s : strings)
{

View File

@ -20,8 +20,9 @@ public class MobArena extends JavaPlugin
/* Array of commands used to determine if a command belongs to MobArena
* or Mean Admins. */
public final String[] COMMANDS = {"join", "j", "leave", "l", "list", "who", "spectate", "spec",
"setwarp", "addspawn", "delspawn", "setregion", "expandregion",
"protect", "undo", "dooooo", "reset", "ready", "notready"};
"ready", "notready", "enabled", "force", "config", "setwarp",
"addspawn", "delspawn", "setregion", "expandregion", "protect",
"undo", "dooooo", "reset"};
public MobArena()
{
@ -74,9 +75,7 @@ public class MobArena extends JavaPlugin
public void onDisable()
{
for (Player p : ArenaManager.playerSet)
{
ArenaManager.playerLeave(p);
}
System.out.println("WAIT! WHAT ARE YOU DOING?!");
}