Fixed some wolf issues
This commit is contained in:
Binary file not shown.
@@ -62,9 +62,9 @@ public class Arena
|
|||||||
// Setup fields
|
// Setup fields
|
||||||
protected String name;
|
protected String name;
|
||||||
protected World world;
|
protected World world;
|
||||||
protected boolean enabled, running, setup, protect, autoEquip, forceRestore, softRestore, softRestoreDrops, emptyInvJoin, emptyInvSpec, pvp, monsterInfight, allowWarp;
|
protected boolean enabled, running, setup, lobbySetup, protect, autoEquip, forceRestore, softRestore, softRestoreDrops, emptyInvJoin, emptyInvSpec, pvp, monsterInfight, allowWarp;
|
||||||
protected boolean edit, waveClear, detCreepers, detDamage, lightning, hellhounds;
|
protected boolean edit, waveClear, detCreepers, detDamage, lightning, hellhounds;
|
||||||
protected Location p1, p2, arenaLoc, lobbyLoc, spectatorLoc;
|
protected Location p1, p2, l1, l2, arenaLoc, lobbyLoc, spectatorLoc;
|
||||||
protected Map<String,Location> spawnpoints;
|
protected Map<String,Location> spawnpoints;
|
||||||
|
|
||||||
// Wave/reward fields
|
// Wave/reward fields
|
||||||
@@ -127,8 +127,6 @@ public class Arena
|
|||||||
public Arena(String name, World world, ArenaMaster am)
|
public Arena(String name, World world, ArenaMaster am)
|
||||||
{
|
{
|
||||||
this(name, world);
|
this(name, world);
|
||||||
//classItems = am.classItems;
|
|
||||||
//classArmor = am.classArmor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startArena()
|
public void startArena()
|
||||||
@@ -238,7 +236,10 @@ public class Arena
|
|||||||
|
|
||||||
// Force leave.
|
// Force leave.
|
||||||
for (Player p : tmp)
|
for (Player p : tmp)
|
||||||
|
{
|
||||||
|
plugin.getAM().arenaMap.remove(p);
|
||||||
playerLeave(p);
|
playerLeave(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -321,6 +322,8 @@ public class Arena
|
|||||||
deadPlayers.remove(p);
|
deadPlayers.remove(p);
|
||||||
specPlayers.remove(p);
|
specPlayers.remove(p);
|
||||||
removePets(p);
|
removePets(p);
|
||||||
|
|
||||||
|
if (!emptyInvJoin) MAUtils.restoreInventory(p);
|
||||||
|
|
||||||
if (running && livePlayers.isEmpty())
|
if (running && livePlayers.isEmpty())
|
||||||
endArena();
|
endArena();
|
||||||
@@ -492,6 +495,8 @@ public class Arena
|
|||||||
|
|
||||||
p1 = MAUtils.getArenaCoord(config, world, configName, "p1");
|
p1 = MAUtils.getArenaCoord(config, world, configName, "p1");
|
||||||
p2 = MAUtils.getArenaCoord(config, world, configName, "p2");
|
p2 = MAUtils.getArenaCoord(config, world, configName, "p2");
|
||||||
|
l1 = MAUtils.getArenaCoord(config, world, configName, "l1");
|
||||||
|
l2 = MAUtils.getArenaCoord(config, world, configName, "l2");
|
||||||
arenaLoc = MAUtils.getArenaCoord(config, world, configName, "arena");
|
arenaLoc = MAUtils.getArenaCoord(config, world, configName, "arena");
|
||||||
lobbyLoc = MAUtils.getArenaCoord(config, world, configName, "lobby");
|
lobbyLoc = MAUtils.getArenaCoord(config, world, configName, "lobby");
|
||||||
spectatorLoc = MAUtils.getArenaCoord(config, world, configName, "spectator");
|
spectatorLoc = MAUtils.getArenaCoord(config, world, configName, "spectator");
|
||||||
@@ -503,17 +508,20 @@ public class Arena
|
|||||||
|
|
||||||
// Determine if the arena is properly set up. Then add the to arena list.
|
// Determine if the arena is properly set up. Then add the to arena list.
|
||||||
setup = MAUtils.verifyData(this);
|
setup = MAUtils.verifyData(this);
|
||||||
|
lobbySetup = MAUtils.verifyLobby(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serializeConfig()
|
public void serializeConfig()
|
||||||
{
|
{
|
||||||
String coords = "arenas." + configName() + ".coords.";
|
String coords = "arenas." + configName() + ".coords.";
|
||||||
Configuration config = plugin.getConfig();
|
Configuration config = plugin.getConfig();
|
||||||
|
|
||||||
config.setProperty("arenas." + configName() + ".settings.enabled", enabled);
|
config.setProperty("arenas." + configName() + ".settings.enabled", enabled);
|
||||||
config.setProperty("arenas." + configName() + ".settings.protect", protect);
|
config.setProperty("arenas." + configName() + ".settings.protect", protect);
|
||||||
if (p1 != null) config.setProperty(coords + "p1", MAUtils.makeCoord(p1));
|
if (p1 != null) config.setProperty(coords + "p1", MAUtils.makeCoord(p1));
|
||||||
if (p2 != null) config.setProperty(coords + "p2", MAUtils.makeCoord(p2));
|
if (p2 != null) config.setProperty(coords + "p2", MAUtils.makeCoord(p2));
|
||||||
|
if (l1 != null) config.setProperty(coords + "l1", MAUtils.makeCoord(l1));
|
||||||
|
if (l2 != null) config.setProperty(coords + "l2", MAUtils.makeCoord(l2));
|
||||||
if (arenaLoc != null) config.setProperty(coords + "arena", MAUtils.makeCoord(arenaLoc));
|
if (arenaLoc != null) config.setProperty(coords + "arena", MAUtils.makeCoord(arenaLoc));
|
||||||
if (lobbyLoc != null) config.setProperty(coords + "lobby", MAUtils.makeCoord(lobbyLoc));
|
if (lobbyLoc != null) config.setProperty(coords + "lobby", MAUtils.makeCoord(lobbyLoc));
|
||||||
if (spectatorLoc != null) config.setProperty(coords + "spectator", MAUtils.makeCoord(spectatorLoc));
|
if (spectatorLoc != null) config.setProperty(coords + "spectator", MAUtils.makeCoord(spectatorLoc));
|
||||||
@@ -612,16 +620,26 @@ public class Arena
|
|||||||
*/
|
*/
|
||||||
public boolean inRegion(Location loc)
|
public boolean inRegion(Location loc)
|
||||||
{
|
{
|
||||||
if (!loc.getWorld().getName().equals(world.getName()))
|
if (!loc.getWorld().getName().equals(world.getName()) || !setup)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!setup)
|
int x = loc.getBlockX();
|
||||||
return false;
|
int y = loc.getBlockY();
|
||||||
|
int z = loc.getBlockZ();
|
||||||
|
|
||||||
|
// Check the lobby first.
|
||||||
|
if (lobbySetup)
|
||||||
|
{
|
||||||
|
if ((x >= l1.getBlockX() && x <= l2.getBlockX()) &&
|
||||||
|
(z >= l1.getBlockZ() && z <= l2.getBlockZ()) &&
|
||||||
|
(y >= l1.getBlockY() && y <= l2.getBlockY()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns false if the location is outside of the region.
|
// Returns false if the location is outside of the region.
|
||||||
return ((loc.getX() >= p1.getX() && loc.getX() <= p2.getX()) &&
|
return ((x >= p1.getBlockX() && x <= p2.getBlockX()) &&
|
||||||
(loc.getZ() >= p1.getZ() && loc.getZ() <= p2.getZ()) &&
|
(z >= p1.getBlockZ() && z <= p2.getBlockZ()) &&
|
||||||
(loc.getY() >= p1.getY() && loc.getY() <= p2.getY()));
|
(y >= p1.getBlockY() && y <= p2.getBlockY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -633,9 +651,22 @@ public class Arena
|
|||||||
if (!loc.getWorld().getName().equals(world.getName()) || !setup)
|
if (!loc.getWorld().getName().equals(world.getName()) || !setup)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ((loc.getX() + radius >= p1.getX() && loc.getX() - radius <= p2.getX()) &&
|
int x = loc.getBlockX();
|
||||||
(loc.getZ() + radius >= p1.getZ() && loc.getZ() - radius <= p2.getZ()) &&
|
int y = loc.getBlockY();
|
||||||
(loc.getY() + radius >= p1.getY() && loc.getY() - radius <= p2.getY()));
|
int z = loc.getBlockZ();
|
||||||
|
|
||||||
|
// Check the lobby first.
|
||||||
|
if (lobbySetup)
|
||||||
|
{
|
||||||
|
if ((x + radius >= l1.getBlockX() && x - radius <= l2.getBlockX()) &&
|
||||||
|
(z + radius >= l1.getBlockZ() && z - radius <= l2.getBlockZ()) &&
|
||||||
|
(y + radius >= l1.getBlockY() && y - radius <= l2.getBlockY()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((x + radius >= p1.getBlockX() && x - radius <= p2.getBlockX()) &&
|
||||||
|
(z + radius >= p1.getBlockZ() && z - radius <= p2.getBlockZ()) &&
|
||||||
|
(y + radius >= p1.getBlockY() && y - radius <= p2.getBlockY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -649,14 +680,14 @@ public class Arena
|
|||||||
// Block Listener
|
// Block Listener
|
||||||
public void onBlockBreak(BlockBreakEvent event)
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (edit || !inRegion(event.getBlock().getLocation()))
|
if (!inRegion(event.getBlock().getLocation()) || edit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
if (blocks.remove(b) || b.getType() == Material.TNT)
|
if (blocks.remove(b) || b.getType() == Material.TNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (softRestore)
|
if (softRestore && running)
|
||||||
{
|
{
|
||||||
int[] buffer = new int[5];
|
int[] buffer = new int[5];
|
||||||
buffer[0] = b.getX();
|
buffer[0] = b.getX();
|
||||||
@@ -674,8 +705,7 @@ public class Arena
|
|||||||
|
|
||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
// If in edit mode or the event didn't happen in this region, return.
|
if (!inRegion(event.getBlock().getLocation()) || edit)
|
||||||
if (edit || !inRegion(event.getBlock().getLocation()))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
@@ -708,17 +738,30 @@ public class Arena
|
|||||||
if (!monsters.contains(event.getEntity()) && !inRegionRadius(event.getLocation(), 10))
|
if (!monsters.contains(event.getEntity()) && !inRegionRadius(event.getLocation(), 10))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
event.setYield(0);
|
||||||
|
monsters.remove(event.getEntity());
|
||||||
|
|
||||||
// If the arena isn't running
|
// If the arena isn't running
|
||||||
if (!running || repairDelay == 0)
|
if (!running || repairDelay == 0)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is a sign in the blocklist, cancel
|
||||||
|
for (Block b : event.blockList())
|
||||||
|
{
|
||||||
|
if (!(b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Uncancel, just in case.
|
// Uncancel, just in case.
|
||||||
event.setCancelled(false);
|
event.setCancelled(false);
|
||||||
event.setYield(0);
|
|
||||||
monsters.remove(event.getEntity());
|
|
||||||
|
|
||||||
int[] buffer;
|
int[] buffer;
|
||||||
final HashMap<Block,Integer> blockMap = new HashMap<Block,Integer>();
|
final HashMap<Block,Integer> blockMap = new HashMap<Block,Integer>();
|
||||||
@@ -784,7 +827,7 @@ public class Arena
|
|||||||
if (!running) return;
|
if (!running) return;
|
||||||
|
|
||||||
if (pets.contains(event.getEntity()))
|
if (pets.contains(event.getEntity()))
|
||||||
{
|
{
|
||||||
if (event.getReason() != TargetReason.TARGET_ATTACKED_OWNER && event.getReason() != TargetReason.OWNER_ATTACKED_TARGET)
|
if (event.getReason() != TargetReason.TARGET_ATTACKED_OWNER && event.getReason() != TargetReason.OWNER_ATTACKED_TARGET)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -870,6 +913,8 @@ public class Arena
|
|||||||
damagee.setFireTicks(32768); // For mcMMO
|
damagee.setFireTicks(32768); // For mcMMO
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
if (e != null && damager instanceof Player)
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
event.setDamage(0);
|
event.setDamage(0);
|
||||||
return;
|
return;
|
||||||
@@ -919,7 +964,7 @@ public class Arena
|
|||||||
if (running) return;
|
if (running) return;
|
||||||
|
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if (!inRegion(p.getLocation()) || !livePlayers.contains(p))
|
if (!livePlayers.contains(p))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MAUtils.tellPlayer(p, MAMessages.get(Msg.LOBBY_DROP_ITEM));
|
MAUtils.tellPlayer(p, MAMessages.get(Msg.LOBBY_DROP_ITEM));
|
||||||
@@ -1156,7 +1201,10 @@ public class Arena
|
|||||||
|
|
||||||
// Compare the current size with the previous size.
|
// Compare the current size with the previous size.
|
||||||
if (monsters.size() < spawnThread.previousSize || spawnThread.previousSize == 0)
|
if (monsters.size() < spawnThread.previousSize || spawnThread.previousSize == 0)
|
||||||
|
{
|
||||||
|
resetIdleTimer();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Clear all player inventories, and "kill" all players.
|
// Clear all player inventories, and "kill" all players.
|
||||||
for (Player p : livePlayers)
|
for (Player p : livePlayers)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ArenaMaster
|
|||||||
private MobArena plugin;
|
private MobArena plugin;
|
||||||
private Configuration config;
|
private Configuration config;
|
||||||
protected Arena selectedArena;
|
protected Arena selectedArena;
|
||||||
protected Lobby masterLobby;
|
//protected Lobby masterLobby;
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
protected boolean enabled, updateNotify, autoEquip, emptyInvs, hellhounds;
|
protected boolean enabled, updateNotify, autoEquip, emptyInvs, hellhounds;
|
||||||
|
|||||||
@@ -20,38 +20,40 @@ public class MACommands implements CommandExecutor
|
|||||||
public static final List<String> COMMANDS = new LinkedList<String>();
|
public static final List<String> COMMANDS = new LinkedList<String>();
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
COMMANDS.add("j"); // Join
|
COMMANDS.add("j"); // Join
|
||||||
COMMANDS.add("join"); // Join
|
COMMANDS.add("join"); // Join
|
||||||
COMMANDS.add("l"); // Leave
|
COMMANDS.add("l"); // Leave
|
||||||
COMMANDS.add("leave"); // Leave
|
COMMANDS.add("leave"); // Leave
|
||||||
COMMANDS.add("notready"); // List of players who aren't ready
|
COMMANDS.add("notready"); // List of players who aren't ready
|
||||||
COMMANDS.add("spec"); // Watch arena
|
COMMANDS.add("spec"); // Watch arena
|
||||||
COMMANDS.add("spectate"); // Watch arena
|
COMMANDS.add("spectate"); // Watch arena
|
||||||
COMMANDS.add("arenas"); // List of arenas
|
COMMANDS.add("arenas"); // List of arenas
|
||||||
COMMANDS.add("list"); // List of players
|
COMMANDS.add("list"); // List of players
|
||||||
COMMANDS.add("players"); // List of players
|
COMMANDS.add("players"); // List of players
|
||||||
COMMANDS.add("restore"); // Restore inventory
|
COMMANDS.add("restore"); // Restore inventory
|
||||||
COMMANDS.add("enable"); // Enabling
|
COMMANDS.add("enable"); // Enabling
|
||||||
COMMANDS.add("disable"); // Disabling
|
COMMANDS.add("disable"); // Disabling
|
||||||
COMMANDS.add("protect"); // Protection on/off
|
COMMANDS.add("protect"); // Protection on/off
|
||||||
COMMANDS.add("force"); // Force start/end
|
COMMANDS.add("force"); // Force start/end
|
||||||
COMMANDS.add("config"); // Reload config
|
COMMANDS.add("config"); // Reload config
|
||||||
COMMANDS.add("arena"); // Current arena
|
COMMANDS.add("arena"); // Current arena
|
||||||
COMMANDS.add("setarena"); // Set current arena
|
COMMANDS.add("setarena"); // Set current arena
|
||||||
COMMANDS.add("addarena"); // Add a new arena
|
COMMANDS.add("addarena"); // Add a new arena
|
||||||
COMMANDS.add("delarena"); // Delete current aren
|
COMMANDS.add("delarena"); // Delete current aren
|
||||||
COMMANDS.add("editarena"); // Editing
|
COMMANDS.add("editarena"); // Editing
|
||||||
COMMANDS.add("setregion"); // Set a region point
|
COMMANDS.add("setregion"); // Set a region point
|
||||||
COMMANDS.add("setwarp"); // Set arena/lobby/spec
|
COMMANDS.add("expandregion"); // Expand the region
|
||||||
COMMANDS.add("spawnpoints"); // List spawnpoints
|
COMMANDS.add("setlobbyregion"); // Set a region point
|
||||||
COMMANDS.add("addspawn"); // Add a spawnpoint
|
COMMANDS.add("expandlobbyregion"); // Expand the region
|
||||||
COMMANDS.add("delspawn"); // Delete a spawnpoint
|
COMMANDS.add("setwarp"); // Set arena/lobby/spec
|
||||||
COMMANDS.add("expandregion"); // Expand the region
|
COMMANDS.add("spawnpoints"); // List spawnpoints
|
||||||
COMMANDS.add("reset"); // Reset arena coordinates
|
COMMANDS.add("addspawn"); // Add a spawnpoint
|
||||||
COMMANDS.add("auto-generate"); // Auto-generate arena
|
COMMANDS.add("delspawn"); // Delete a spawnpoint
|
||||||
COMMANDS.add("auto-degenerate"); // Restore cuboid
|
COMMANDS.add("reset"); // Reset arena coordinates
|
||||||
|
COMMANDS.add("auto-generate"); // Auto-generate arena
|
||||||
|
COMMANDS.add("auto-degenerate"); // Restore cuboid
|
||||||
}
|
}
|
||||||
private boolean player, op, console, meanAdmins;
|
private boolean meanAdmins;
|
||||||
private Server server;
|
private Server server;
|
||||||
private MobArena plugin;
|
private MobArena plugin;
|
||||||
private ArenaMaster am;
|
private ArenaMaster am;
|
||||||
@@ -80,9 +82,9 @@ public class MACommands implements CommandExecutor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine if the sender is a player (and an op), or the console.
|
// Determine if the sender is a player (and an op), or the console.
|
||||||
player = (sender instanceof Player);
|
boolean player = (sender instanceof Player);
|
||||||
op = player && ((Player) sender).isOp();
|
boolean op = player && ((Player) sender).isOp();
|
||||||
console = (sender instanceof ConsoleCommandSender);
|
boolean console = (sender instanceof ConsoleCommandSender);
|
||||||
|
|
||||||
// Cast the sender to Player if possible.
|
// Cast the sender to Player if possible.
|
||||||
Player p = (player) ? (Player)sender : null;
|
Player p = (player) ? (Player)sender : null;
|
||||||
@@ -306,14 +308,14 @@ public class MACommands implements CommandExecutor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String list = MAUtils.listToString(arena.getLivingPlayers());
|
String list = MAUtils.playerListToString(arena.getLivingPlayers());
|
||||||
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_LIST_PLAYERS, list));
|
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_LIST_PLAYERS, list));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StringBuffer buffy = new StringBuffer();
|
StringBuffer buffy = new StringBuffer();
|
||||||
for (Arena arena : am.arenas)
|
for (Arena arena : am.arenas)
|
||||||
buffy.append(MAUtils.listToString(arena.getLivingPlayers(), false));
|
buffy.append(MAUtils.playerListToString(arena.getLivingPlayers()));
|
||||||
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_LIST_PLAYERS, buffy.toString()));
|
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_LIST_PLAYERS, buffy.toString()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -349,7 +351,7 @@ public class MACommands implements CommandExecutor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String list = MAUtils.listToString(arena.getNonreadyPlayers());
|
String list = MAUtils.playerListToString(arena.getNonreadyPlayers());
|
||||||
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_LIST_PLAYERS, list));
|
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_LIST_PLAYERS, list));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -454,7 +456,7 @@ public class MACommands implements CommandExecutor
|
|||||||
/*
|
/*
|
||||||
* Force start/end arenas.
|
* Force start/end arenas.
|
||||||
*/
|
*/
|
||||||
if (base.equals("force") && arg1.equals("end"))
|
if (base.equals("force"))
|
||||||
{
|
{
|
||||||
if (arg1.equals("end"))
|
if (arg1.equals("end"))
|
||||||
{
|
{
|
||||||
@@ -737,6 +739,11 @@ public class MACommands implements CommandExecutor
|
|||||||
MAUtils.tellPlayer(sender, "Usage: /ma expandregion <amount> [up|down|out]");
|
MAUtils.tellPlayer(sender, "Usage: /ma expandregion <amount> [up|down|out]");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (am.selectedArena.p1 == null || am.selectedArena.p2 == null)
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(sender, "You must first define p1 and p2");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg2.equals("up"))
|
if (arg2.equals("up"))
|
||||||
{
|
{
|
||||||
@@ -765,6 +772,70 @@ public class MACommands implements CommandExecutor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (base.equals("setlobbyregion"))
|
||||||
|
{
|
||||||
|
if (!(player && MobArena.has(p, "mobarena.setup.setlobbyregion")) && !op)
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_NO_ACCESS));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(arg1.equals("l1") || arg1.equals("l2")))
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(sender, "Usage: /ma setlobbyregion [l1|l2]");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
MAUtils.setArenaCoord(plugin.getConfig(), am.selectedArena, arg1, p.getLocation());
|
||||||
|
MAUtils.tellPlayer(sender, "Set lobby point " + arg1 + " for arena '" + am.selectedArena.configName() + "'");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (base.equals("expandlobbyregion"))
|
||||||
|
{
|
||||||
|
if (!console && !(player && MobArena.has(p, "mobarena.setup.expandlobbyregion")) && !op)
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_NO_ACCESS));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args.length != 3 || !arg1.matches("[0-9]+"))
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(sender, "Usage: /ma expandlobbyregion <amount> [up|down|out]");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (am.selectedArena.l1 == null || am.selectedArena.l2 == null)
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(sender, "You must first define l1 and l2");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg2.equals("up"))
|
||||||
|
{
|
||||||
|
am.selectedArena.l2.setY(Math.min(127, am.selectedArena.l2.getY() + Integer.parseInt(arg1)));
|
||||||
|
}
|
||||||
|
else if (arg2.equals("down"))
|
||||||
|
{
|
||||||
|
am.selectedArena.l1.setY(Math.max(0, am.selectedArena.l1.getY() - Integer.parseInt(arg1)));
|
||||||
|
}
|
||||||
|
else if (arg2.equals("out"))
|
||||||
|
{
|
||||||
|
am.selectedArena.l1.setX(am.selectedArena.l1.getX() - Integer.parseInt(arg1));
|
||||||
|
am.selectedArena.l1.setZ(am.selectedArena.l1.getZ() - Integer.parseInt(arg1));
|
||||||
|
am.selectedArena.l2.setX(am.selectedArena.l2.getX() + Integer.parseInt(arg1));
|
||||||
|
am.selectedArena.l2.setZ(am.selectedArena.l2.getZ() + Integer.parseInt(arg1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(sender, "Usage: /ma expandlobbyregion <amount> [up|down|out]");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
MAUtils.tellPlayer(sender, "Lobby region for '" + am.selectedArena.configName() + "' expanded " + arg2 + " by " + arg1 + " blocks.");
|
||||||
|
am.selectedArena.serializeConfig();
|
||||||
|
am.selectedArena.load(plugin.getConfig());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set warp points [arena|lobby|spectator] for the current arena.
|
* Set warp points [arena|lobby|spectator] for the current arena.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -261,11 +261,11 @@ public class MAUtils
|
|||||||
{
|
{
|
||||||
config.setProperty(arenaPath + ".powered-creepers", 10);
|
config.setProperty(arenaPath + ".powered-creepers", 10);
|
||||||
config.setProperty(arenaPath + ".zombie-pigmen", 10);
|
config.setProperty(arenaPath + ".zombie-pigmen", 10);
|
||||||
config.setProperty(arenaPath + ".slimes", 10);
|
config.setProperty(arenaPath + ".slimes", 10);
|
||||||
config.setProperty(arenaPath + ".humans", 10);
|
config.setProperty(arenaPath + ".humans", 10);
|
||||||
config.setProperty(arenaPath + ".angry-wolves", 10);
|
config.setProperty(arenaPath + ".angry-wolves", 10);
|
||||||
config.setProperty(arenaPath + ".giants", 0);
|
config.setProperty(arenaPath + ".giants", 0);
|
||||||
config.setProperty(arenaPath + ".ghasts", 0);
|
config.setProperty(arenaPath + ".ghasts", 0);
|
||||||
}
|
}
|
||||||
//config.save();
|
//config.save();
|
||||||
dists = config.getKeys(arenaPath);
|
dists = config.getKeys(arenaPath);
|
||||||
@@ -561,14 +561,20 @@ public class MAUtils
|
|||||||
*/
|
*/
|
||||||
public static void sitPets(Player p)
|
public static void sitPets(Player p)
|
||||||
{
|
{
|
||||||
|
if (p == null)
|
||||||
|
{
|
||||||
|
System.out.println("Player is null!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
List<Entity> entities = p.getNearbyEntities(80, 40, 80);
|
List<Entity> entities = p.getNearbyEntities(80, 40, 80);
|
||||||
for (Entity e : entities)
|
for (Entity e : entities)
|
||||||
{
|
{
|
||||||
if (!(e instanceof Wolf))
|
if (!(e instanceof Wolf))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Wolf w = (Wolf) e;
|
Wolf w = (Wolf) e;
|
||||||
if (w.getOwner().equals(p))
|
if (w.isTamed() && w.getOwner() != null && w.getOwner().equals(p))
|
||||||
w.setSitting(true);
|
w.setSitting(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -616,6 +622,8 @@ public class MAUtils
|
|||||||
|
|
||||||
if (coord.equals("p1") || coord.equals("p2"))
|
if (coord.equals("p1") || coord.equals("p2"))
|
||||||
fixRegion(config, loc.getWorld(), arena);
|
fixRegion(config, loc.getWorld(), arena);
|
||||||
|
if (coord.equals("l1") || coord.equals("l2"))
|
||||||
|
fixLobby(config, loc.getWorld(), arena);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean delArenaCoord(Configuration config, Arena arena, String coord)
|
public static boolean delArenaCoord(Configuration config, Arena arena, String coord)
|
||||||
@@ -658,6 +666,35 @@ public class MAUtils
|
|||||||
arena.load(config);
|
arena.load(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void fixLobby(Configuration config, World world, Arena arena)
|
||||||
|
{
|
||||||
|
if (arena.l1 == null || arena.l2 == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (arena.l1.getX() > arena.l2.getX())
|
||||||
|
{
|
||||||
|
double tmp = arena.l1.getX();
|
||||||
|
arena.l1.setX(arena.l2.getX());
|
||||||
|
arena.l2.setX(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arena.l1.getZ() > arena.l2.getZ())
|
||||||
|
{
|
||||||
|
double tmp = arena.l1.getZ();
|
||||||
|
arena.l1.setZ(arena.l2.getZ());
|
||||||
|
arena.l2.setZ(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arena.l1.getY() > arena.l2.getY())
|
||||||
|
{
|
||||||
|
double tmp = arena.l1.getY();
|
||||||
|
arena.l1.setY(arena.l2.getY());
|
||||||
|
arena.l2.setY(tmp);
|
||||||
|
}
|
||||||
|
arena.serializeConfig();
|
||||||
|
arena.load(config);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Location from the input String in the input World.
|
* Create a Location from the input String in the input World.
|
||||||
*/
|
*/
|
||||||
@@ -665,14 +702,14 @@ public class MAUtils
|
|||||||
{
|
{
|
||||||
String[] parts = str.split(",");
|
String[] parts = str.split(",");
|
||||||
|
|
||||||
double x = Double.parseDouble(parts[0]);
|
double x = Double.parseDouble(parts[0].trim());
|
||||||
double y = Double.parseDouble(parts[1]);
|
double y = Double.parseDouble(parts[1].trim());
|
||||||
double z = Double.parseDouble(parts[2]);
|
double z = Double.parseDouble(parts[2].trim());
|
||||||
|
|
||||||
if (extras && parts.length == 5)
|
if (extras && parts.length == 5)
|
||||||
{
|
{
|
||||||
float yaw = Float.parseFloat(parts[3]);
|
float yaw = Float.parseFloat(parts[3].trim());
|
||||||
float pitch = Float.parseFloat(parts[4]);
|
float pitch = Float.parseFloat(parts[4].trim());
|
||||||
return new Location(world, x, y, z, yaw, pitch);
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,6 +887,20 @@ public class MAUtils
|
|||||||
return buffy.toString();
|
return buffy.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String playerListToString(List<Player> list)
|
||||||
|
{
|
||||||
|
if (list.isEmpty())
|
||||||
|
return MAMessages.get(Msg.MISC_NONE);
|
||||||
|
|
||||||
|
StringBuffer buffy = new StringBuffer();
|
||||||
|
for (Player p : list)
|
||||||
|
{
|
||||||
|
buffy.append(p.getName());
|
||||||
|
buffy.append(" ");
|
||||||
|
}
|
||||||
|
return buffy.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a String-list version of a comma-separated list.
|
* Returns a String-list version of a comma-separated list.
|
||||||
*/
|
*/
|
||||||
@@ -891,6 +942,12 @@ public class MAUtils
|
|||||||
(arena.p2 != null) &&
|
(arena.p2 != null) &&
|
||||||
(arena.spawnpoints.size() > 0));
|
(arena.spawnpoints.size() > 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean verifyLobby(Arena arena)
|
||||||
|
{
|
||||||
|
return ((arena.l1 != null) &&
|
||||||
|
(arena.l2 != null));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if there is a new update of MobArena and notifies the
|
* Checks if there is a new update of MobArena and notifies the
|
||||||
|
|||||||
Reference in New Issue
Block a user