Last update

This commit is contained in:
Garbage Mule 2011-07-04 17:09:03 +02:00
parent eae0439e25
commit 1498359add
9 changed files with 187 additions and 143 deletions

Binary file not shown.

View File

@ -62,7 +62,7 @@ public class Arena
// Setup fields
protected String name;
protected World world;
protected boolean enabled, running, setup, protect, autoEquip, forceRestore, softRestore, emptyInv, pvp, monsterInfight;
protected boolean enabled, running, setup, protect, autoEquip, forceRestore, softRestore, softRestoreDrops, emptyInvJoin, emptyInvSpec, pvp, monsterInfight, allowWarp;
protected boolean edit, waveClear, detCreepers, detDamage, lightning, hellhounds;
protected Location p1, p2, arenaLoc, lobbyLoc, spectatorLoc;
protected Map<String,Location> spawnpoints;
@ -170,11 +170,15 @@ public class Arena
}
// Start the spawnThread.
spawnThread = new MASpawnThread(this);
spawnThread = new MASpawnThread(plugin, this);
spawnTaskId = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, spawnThread, waveDelay, waveInterval);
readyPlayers.clear();
MAUtils.tellAll(this, MAMessages.get(Msg.ARENA_START));
// Notify listeners.
for (MobArenaListener listener : plugin.getAM().listeners)
listener.onArenaStart();
}
/**
@ -191,7 +195,7 @@ public class Arena
Bukkit.getServer().getScheduler().cancelTask(spawnTaskId);
}
if (!emptyInv)
if (!emptyInvJoin)
for (Player p : deadPlayers)
MAUtils.restoreInventory(p);
@ -202,7 +206,6 @@ public class Arena
// Clear all the sets and maps.
livePlayers.clear();
deadPlayers.clear();
//specPlayers.clear();
pets.clear();
classMap.clear();
rewardMap.clear();
@ -216,6 +219,10 @@ public class Arena
// Set the spawn flags to restore monster spawning.
MAUtils.setSpawnFlags(plugin, world, spawnMonsters, allowMonsters, allowAnimals);
MAUtils.tellAll(this, MAMessages.get(Msg.ARENA_END));
// Notify listeners.
for (MobArenaListener listener : plugin.getAM().listeners)
listener.onArenaEnd();
}
/**
@ -256,6 +263,10 @@ public class Arena
MAUtils.sitPets(p);
livePlayers.add(p);
p.teleport(lobbyLoc);
// Notify listeners.
for (MobArenaListener listener : plugin.getAM().listeners)
listener.onPlayerJoin(p);
}
/**
@ -287,14 +298,19 @@ public class Arena
if (livePlayers.remove(p)) clear = true;
if (deadPlayers.remove(p)) clear = false;
if (specPlayers.remove(p)) clear = false;
removePets(p);
if (clear) MAUtils.clearInventory(p);
if (!emptyInv) MAUtils.restoreInventory(p);
if (clear) MAUtils.clearInventory(p);
if (!emptyInvJoin) MAUtils.restoreInventory(p);
if (running && livePlayers.isEmpty())
endArena();
else if (!readyPlayers.isEmpty() && readyPlayers.equals(livePlayers))
startArena();
// Notify listeners.
for (MobArenaListener listener : plugin.getAM().listeners)
listener.onPlayerLeave(p);
}
public void playerQuit(Player p)
@ -304,6 +320,7 @@ public class Arena
livePlayers.remove(p);
deadPlayers.remove(p);
specPlayers.remove(p);
removePets(p);
if (running && livePlayers.isEmpty())
endArena();
@ -320,6 +337,7 @@ public class Arena
// Add to the list of dead players.
livePlayers.remove(p);
deadPlayers.add(p);
removePets(p);
// Has to be delayed for TombStone not to fuck shit up.
if (running && livePlayers.isEmpty())
@ -332,6 +350,10 @@ public class Arena
endArena();
}
}, 10);
// Notify listeners.
for (MobArenaListener listener : plugin.getAM().listeners)
listener.onPlayerDeath(p);
}
public void playerSpec(Player p, Location loc)
@ -407,6 +429,13 @@ public class Arena
w.remove();
}
private void removePets(Player p)
{
for (Wolf w : pets)
if (w.getOwner().equals(p))
w.remove();
}
private void removeEntities()
{
Chunk c1 = world.getChunkAt(p1);
@ -434,43 +463,46 @@ public class Arena
String arenaPath = "arenas." + MAUtils.nameArenaToConfig(name) + ".settings.";
String configName = MAUtils.nameArenaToConfig(name);
enabled = config.getBoolean(arenaPath + "enabled", true);
protect = config.getBoolean(arenaPath + "protect", true);
autoEquip = config.getBoolean(arenaPath + "auto-equip-armor", true);
waveClear = config.getBoolean(arenaPath + "wave-clear", false);
detCreepers = config.getBoolean(arenaPath + "detonate-creepers", false);
detDamage = config.getBoolean(arenaPath + "detonate-damage", false);
lightning = config.getBoolean(arenaPath + "lightning", true);
forceRestore = config.getBoolean(arenaPath + "force-restore", false);
softRestore = config.getBoolean(arenaPath + "soft-restore", false);
emptyInv = config.getBoolean(arenaPath + "require-empty-inventory", false);
hellhounds = config.getBoolean(arenaPath + "hellhounds", false);
pvp = config.getBoolean(arenaPath + "pvp-enabled", false);
monsterInfight = config.getBoolean(arenaPath + "monster-infight", false);
waveDelay = config.getInt(arenaPath + "first-wave-delay", 5) * 20;
waveInterval = config.getInt(arenaPath + "wave-interval", 20) * 20;
specialModulo = config.getInt(arenaPath + "special-modulo", 4);
maxIdleTime = config.getInt(arenaPath + "max-idle-time", 0);
enabled = config.getBoolean(arenaPath + "enabled", true);
protect = config.getBoolean(arenaPath + "protect", true);
autoEquip = config.getBoolean(arenaPath + "auto-equip-armor", true);
waveClear = config.getBoolean(arenaPath + "clear-wave-before-next", false);
detCreepers = config.getBoolean(arenaPath + "detonate-creepers", false);
detDamage = config.getBoolean(arenaPath + "detonate-damage", false);
lightning = config.getBoolean(arenaPath + "lightning", true);
forceRestore = config.getBoolean(arenaPath + "force-restore", false);
softRestore = config.getBoolean(arenaPath + "soft-restore", false);
softRestoreDrops = config.getBoolean(arenaPath + "soft-restore-drops", false);
emptyInvJoin = config.getBoolean(arenaPath + "require-empty-inv-join", false);
emptyInvSpec = config.getBoolean(arenaPath + "require-empty-inv-spec", false);
hellhounds = config.getBoolean(arenaPath + "hellhounds", false);
pvp = config.getBoolean(arenaPath + "pvp-enabled", false);
monsterInfight = config.getBoolean(arenaPath + "monster-infight", false);
allowWarp = config.getBoolean(arenaPath + "allow-teleporting", false);
repairDelay = config.getInt(arenaPath + "repair-delay", 5);
waveDelay = config.getInt(arenaPath + "first-wave-delay", 5) * 20;
waveInterval = config.getInt(arenaPath + "wave-interval", 20) * 20;
specialModulo = config.getInt(arenaPath + "special-modulo", 4);
maxIdleTime = config.getInt(arenaPath + "max-idle-time", 0) * 20;
distDefault = MAUtils.getArenaDistributions(config, configName, "default");
distSpecial = MAUtils.getArenaDistributions(config, configName, "special");
everyWaveMap = MAUtils.getArenaRewardMap(config, configName, "every");
afterWaveMap = MAUtils.getArenaRewardMap(config, configName, "after");
distDefault = MAUtils.getArenaDistributions(config, configName, "default");
distSpecial = MAUtils.getArenaDistributions(config, configName, "special");
everyWaveMap = MAUtils.getArenaRewardMap(config, configName, "every");
afterWaveMap = MAUtils.getArenaRewardMap(config, configName, "after");
p1 = MAUtils.getArenaCoord(config, world, configName, "p1");
p2 = MAUtils.getArenaCoord(config, world, configName, "p2");
arenaLoc = MAUtils.getArenaCoord(config, world, configName, "arena");
lobbyLoc = MAUtils.getArenaCoord(config, world, configName, "lobby");
spectatorLoc = MAUtils.getArenaCoord(config, world, configName, "spectator");
spawnpoints = MAUtils.getArenaSpawnpoints(config, world, configName);
p1 = MAUtils.getArenaCoord(config, world, configName, "p1");
p2 = MAUtils.getArenaCoord(config, world, configName, "p2");
arenaLoc = MAUtils.getArenaCoord(config, world, configName, "arena");
lobbyLoc = MAUtils.getArenaCoord(config, world, configName, "lobby");
spectatorLoc = MAUtils.getArenaCoord(config, world, configName, "spectator");
spawnpoints = MAUtils.getArenaSpawnpoints(config, world, configName);
classes = plugin.getAM().classes;
classItems = plugin.getAM().classItems;
classArmor = plugin.getAM().classArmor;
repairDelay = plugin.getAM().repairDelay;
classes = plugin.getAM().classes;
classItems = plugin.getAM().classItems;
classArmor = plugin.getAM().classArmor;
// Determine if the arena is properly set up. Then add the to arena list.
setup = MAUtils.verifyData(this);
setup = MAUtils.verifyData(this);
}
public void serializeConfig()
@ -624,6 +656,19 @@ public class Arena
if (blocks.remove(b) || b.getType() == Material.TNT)
return;
if (softRestore)
{
int[] buffer = new int[5];
buffer[0] = b.getX();
buffer[1] = b.getY();
buffer[2] = b.getZ();
buffer[3] = b.getTypeId();
buffer[4] = (int) b.getData();
repairList.add(buffer);
if (!softRestoreDrops) event.getBlock().setTypeId(0);
return;
}
event.setCancelled(true);
}
@ -979,7 +1024,7 @@ public class Arena
// Teleport Listener
public void onPlayerTeleport(PlayerTeleportEvent event)
{
if (edit || !enabled || !setup)
if (edit || !enabled || !setup || allowWarp)
return;
if (!inRegion(event.getTo()) && !inRegion(event.getFrom()))
@ -1110,7 +1155,7 @@ public class Arena
monsters.remove(e);
// Compare the current size with the previous size.
if (monsters.size() != spawnThread.previousSize || spawnThread.previousSize == 0)
if (monsters.size() < spawnThread.previousSize || spawnThread.previousSize == 0)
return;
// Clear all player inventories, and "kill" all players.

View File

@ -24,7 +24,6 @@ public class ArenaMaster
// Settings
protected boolean enabled, updateNotify, autoEquip, emptyInvs, hellhounds;
protected int repairDelay;
// Classes
protected List<String> classes;
@ -76,17 +75,50 @@ public class ArenaMaster
return result;
}
public List<Player> getAllPlayers()
{
List<Player> result = new LinkedList<Player>();
for (Arena arena : arenas)
result.addAll(arena.getAllPlayers());
return result;
}
public List<Player> getAllPlayersInArena(String arenaName)
{
Arena arena = getArenaWithName(arenaName);
return (arena != null) ? arena.getLivingPlayers() : new LinkedList<Player>();
}
public List<Player> getAllLivingPlayers()
{
List<Player> result = new LinkedList<Player>();
for (Arena arena : arenas)
result.addAll(arena.getLivingPlayers());
return result;
}
public List<Player> getLivingPlayersInArena(String arenaName)
{
Arena arena = getArenaWithName(arenaName);
return (arena != null) ? arena.getLivingPlayers() : new LinkedList<Player>();
}
public Arena getArenaWithPlayer(Player p)
{
return arenaMap.get(p);
}
public Arena getArenaWithPlayer(String s)
public Arena getArenaWithPlayer(String playerName)
{
for (Map.Entry<Player,Arena> entry : arenaMap.entrySet())
return arenaMap.get(Bukkit.getServer().getPlayer(playerName));
}
public Arena getArenaWithSpectator(Player p)
{
for (Arena arena : arenas)
{
if (entry.getKey().getName().equals(s))
return entry.getValue();
if (arena.specPlayers.contains(p))
return arena;
}
return null;
}
@ -141,12 +173,10 @@ public class ArenaMaster
{
config.setProperty("global-settings.enabled", true);
config.setProperty("global-settings.update-notification", true);
config.setProperty("global-settings.repair-delay", 5);
}
enabled = config.getBoolean("global-settings.enabled", true);
updateNotify = config.getBoolean("global-settings.update-notification", true);
repairDelay = config.getInt("global-settings.repair-delay", 5);
}
/**
@ -217,19 +247,23 @@ public class ArenaMaster
config.setProperty("arenas." + configName + ".settings.protect", true);
config.save();
config.load();
config.setProperty("arenas." + configName + ".settings.wave-clear", false);
config.setProperty("arenas." + configName + ".settings.clear-wave-before-next", false);
config.setProperty("arenas." + configName + ".settings.detonate-creepers", false);
config.setProperty("arenas." + configName + ".settings.detonate-damage", false);
config.setProperty("arenas." + configName + ".settings.lightning", true);
config.setProperty("arenas." + configName + ".settings.auto-equip-armor", true);
config.setProperty("arenas." + configName + ".settings.force-restore", false);
config.setProperty("arenas." + configName + ".settings.soft-restore", false);
config.setProperty("arenas." + configName + ".settings.require-empty-inventory", false);
config.setProperty("arenas." + configName + ".settings.soft-restore-drops", false);
config.setProperty("arenas." + configName + ".settings.require-empty-inv-join", false);
config.setProperty("arenas." + configName + ".settings.require-empty-inv-spec", false);
config.setProperty("arenas." + configName + ".settings.hellhounds", false);
config.setProperty("arenas." + configName + ".settings.pvp-enabled", false);
config.setProperty("arenas." + configName + ".settings.monster-infight", false);
config.setProperty("arenas." + configName + ".settings.allow-teleporting", false);
config.save();
config.load();
config.setProperty("arenas." + configName + ".settings.repair-delay", 5);
config.setProperty("arenas." + configName + ".settings.first-wave-delay", 5);
config.setProperty("arenas." + configName + ".settings.wave-interval", 20);
config.setProperty("arenas." + configName + ".settings.special-modulo", 4);
@ -316,8 +350,6 @@ public class ArenaMaster
// Remove all Arenas no longer in the config.
arenas.retainAll(configArenas);
//for (Arena arena : arenas)
// arena.serializeConfig();
for (Arena arena : arenas)
arena.deserializeConfig();

View File

@ -94,7 +94,6 @@ public class MACommands implements CommandExecutor
String base = args[0].toLowerCase();
String arg1 = (args.length > 1) ? args[1].toLowerCase() : "";
String arg2 = (args.length > 2) ? args[2].toLowerCase() : "";
//String arg3 = (args.length >= 4) ? args[3].toLowerCase() : null;
@ -136,9 +135,9 @@ public class MACommands implements CommandExecutor
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_IS_RUNNING));
else if (arena.livePlayers.contains(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ALREADY_PLAYING));
else if (arena.emptyInv && !MAUtils.hasEmptyInventory(p))
else if (arena.emptyInvJoin && !MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_EMPTY_INV));
else if (!arena.emptyInv && !MAUtils.storeInventory(p))
else if (!arena.emptyInvJoin && !MAUtils.storeInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_STORE_INV_FAIL));
else error = false;
@ -178,9 +177,9 @@ public class MACommands implements CommandExecutor
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_IS_RUNNING));
else if (arena.livePlayers.contains(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ALREADY_PLAYING));
else if (arena.emptyInv && !MAUtils.hasEmptyInventory(p))
else if (arena.emptyInvJoin && !MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_EMPTY_INV));
else if (!arena.emptyInv && !MAUtils.storeInventory(p))
else if (!arena.emptyInvJoin && !MAUtils.storeInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_STORE_INV_FAIL));
else error = false;
@ -209,6 +208,14 @@ public class MACommands implements CommandExecutor
if (!am.arenaMap.containsKey(p))
{
Arena arena = am.getArenaWithSpectator(p);
if (arena != null)
{
arena.playerLeave(p);
MAUtils.tellPlayer(p, MAMessages.get(Msg.LEAVE_PLAYER_LEFT));
return true;
}
MAUtils.tellPlayer(p, MAMessages.get(Msg.LEAVE_NOT_PLAYING));
return true;
}
@ -243,10 +250,8 @@ public class MACommands implements CommandExecutor
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_ALREADY_PLAYING));
else if (arena == null)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.ARENA_DOES_NOT_EXIST));
/*else if (!arena.running)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_NOT_RUNNING));
else if (!MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV));*/
else if (arena.emptyInvSpec && !MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV));
else error = false;
if (error)
@ -264,17 +269,14 @@ public class MACommands implements CommandExecutor
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARG_NEEDED));
else if (arena == null)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.ARENA_DOES_NOT_EXIST));
/*else if (!arena.running)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_NOT_RUNNING));
else if (!MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV));*/
else if (arena.emptyInvSpec && !MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV));
else error = false;
if (error)
return true;
}
am.arenaMap.put(p,arena);
arena.playerSpec(p, p.getLocation());
MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_PLAYER_SPECTATE));
return true;
@ -351,37 +353,6 @@ public class MACommands implements CommandExecutor
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_LIST_PLAYERS, list));
return true;
}
/*
* Restore a player's inventory.
*/
if (base.equals("restore"))
{
if (arg1.isEmpty() && player)
{
if (am.getArenaWithPlayer(p) != null)
{
MAUtils.tellPlayer(sender, "You must first leave the current arena.");
return true;
}
if (MAUtils.restoreInventory(p))
MAUtils.tellPlayer(sender, "Restored your inventory!");
return true;
}
if (!arg1.isEmpty() && (op || console))
{
if (am.getArenaWithPlayer(arg1) != null)
{
MAUtils.tellPlayer(sender, "Player is currently in an arena.");
return true;
}
if (MAUtils.restoreInventory(Bukkit.getServer().getPlayer(arg1)));
MAUtils.tellPlayer(sender, "Restored " + arg1 + "'s inventory!");
return true;
}
}
@ -397,7 +368,6 @@ public class MACommands implements CommandExecutor
if ((base.equals("enable") || base.equals("disable")))
{
if (!console && !(player && MobArena.has(p, "mobarena.admin.enable")) && !op)
//if (player && !MobArena.has(p, "mobarena.admin.enable"))
{
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_NO_ACCESS));
return true;
@ -456,6 +426,31 @@ public class MACommands implements CommandExecutor
return true;
}
/*
* Restore a player's inventory.
*/
if (base.equals("restore"))
{
if (!console && !(player && MobArena.has(p, "mobarena.admin.restore")) && !op)
{
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_NO_ACCESS));
return true;
}
if (!arg1.isEmpty())
{
if (am.getArenaWithPlayer(arg1) != null)
{
MAUtils.tellPlayer(sender, "Player is currently in an arena.");
return true;
}
if (MAUtils.restoreInventory(Bukkit.getServer().getPlayer(arg1)));
MAUtils.tellPlayer(sender, "Restored " + arg1 + "'s inventory!");
return true;
}
}
/*
* Force start/end arenas.
*/

