fixed double economy rewards, spectators dont get rewards until after they leave the spec area

This commit is contained in:
Brian 2012-05-22 01:42:17 -04:00
parent e2901086f0
commit e473c72743
6 changed files with 10 additions and 9 deletions

View File

@ -452,7 +452,7 @@ public class ArenaImpl implements Arena
// Start logging
rewardManager.reset();
if(logging)
if (logging)
log.start();
// Initialize leaderboards and start displaying info.
@ -488,7 +488,7 @@ public class ArenaImpl implements Arena
leaderboard.update();
// Finish logging
if(logging)
if (logging)
log.end();
// Stop spawning.
@ -659,8 +659,9 @@ public class ArenaImpl implements Arena
if (settings.getBoolean("spectate-on-death", true)) {
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);
//TODO revert if people throw a fit. Should help deter removing valuables from the arena
Messenger.tellPlayer(p, Msg.SPEC_FROM_ARENA);
//restoreInvAndExp(p);
} else {
restoreInvAndExp(p);
movePlayerToEntry(p);

View File

@ -97,6 +97,7 @@ public class ArenaListener
pvpEnabled,
foodRegen,
lockFoodLevel;
@SuppressWarnings("unused")
private boolean allowTeleport,
canShare,
allowMonsters,
@ -596,7 +597,6 @@ public class ArenaListener
return;
}
//TODO watch for arena's pvp setting, then remove all players
// If a potion has harmful effects, remove all players.
for (PotionEffect effect : potion.getEffects()) {
PotionEffectType type = effect.getType();

View File

@ -299,7 +299,7 @@ public class MASpawnThread implements Runnable
Messenger.warning("Could not add null reward. Please check the config-file!");
}
else if (reward.getTypeId() == MobArena.ECONOMY_MONEY_ID) {
if (plugin.giveMoney(p, reward.getAmount())) {
if (plugin.giveMoney(p, reward.getAmount())) { // Money already awarded here, not needed at end of match as well
Messenger.tellPlayer(p, Msg.WAVE_REWARD, plugin.economyFormat(reward.getAmount()));
}
else {

View File

@ -30,6 +30,7 @@ public enum Msg
LEAVE_PLAYER_LEFT("You left the arena. Thanks for playing!", "Left arena.", Material.WOOD_DOOR),
PLAYER_DIED("% died!", "% died!", Material.BONE),
SPEC_PLAYER_SPECTATE("Enjoy the show!", "Enjoy the show!"),
SPEC_FROM_ARENA("Enjoy the rest of the show! Make sure to '/ma leave' when you're finished watching!", "Enjoy the show!"),
SPEC_NOT_RUNNING("This arena isn't running.", "Arena not running.", Material.REDSTONE_TORCH_OFF),
SPEC_EMPTY_INV("Empty your inventory first!", "Empty your inventory.", Material.CHEST),
SPEC_ALREADY_PLAYING("Can't spectate when in the arena!", "Already playing!"),

View File

@ -15,6 +15,7 @@ import com.garbagemule.MobArena.framework.Arena;
public class RewardManager
{
@SuppressWarnings("unused")
private MobArena plugin;
@SuppressWarnings("unused")
private Arena arena;
@ -57,13 +58,12 @@ public class RewardManager
}
if (stack.getTypeId() == MobArena.ECONOMY_MONEY_ID) {
plugin.giveMoney(p, stack.getAmount()); //TODO bug JustMe in IRC to find out what he changed to fix Economy Money Dupe
// plugin.giveMoney(p, stack.getAmount()); - removed to fix double money rewards
continue;
}
p.getInventory().addItem(stack);
}
rewarded.add(p);
}
}

View File

@ -7,7 +7,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;