v0.87 fixed bugs, added compatibility with Mean Admins, added command alias /mobarena, bigger auto-generated arena
This commit is contained in:
Binary file not shown.
+6
-1
@@ -1,7 +1,12 @@
|
||||
name: MobArena
|
||||
main: com.garbagemule.MobArena.MobArena
|
||||
version: 0.84
|
||||
version: 0.87
|
||||
commands:
|
||||
mobarena:
|
||||
description: Base command for MobArena
|
||||
usage: |
|
||||
/mobarena join - Join the arena.
|
||||
/mobarena leave - Leave the arena.
|
||||
marena:
|
||||
description: Base command for MobArena
|
||||
usage: |
|
||||
|
||||
@@ -390,7 +390,7 @@ public class ArenaManager
|
||||
if (r.equals("")) continue;
|
||||
|
||||
tellPlayer(p, "Here are all of your rewards!");
|
||||
MAUtils.giveItems(p, r);
|
||||
MAUtils.giveItems(true, p, r);
|
||||
}
|
||||
|
||||
rewardMap.clear();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.garbagemule.MobArena;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -19,6 +20,14 @@ public class MACommands implements CommandExecutor
|
||||
*/
|
||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
|
||||
{
|
||||
// Check if the server is also running Mean Admins.
|
||||
Plugin ma = ArenaManager.server.getPluginManager().getPlugin("Mean Admins");
|
||||
if (ma != null && !Arrays.asList(ArenaManager.plugin.COMMANDS).contains(args[0].toLowerCase()))
|
||||
{
|
||||
ma.onCommand(sender, command, commandLabel, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only accept commands from players.
|
||||
if ((sender == null) || !(sender instanceof Player))
|
||||
{
|
||||
@@ -206,25 +215,10 @@ public class MACommands implements CommandExecutor
|
||||
{
|
||||
if (args.length != 4)
|
||||
return false;
|
||||
/*
|
||||
if (!args[4].matches("[0-9]+"))
|
||||
return false;
|
||||
|
||||
int radius = Integer.parseInt(args[4]);
|
||||
if (radius < 5)
|
||||
{
|
||||
ArenaManager.tellPlayer(p, "You don't want an arena that small...");
|
||||
return true;
|
||||
}
|
||||
else if (radius > 10)
|
||||
{
|
||||
ArenaManager.tellPlayer(p, "If you want a bigger arena, build it yourself >:O");
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
if (args[1].equals("it") && args[2].equals("hippie") && args[3].equals("monster"))
|
||||
{
|
||||
MAUtils.DoooooItHippieMonster(p.getLocation(), 10);
|
||||
MAUtils.DoooooItHippieMonster(p.getLocation(), 13);
|
||||
ArenaManager.tellPlayer(p, "Auto-generated a working MobArena!");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,14 +27,20 @@ public class MADisconnectListener extends PlayerListener
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (ArenaManager.playerSet.contains(p))
|
||||
{
|
||||
MAUtils.clearInventory(p);
|
||||
ArenaManager.playerLeave(p);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerKick(PlayerKickEvent event)
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (ArenaManager.playerSet.contains(p))
|
||||
{
|
||||
MAUtils.clearInventory(p);
|
||||
ArenaManager.playerLeave(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ public class MASpawnThread implements Runnable
|
||||
private int wave, noOfSpawnPoints, noOfPlayers;
|
||||
private int dZombies, dSkeletons, dSpiders, dCreepers;
|
||||
private Random random;
|
||||
private Player target;
|
||||
private String reward, currentRewards;
|
||||
|
||||
public MASpawnThread()
|
||||
|
||||
@@ -35,6 +35,8 @@ public class MATeleportListener extends PlayerListener
|
||||
|
||||
ArenaManager.tellPlayer(p, "Can't warp in arena! To leave, type /marena leave");
|
||||
event.setCancelled(true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,11 +66,11 @@ public class MAUtils
|
||||
}
|
||||
|
||||
/* Gives all the items in the input string(s) to the player */
|
||||
public static void giveItems(Player p, String... strings)
|
||||
public static void giveItems(boolean reward, Player p, String... strings)
|
||||
{
|
||||
// Variables used.
|
||||
ItemStack stack;
|
||||
int index, id, amount;
|
||||
ItemStack stack, current;
|
||||
int id, amount;
|
||||
|
||||
PlayerInventory inv = clearInventory(p);
|
||||
|
||||
@@ -100,24 +100,28 @@ public class MAUtils
|
||||
{
|
||||
id = Integer.parseInt(item[0]);
|
||||
stack = new ItemStack(id, amount);
|
||||
if (Arrays.asList(SWORDS_ID).contains(id))
|
||||
if (!reward && Arrays.asList(SWORDS_ID).contains(id))
|
||||
stack.setDurability((short)-3276);
|
||||
}
|
||||
else
|
||||
{
|
||||
stack = makeItemStack(item[0], amount);
|
||||
if (stack == null) continue;
|
||||
if (Arrays.asList(SWORDS_TYPE).contains(stack.getType()))
|
||||
if (!reward && Arrays.asList(SWORDS_TYPE).contains(stack.getType()))
|
||||
stack.setDurability((short)-3276);
|
||||
}
|
||||
|
||||
// Put the item in the first empty inventory slot.
|
||||
index = inv.firstEmpty();
|
||||
inv.setItem(index,stack);
|
||||
inv.addItem(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Used for giving items "normally". */
|
||||
public static void giveItems(Player p, String... strings)
|
||||
{
|
||||
giveItems(false, p, strings);
|
||||
}
|
||||
|
||||
/* Helper method for grabbing a random reward */
|
||||
public static String getRandomReward(String rewardlist)
|
||||
{
|
||||
@@ -668,7 +672,7 @@ public class MAUtils
|
||||
setCoords("lobby", new Location(ArenaManager.world, x1+2, y1-3, z1+2));
|
||||
setCoords("spectator", new Location(ArenaManager.world, loc.getX(), y2+1, loc.getZ()));
|
||||
setCoords("p1", new Location(ArenaManager.world, x1, y1-4, z1));
|
||||
setCoords("p2", new Location(ArenaManager.world, x2, y2, z2));
|
||||
setCoords("p2", new Location(ArenaManager.world, x2, y2+1, z2));
|
||||
setCoords("spawnpoints.s1", new Location(ArenaManager.world, x1+3, y1+2, z1+3));
|
||||
setCoords("spawnpoints.s2", new Location(ArenaManager.world, x1+3, y1+2, z2-3));
|
||||
setCoords("spawnpoints.s3", new Location(ArenaManager.world, x2-3, y1+2, z1+3));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.garbagemule.MobArena;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
@@ -16,6 +17,12 @@ import org.bukkit.plugin.PluginManager;
|
||||
*/
|
||||
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"};
|
||||
|
||||
public MobArena()
|
||||
{
|
||||
}
|
||||
@@ -31,6 +38,7 @@ public class MobArena extends JavaPlugin
|
||||
// Bind the /ma and /marena commands to MACommands.
|
||||
getCommand("ma").setExecutor(new MACommands());
|
||||
getCommand("marena").setExecutor(new MACommands());
|
||||
getCommand("mobarena").setExecutor(new MACommands());
|
||||
|
||||
// Create event listeners.
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
@@ -64,6 +72,11 @@ public class MobArena extends JavaPlugin
|
||||
|
||||
public void onDisable()
|
||||
{
|
||||
for (Player p : ArenaManager.playerSet)
|
||||
{
|
||||
ArenaManager.playerLeave(p);
|
||||
}
|
||||
|
||||
System.out.println("WAIT! WHAT ARE YOU DOING?!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user