mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-10 01:21:38 +01:00
v0.93.4 - The infamous warp bug fixed, couple of other fixes, and min-/max-players added
This commit is contained in:
parent
27d8acb262
commit
94b1734f6a
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: MobArena
|
name: MobArena
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.93.3
|
version: 0.93.4
|
||||||
softdepend: [MultiVerse,XcraftGate,Towny]
|
softdepend: [MultiVerse,XcraftGate,Towny]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
@ -71,9 +71,10 @@ public class Arena
|
|||||||
protected boolean allowMonsters, allowAnimals;
|
protected boolean allowMonsters, allowAnimals;
|
||||||
|
|
||||||
// Other settings
|
// Other settings
|
||||||
protected int repairDelay, playerLimit, joinDistance;
|
protected int repairDelay, minPlayers, maxPlayers, joinDistance;
|
||||||
protected List<String> classes = new LinkedList<String>();
|
protected List<String> classes = new LinkedList<String>();
|
||||||
protected Map<Player,Location> locations = new HashMap<Player,Location>();
|
protected Map<Player,Location> locations = new HashMap<Player,Location>();
|
||||||
|
protected Map<Player,Integer> healthMap = new HashMap<Player,Integer>();
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
protected ArenaLog log;
|
protected ArenaLog log;
|
||||||
@ -224,9 +225,12 @@ public class Arena
|
|||||||
|
|
||||||
public void forceStart()
|
public void forceStart()
|
||||||
{
|
{
|
||||||
|
if (running)
|
||||||
|
return;
|
||||||
|
|
||||||
// Set operations.
|
// Set operations.
|
||||||
Set<Player> tmp = new HashSet<Player>();
|
Set<Player> tmp = new HashSet<Player>();
|
||||||
//tmp.addAll(livePlayers);
|
tmp.addAll(lobbyPlayers);
|
||||||
tmp.removeAll(readyPlayers);
|
tmp.removeAll(readyPlayers);
|
||||||
|
|
||||||
// Force leave.
|
// Force leave.
|
||||||
@ -239,6 +243,9 @@ public class Arena
|
|||||||
|
|
||||||
public void forceEnd()
|
public void forceEnd()
|
||||||
{
|
{
|
||||||
|
if (!running)
|
||||||
|
return;
|
||||||
|
|
||||||
for (Player p : getAllPlayers())
|
for (Player p : getAllPlayers())
|
||||||
{
|
{
|
||||||
plugin.getAM().arenaMap.remove(p);
|
plugin.getAM().arenaMap.remove(p);
|
||||||
@ -262,8 +269,12 @@ public class Arena
|
|||||||
|
|
||||||
public void playerJoin(Player p, Location loc)
|
public void playerJoin(Player p, Location loc)
|
||||||
{
|
{
|
||||||
|
// Store location and health.
|
||||||
if (!locations.containsKey(p))
|
if (!locations.containsKey(p))
|
||||||
locations.put(p,loc);
|
locations.put(p,loc);
|
||||||
|
if (!healthMap.containsKey(p))
|
||||||
|
healthMap.put(p,p.getHealth());
|
||||||
|
p.setHealth(20);
|
||||||
|
|
||||||
// Update chunk.
|
// Update chunk.
|
||||||
updateChunk(lobbyLoc);
|
updateChunk(lobbyLoc);
|
||||||
@ -280,6 +291,13 @@ public class Arena
|
|||||||
public void playerReady(Player p)
|
public void playerReady(Player p)
|
||||||
{
|
{
|
||||||
readyPlayers.add(p);
|
readyPlayers.add(p);
|
||||||
|
|
||||||
|
if (minPlayers > 0 && lobbyPlayers.size() < minPlayers)
|
||||||
|
{
|
||||||
|
MAUtils.tellPlayer(p, MAMessages.get(Msg.LOBBY_NOT_ENOUGH_PLAYERS, "" + minPlayers));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
startArena();
|
startArena();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,6 +314,7 @@ public class Arena
|
|||||||
p.teleport(entry);
|
p.teleport(entry);
|
||||||
}
|
}
|
||||||
locations.remove(p);
|
locations.remove(p);
|
||||||
|
if (healthMap.containsKey(p)) p.setHealth(healthMap.remove(p));
|
||||||
|
|
||||||
// Remove from the arenaMap and all the sets.
|
// Remove from the arenaMap and all the sets.
|
||||||
plugin.getAM().arenaMap.remove(p);
|
plugin.getAM().arenaMap.remove(p);
|
||||||
@ -310,7 +329,6 @@ public class Arena
|
|||||||
// If spectate-on-death: false, pass on to playerLeave.
|
// If spectate-on-death: false, pass on to playerLeave.
|
||||||
if (!specOnDeath)
|
if (!specOnDeath)
|
||||||
{
|
{
|
||||||
p.teleport(arenaLoc);
|
|
||||||
playerLeave(p);
|
playerLeave(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -319,9 +337,9 @@ public class Arena
|
|||||||
restoreInvAndGiveRewards(p, true);
|
restoreInvAndGiveRewards(p, true);
|
||||||
|
|
||||||
// Remove player from sets, warp to spectator area, then add to specPlayers.
|
// Remove player from sets, warp to spectator area, then add to specPlayers.
|
||||||
removePlayer(p);
|
|
||||||
p.teleport(arenaLoc); // This will sometimes force players to drop any items held (not confirmed)
|
|
||||||
p.teleport(spectatorLoc);
|
p.teleport(spectatorLoc);
|
||||||
|
if (healthMap.containsKey(p)) p.setHealth(healthMap.remove(p));
|
||||||
|
removePlayer(p);
|
||||||
specPlayers.add(p);
|
specPlayers.add(p);
|
||||||
|
|
||||||
// Update the monster targets.
|
// Update the monster targets.
|
||||||
@ -341,6 +359,8 @@ public class Arena
|
|||||||
{
|
{
|
||||||
if (!locations.containsKey(p))
|
if (!locations.containsKey(p))
|
||||||
locations.put(p,loc);
|
locations.put(p,loc);
|
||||||
|
if (!healthMap.containsKey(p))
|
||||||
|
healthMap.put(p,p.getHealth());
|
||||||
|
|
||||||
MAUtils.sitPets(p);
|
MAUtils.sitPets(p);
|
||||||
specPlayers.add(p);
|
specPlayers.add(p);
|
||||||
@ -442,13 +462,9 @@ public class Arena
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
//if (clear)
|
|
||||||
// MAUtils.clearInventory(p);
|
|
||||||
|
|
||||||
if (!emptyInvJoin)
|
if (!emptyInvJoin)
|
||||||
MAUtils.restoreInventory(p);
|
MAUtils.restoreInventory(p);
|
||||||
|
|
||||||
//if (rewardedPlayers.contains(p))
|
|
||||||
if (hadRewards)
|
if (hadRewards)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -602,7 +618,8 @@ public class Arena
|
|||||||
specOnDeath = config.getBoolean(arenaPath + "spectate-on-death", true);
|
specOnDeath = config.getBoolean(arenaPath + "spectate-on-death", true);
|
||||||
shareInArena = config.getBoolean(arenaPath + "share-items-in-arena", true);
|
shareInArena = config.getBoolean(arenaPath + "share-items-in-arena", true);
|
||||||
joinDistance = config.getInt(arenaPath + "max-join-distance", 0);
|
joinDistance = config.getInt(arenaPath + "max-join-distance", 0);
|
||||||
playerLimit = config.getInt(arenaPath + "player-limit", 0);
|
minPlayers = config.getInt(arenaPath + "min-players", 0);
|
||||||
|
maxPlayers = config.getInt(arenaPath + "max-players", 0);
|
||||||
repairDelay = config.getInt(arenaPath + "repair-delay", 5);
|
repairDelay = config.getInt(arenaPath + "repair-delay", 5);
|
||||||
waveDelay = config.getInt(arenaPath + "first-wave-delay", 5) * 20;
|
waveDelay = config.getInt(arenaPath + "first-wave-delay", 5) * 20;
|
||||||
waveInterval = config.getInt(arenaPath + "wave-interval", 20) * 20;
|
waveInterval = config.getInt(arenaPath + "wave-interval", 20) * 20;
|
||||||
@ -969,6 +986,7 @@ public class Arena
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
MAUtils.giveItems(p, entryFee, false, plugin);
|
MAUtils.giveItems(p, entryFee, false, plugin);
|
||||||
|
hasPaid.remove(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,7 +158,7 @@ public class MACommands implements CommandExecutor
|
|||||||
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ALREADY_PLAYING));
|
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ALREADY_PLAYING));
|
||||||
else if (!plugin.has(p, "mobarena.arenas." + arena.configName()))
|
else if (!plugin.has(p, "mobarena.arenas." + arena.configName()))
|
||||||
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_PERMISSION));
|
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_PERMISSION));
|
||||||
else if (arena.playerLimit > 0 && arena.lobbyPlayers.size() >= arena.playerLimit)
|
else if (arena.maxPlayers > 0 && arena.lobbyPlayers.size() >= arena.maxPlayers)
|
||||||
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_PLAYER_LIMIT_REACHED));
|
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_PLAYER_LIMIT_REACHED));
|
||||||
else if (arena.joinDistance > 0 && !arena.inRegionRadius(p.getLocation(), arena.joinDistance))
|
else if (arena.joinDistance > 0 && !arena.inRegionRadius(p.getLocation(), arena.joinDistance))
|
||||||
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_TOO_FAR));
|
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_TOO_FAR));
|
||||||
@ -182,6 +182,13 @@ public class MACommands implements CommandExecutor
|
|||||||
if (p.isInsideVehicle())
|
if (p.isInsideVehicle())
|
||||||
p.leaveVehicle();
|
p.leaveVehicle();
|
||||||
|
|
||||||
|
// If player is in a bed, unbed!
|
||||||
|
if (p.isSleeping())
|
||||||
|
{
|
||||||
|
p.kickPlayer("Banned for life... Nah, just don't join from a bed ;)");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
am.arenaMap.put(p,arena);
|
am.arenaMap.put(p,arena);
|
||||||
arena.playerJoin(p, p.getLocation());
|
arena.playerJoin(p, p.getLocation());
|
||||||
|
|
||||||
|
@ -348,7 +348,6 @@ public class MAListener implements ArenaListener
|
|||||||
|
|
||||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
|
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
|
||||||
{
|
{
|
||||||
//if (!readyPlayers.contains(event.getPlayer()) && !livePlayers.contains(event.getPlayer()))
|
|
||||||
if (!arena.readyPlayers.contains(event.getPlayer()) && !arena.arenaPlayers.contains(event.getPlayer()))
|
if (!arena.readyPlayers.contains(event.getPlayer()) && !arena.arenaPlayers.contains(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -492,7 +491,6 @@ public class MAListener implements ArenaListener
|
|||||||
|
|
||||||
if (arena.running && arena.inRegion(to))
|
if (arena.running && arena.inRegion(to))
|
||||||
{
|
{
|
||||||
//MAUtils.tellPlayer(p, MAMessages.get(Msg.WARP_TO_ARENA));
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -502,7 +500,6 @@ public class MAListener implements ArenaListener
|
|||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
//if (!livePlayers.contains(p))
|
|
||||||
if (!arena.arenaPlayers.contains(p) && !arena.lobbyPlayers.contains(p))
|
if (!arena.arenaPlayers.contains(p) && !arena.lobbyPlayers.contains(p))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ public class MAMessages
|
|||||||
LOBBY_CLASS_PICKED,
|
LOBBY_CLASS_PICKED,
|
||||||
LOBBY_CLASS_RANDOM,
|
LOBBY_CLASS_RANDOM,
|
||||||
LOBBY_CLASS_PERMISSION,
|
LOBBY_CLASS_PERMISSION,
|
||||||
|
LOBBY_NOT_ENOUGH_PLAYERS,
|
||||||
LOBBY_PLAYER_READY,
|
LOBBY_PLAYER_READY,
|
||||||
LOBBY_DROP_ITEM,
|
LOBBY_DROP_ITEM,
|
||||||
LOBBY_PICK_CLASS,
|
LOBBY_PICK_CLASS,
|
||||||
@ -108,6 +109,7 @@ public class MAMessages
|
|||||||
defaults.put(Msg.LOBBY_DROP_ITEM, "No sharing allowed at this time!");
|
defaults.put(Msg.LOBBY_DROP_ITEM, "No sharing allowed at this time!");
|
||||||
defaults.put(Msg.LOBBY_PLAYER_READY, "You have been flagged as ready!");
|
defaults.put(Msg.LOBBY_PLAYER_READY, "You have been flagged as ready!");
|
||||||
defaults.put(Msg.LOBBY_PICK_CLASS, "You must first pick a class!");
|
defaults.put(Msg.LOBBY_PICK_CLASS, "You must first pick a class!");
|
||||||
|
defaults.put(Msg.LOBBY_NOT_ENOUGH_PLAYERS, "Not enough players to start. Need at least % players.");
|
||||||
defaults.put(Msg.LOBBY_RIGHT_CLICK, "Punch the sign. Don't right-click.");
|
defaults.put(Msg.LOBBY_RIGHT_CLICK, "Punch the sign. Don't right-click.");
|
||||||
defaults.put(Msg.LOBBY_CLASS_PICKED, "You have chosen % as your class!");
|
defaults.put(Msg.LOBBY_CLASS_PICKED, "You have chosen % as your class!");
|
||||||
defaults.put(Msg.LOBBY_CLASS_RANDOM, "You will get a random class on arena start.");
|
defaults.put(Msg.LOBBY_CLASS_RANDOM, "You will get a random class on arena start.");
|
||||||
|
@ -51,7 +51,6 @@ public class MASpawnThread implements Runnable
|
|||||||
|
|
||||||
taskId = -32768;
|
taskId = -32768;
|
||||||
|
|
||||||
//noOfPlayers = arena.livePlayers.size();
|
|
||||||
noOfPlayers = arena.arenaPlayers.size();
|
noOfPlayers = arena.arenaPlayers.size();
|
||||||
wave = 1;
|
wave = 1;
|
||||||
random = new Random();
|
random = new Random();
|
||||||
@ -63,6 +62,7 @@ public class MASpawnThread implements Runnable
|
|||||||
dSpiders = dSkeletons + arena.distDefault.get("spiders");
|
dSpiders = dSkeletons + arena.distDefault.get("spiders");
|
||||||
dCreepers = dSpiders + arena.distDefault.get("creepers");
|
dCreepers = dSpiders + arena.distDefault.get("creepers");
|
||||||
dWolves = dCreepers + arena.distDefault.get("wolves");
|
dWolves = dCreepers + arena.distDefault.get("wolves");
|
||||||
|
if (dWolves < 1) { dZombies = 1; dSkeletons = 2; dSpiders = 3; dCreepers = 4; dWolves = 5; }
|
||||||
|
|
||||||
dPoweredCreepers = arena.distSpecial.get("powered-creepers");
|
dPoweredCreepers = arena.distSpecial.get("powered-creepers");
|
||||||
dPigZombies = dPoweredCreepers + arena.distSpecial.get("zombie-pigmen");
|
dPigZombies = dPoweredCreepers + arena.distSpecial.get("zombie-pigmen");
|
||||||
@ -71,6 +71,7 @@ public class MASpawnThread implements Runnable
|
|||||||
dAngryWolves = dMonsters + arena.distSpecial.get("angry-wolves");
|
dAngryWolves = dMonsters + arena.distSpecial.get("angry-wolves");
|
||||||
dGiants = dAngryWolves + arena.distSpecial.get("giants");
|
dGiants = dAngryWolves + arena.distSpecial.get("giants");
|
||||||
dGhasts = dGiants + arena.distSpecial.get("ghasts");
|
dGhasts = dGiants + arena.distSpecial.get("ghasts");
|
||||||
|
if (dGhasts < 1) { dPoweredCreepers = 1; dPigZombies = 2; dSlimes = 3; dMonsters = 4; dAngryWolves = 5; dGiants = 5; dGhasts = 5; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
@ -130,7 +131,6 @@ public class MASpawnThread implements Runnable
|
|||||||
*/
|
*/
|
||||||
private void addReward(List<ItemStack> rewards)
|
private void addReward(List<ItemStack> rewards)
|
||||||
{
|
{
|
||||||
//for (Player p : arena.livePlayers)
|
|
||||||
for (Player p : arena.arenaPlayers)
|
for (Player p : arena.arenaPlayers)
|
||||||
{
|
{
|
||||||
if (arena.rewardMap.get(p) == null)
|
if (arena.rewardMap.get(p) == null)
|
||||||
|
Loading…
Reference in New Issue
Block a user