a couple of TODOs, fixed "keep-exp: false" not removing exp

This commit is contained in:
Brian 2012-05-21 22:15:11 -04:00
parent 10147532a5
commit e2901086f0
4 changed files with 17 additions and 21 deletions

View File

@ -172,7 +172,7 @@ public class ArenaImpl implements Arena
Time time = Enums.getEnumFromString(Time.class, timeString); Time time = Enums.getEnumFromString(Time.class, timeString);
this.timeStrategy = (time != null ? new TimeStrategyLocked(time) : new TimeStrategyNull()); this.timeStrategy = (time != null ? new TimeStrategyLocked(time) : new TimeStrategyNull());
if(isLogging()) { if (logging) {
this.dir = new File(plugin.getDataFolder() + File.separator + "arenas" + File.separator + name); this.dir = new File(plugin.getDataFolder() + File.separator + "arenas" + File.separator + name);
this.sessionBuilder = new YMLSessionBuilder(new File(dir, "log_session.yml")); this.sessionBuilder = new YMLSessionBuilder(new File(dir, "log_session.yml"));
this.totalsBuilder = new YMLTotalsBuilder(new File(dir, "log_totals.yml")); this.totalsBuilder = new YMLTotalsBuilder(new File(dir, "log_totals.yml"));
@ -452,7 +452,7 @@ public class ArenaImpl implements Arena
// Start logging // Start logging
rewardManager.reset(); rewardManager.reset();
if(isLogging()) if(logging)
log.start(); log.start();
// Initialize leaderboards and start displaying info. // Initialize leaderboards and start displaying info.
@ -488,7 +488,7 @@ public class ArenaImpl implements Arena
leaderboard.update(); leaderboard.update();
// Finish logging // Finish logging
if(isLogging()) if(logging)
log.end(); log.end();
// Stop spawning. // Stop spawning.
@ -598,19 +598,15 @@ public class ArenaImpl implements Arena
removePotionEffects(p); removePotionEffects(p);
ArenaPlayer ap = arenaPlayerMap.get(p); ArenaPlayer ap = arenaPlayerMap.get(p);
if (ap != null && running) log.playerDeath(ap); if (logging)
if (ap != null && running)
log.playerDeath(ap);
if (inLobby(p) || inArena(p)) { arenaPlayers.remove(p);
inventoryManager.clearInventory(p);
inventoryManager.restoreInventory(p); restoreInvAndExp(p);
rewardManager.grantRewards(p); if(inLobby(p) || inArena(p))
refund(p); refund(p);
//p.updateInventory();
}
else if (inSpec(p)) {
inventoryManager.restoreInventory(p);
//p.updateInventory();
}
movePlayerToEntry(p); movePlayerToEntry(p);
discardPlayer(p); discardPlayer(p);
@ -627,7 +623,9 @@ public class ArenaImpl implements Arena
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
ArenaPlayer ap = arenaPlayerMap.get(p); ArenaPlayer ap = arenaPlayerMap.get(p);
if (ap != null) log.playerDeath(ap); if (logging)
if (ap != null)
log.playerDeath(ap);
arenaPlayers.remove(p); arenaPlayers.remove(p);
@ -661,6 +659,7 @@ public class ArenaImpl implements Arena
if (settings.getBoolean("spectate-on-death", true)) { if (settings.getBoolean("spectate-on-death", true)) {
movePlayerToSpec(p); movePlayerToSpec(p);
//TODO remove this line below, and require "/ma leave" to get inv and rewards back? perhaps a msg should be displayed?
restoreInvAndExp(p); restoreInvAndExp(p);
} else { } else {
restoreInvAndExp(p); restoreInvAndExp(p);

View File

@ -137,13 +137,11 @@ public class ArenaListener
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
if (!arena.getRegion().contains(event.getBlock().getLocation())) if (!arena.getRegion().contains(event.getBlock().getLocation()))
return; return;
// Below this, the block break is in the arena's region - ACStache
if (!arena.inArena(event.getPlayer())) { if (!arena.inArena(event.getPlayer())) {
if (arena.inEditMode()) if (arena.inEditMode())
return; return;
else else
// Players not partaking in the arena while edit mode is off - ACStache
event.setCancelled(true); event.setCancelled(true);
} }
@ -163,11 +161,9 @@ public class ArenaListener
private boolean onBlockDestroy(BlockEvent event) { private boolean onBlockDestroy(BlockEvent event) {
if (arena.inEditMode()) if (arena.inEditMode())
return true; return true;
// Below this, arena is not in edit mode - ACStache
if (!arena.isRunning()) if (!arena.isRunning())
return false; return false;
// Below this, arena is running - ACStache
Block b = event.getBlock(); Block b = event.getBlock();
if (arena.removeBlock(b) || b.getType() == Material.TNT) if (arena.removeBlock(b) || b.getType() == Material.TNT)
@ -600,6 +596,7 @@ public class ArenaListener
return; return;
} }
//TODO watch for arena's pvp setting, then remove all players
// If a potion has harmful effects, remove all players. // If a potion has harmful effects, remove all players.
for (PotionEffect effect : potion.getEffects()) { for (PotionEffect effect : potion.getEffects()) {
PotionEffectType type = effect.getType(); PotionEffectType type = effect.getType();

View File

@ -57,7 +57,7 @@ public class RewardManager
} }
if (stack.getTypeId() == MobArena.ECONOMY_MONEY_ID) { if (stack.getTypeId() == MobArena.ECONOMY_MONEY_ID) {
plugin.giveMoney(p, stack.getAmount()); plugin.giveMoney(p, stack.getAmount()); //TODO bug JustMe in IRC to find out what he changed to fix Economy Money Dupe
continue; continue;
} }

View File

@ -40,7 +40,7 @@ public class MAGlobalListener implements Listener
// // // //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
//TODO watch block physics, piston extend, and piston retract events
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void blockBreak(BlockBreakEvent event) { public void blockBreak(BlockBreakEvent event) {
for (Arena arena : am.getArenas()) for (Arena arena : am.getArenas())