View File

@ -209,7 +209,7 @@ public class MAMessages
String[] split = s.split("=");
if (split.length != 2)
{
System.out.println("[MobArena] ERROR: Couldn't parse \"" + s + "\".");
System.out.println("[MobArena] ERROR: Couldn't parse \"" + s + "\". Check announcements-file.");
return;
}
@ -225,7 +225,7 @@ public class MAMessages
}
catch (Exception e)
{
System.out.println("[MobArena] ERROR: " + key + " is not a valid key!");
System.out.println("[MobArena] ERROR: " + key + " is not a valid key. Check announcements-file.");
return;
}
}

View File

@ -38,11 +38,13 @@ public class MASpawnThread implements Runnable
private int dZombies, dSkeletons, dSpiders, dCreepers, dWolves;
private int dPoweredCreepers, dPigZombies, dSlimes, dMonsters, dAngryWolves, dGiants, dGhasts;
private Random random;
private MobArena plugin;
private Arena arena;
private final double MIN_DISTANCE = 256;
public MASpawnThread(Arena arena)
public MASpawnThread(MobArena plugin, Arena arena)
{
this.plugin = plugin;
this.arena = arena;
modulo = arena.specialModulo;
if (modulo <= 0) modulo = -32768;
@ -94,20 +96,22 @@ public class MASpawnThread implements Runnable
if (wave % modulo == 0)
{
MAUtils.tellAll(arena, MAMessages.get(Msg.WAVE_SPECIAL, ""+wave));
/*for (MobArenaListener m : ArenaManager.listeners) TODO: Get API back up to speed.
m.onSpecialWave(wave, wave/modulo);*/
detonateCreepers(arena.detCreepers);
specialWave();
// Notify listeners.
for (MobArenaListener listener : plugin.getAM().listeners)
listener.onSpecialWave(wave, wave/modulo);
}
else
{
MAUtils.tellAll(arena, MAMessages.get(Msg.WAVE_DEFAULT, ""+wave));
/*for (MobArenaListener m : ArenaManager.listeners) TODO: More API
m.onDefaultWave(wave);*/
detonateCreepers(arena.detCreepers);
defaultWave();
// Notify listeners.
for (MobArenaListener listener : plugin.getAM().listeners)
listener.onDefaultWave(wave);
}
wave++;

View File

@ -296,7 +296,7 @@ public class MAUtils
String commands = config.getString("global-settings.allowed-commands");
if (commands == null)
{
config.setProperty("global-settings.allowed-commands", "/list");
config.setProperty("global-settings.allowed-commands", "/list, /pl");
config.save();
commands = config.getString("global-settings.allowed-commands");
}

View File

@ -191,9 +191,6 @@ public class MobArena extends JavaPlugin
config.setProperty("global-settings.update-notification", true);
config.save();
config.load();
config.setProperty("global-settings.repair-delay", 5);
config.save();
config.load();
// Copy classes
for (String s : oldConfig.getKeys("classes"))
@ -211,17 +208,6 @@ public class MobArena extends JavaPlugin
config.save();
config.load();
// Copy the waves and rewards to the new default arena.
for (String s : oldConfig.getKeys("waves.default"))
config.setProperty("arenas.default.waves.default." + s, oldConfig.getString("waves.default." + s));
config.save();
for (String s : oldConfig.getKeys("rewards.waves.every"))
config.setProperty("arenas.default.rewards.waves.every." + s, oldConfig.getString("rewards.waves.every." + s));
for (String s : oldConfig.getKeys("rewards.waves.after"))
config.setProperty("arenas.default.rewards.waves.after." + s, oldConfig.getString("rewards.waves.after." + s));
config.save();
config.load();
// Copy the coords.
for (String s : oldConfig.getKeys("coords"))
{

View File

@ -1,7 +1,6 @@
package com.garbagemule.MobArena;
import java.util.List;
import java.util.LinkedList;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -33,32 +32,15 @@ public class MobArenaHandler
// Arena getters
public Arena getArenaWithName(String arenaName) { return plugin.getAM().getArenaWithName(arenaName); }
public Arena getArenaWithPlayer(Player p) { return plugin.getAM().getArenaWithPlayer(p); }
public Arena getArenaWithPlayer(String player) { return plugin.getAM().getArenaWithPlayer(player); }
public Arena getArenaWithPet(Entity wolf) { return plugin.getAM().getArenaWithPet(wolf); }
public Arena getArenaWithMonster(Entity monster) { return plugin.getAM().getArenaWithMonster(monster); }
public Arena getArenaInLocation(Location l) { return plugin.getAM().getArenaInLocation(l); }
// Player lists
public List<Player> getAllPlayers() { return new LinkedList<Player>(plugin.getAM().arenaMap.keySet()); }
public List<Player> getAllPlayers(Arena arena) { return arena.getAllPlayers(); }
public List<Player> getAllPlayers(String arenaName) { return getAllPlayers(plugin.getAM().getArenaWithName(arenaName)); }
public List<Player> getLivingPlayers()
{
List<Player> result = new LinkedList<Player>();
for (Arena arena : plugin.getAM().arenas)
result.addAll(arena.getLivingPlayers());
return result;
}
public List<Player> getLivingPlayers(String arenaName)
{
Arena arena = plugin.getAM().getArenaWithName(arenaName);
if (arena == null)
throw new NullPointerException("Arena with name '" + arenaName + "' does not exist!");
return new LinkedList<Player>(arena.livePlayers);
}
public List<Player> getAllPlayers() { return plugin.getAM().getAllPlayers(); }
public List<Player> getAllLivingPlayers() { return plugin.getAM().getAllLivingPlayers(); }
public List<Player> getAllPlayersInArena(String arenaName) { return plugin.getAM().getAllPlayersInArena(arenaName); }
public List<Player> getLivingPlayersInArena(String arenaName) { return plugin.getAM().getLivingPlayersInArena(arenaName); }
// Warp locations.
public Location getArenaLocation(String arenaName)