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 name: MobArena
main: com.garbagemule.MobArena.MobArena main: com.garbagemule.MobArena.MobArena
version: 0.88.2 version: 0.88.3
commands: commands:
ma: ma:
description: Base command for MobArena description: Base command for MobArena

View File

@ -33,6 +33,7 @@ public class ArenaManager
protected static Location spectatorLoc = null; protected static Location spectatorLoc = null;
protected static boolean isRunning = false; protected static boolean isRunning = false;
protected static boolean isSetup = false; protected static boolean isSetup = false;
protected static boolean isEnabled = true;
protected static boolean isProtected = true; protected static boolean isProtected = true;
// Location variables for the arena region. // Location variables for the arena region.
@ -176,6 +177,11 @@ public class ArenaManager
*/ */
public static void playerJoin(Player p) public static void playerJoin(Player p)
{ {
if (!isEnabled)
{
tellPlayer(p, "MobArena is not enabled.");
return;
}
if (!isSetup) if (!isSetup)
{ {
tellPlayer(p, "MobArena has not been set up yet!"); 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 cmd = args[0].toLowerCase();
String arg = args[1].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] // ma setwarp [arena|lobby|spectator]
if (cmd.equals("setwarp")) if (cmd.equals("setwarp"))
{ {

View File

@ -72,7 +72,12 @@ public class MAUtils
ItemStack stack, current; ItemStack stack, current;
int id, amount; int id, amount;
PlayerInventory inv = clearInventory(p); PlayerInventory inv;
if (reward)
inv = p.getInventory();
else
inv = clearInventory(p);
for (String s : strings) 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 /* Array of commands used to determine if a command belongs to MobArena
* or Mean Admins. */ * or Mean Admins. */
public final String[] COMMANDS = {"join", "j", "leave", "l", "list", "who", "spectate", "spec", public final String[] COMMANDS = {"join", "j", "leave", "l", "list", "who", "spectate", "spec",
"setwarp", "addspawn", "delspawn", "setregion", "expandregion", "ready", "notready", "enabled", "force", "config", "setwarp",
"protect", "undo", "dooooo", "reset", "ready", "notready"}; "addspawn", "delspawn", "setregion", "expandregion", "protect",
"undo", "dooooo", "reset"};
public MobArena() public MobArena()
{ {
@ -74,9 +75,7 @@ public class MobArena extends JavaPlugin
public void onDisable() public void onDisable()
{ {
for (Player p : ArenaManager.playerSet) for (Player p : ArenaManager.playerSet)
{
ArenaManager.playerLeave(p); ArenaManager.playerLeave(p);
}
System.out.println("WAIT! WHAT ARE YOU DOING?!"); System.out.println("WAIT! WHAT ARE YOU DOING?!");
} }