allow Snow & Iron Golems to be made in the arena. Track them and display when they die

This commit is contained in:
Brian 2012-05-22 02:04:26 -04:00
parent e473c72743
commit 76dc0c1df3
4 changed files with 30 additions and 5 deletions

View File

@ -605,7 +605,7 @@ public class ArenaImpl implements Arena
arenaPlayers.remove(p);
restoreInvAndExp(p);
if(inLobby(p) || inArena(p))
if (inLobby(p) || inArena(p))
refund(p);
movePlayerToEntry(p);
@ -661,6 +661,7 @@ public class ArenaImpl implements Arena
movePlayerToSpec(p);
//TODO revert if people throw a fit. Should help deter removing valuables from the arena
Messenger.tellPlayer(p, Msg.SPEC_FROM_ARENA);
Messenger.tellPlayer(p, Msg.MISC_MA_LEAVE_REMINDER);
//restoreInvAndExp(p);
} else {
restoreInvAndExp(p);

View File

@ -272,8 +272,13 @@ public class ArenaListener
}
if (event.getSpawnReason() != SpawnReason.CUSTOM) {
event.setCancelled(true);
return;
if (event.getSpawnReason() == SpawnReason.BUILD_IRONGOLEM || event.getSpawnReason() == SpawnReason.BUILD_SNOWMAN) {
monsters.addGolem(event.getEntity());
}
else {
event.setCancelled(true);
return;
}
}
LivingEntity entity = (LivingEntity) event.getEntity();
@ -361,6 +366,9 @@ public class ArenaListener
else if (monsters.removeMonster(event.getEntity())) {
onMonsterDeath(event);
}
else if (monsters.removeGolem(event.getEntity())) {
Messenger.tellAll(arena, Msg.GOLEM_DIED);
}
}
private void onPlayerDeath(PlayerDeathEvent event, Player player) {

View File

@ -17,7 +17,7 @@ import com.garbagemule.MobArena.waves.MABoss;
public class MonsterManager
{
private Set<LivingEntity> monsters, sheep;
private Set<LivingEntity> monsters, sheep, golems;
private Set<Wolf> pets;
private Map<LivingEntity,MABoss> bosses;
private Map<LivingEntity,List<ItemStack>> suppliers;
@ -25,6 +25,7 @@ public class MonsterManager
public MonsterManager() {
this.monsters = new HashSet<LivingEntity>();
this.sheep = new HashSet<LivingEntity>();
this.golems = new HashSet<LivingEntity>();
this.pets = new HashSet<Wolf>();
this.bosses = new HashMap<LivingEntity,MABoss>();
this.suppliers = new HashMap<LivingEntity,List<ItemStack>>();
@ -33,6 +34,7 @@ public class MonsterManager
public void reset() {
monsters.clear();
sheep.clear();
golems.clear();
pets.clear();
bosses.clear();
suppliers.clear();
@ -41,6 +43,7 @@ public class MonsterManager
public void clear() {
removeAll(monsters);
removeAll(sheep);
removeAll(golems);
removeAll(pets);
removeAll(bosses.keySet());
removeAll(suppliers.keySet());
@ -80,6 +83,18 @@ public class MonsterManager
return sheep.remove(e);
}
public Set<LivingEntity> getGolems() {
return golems;
}
public void addGolem(LivingEntity e) {
golems.add(e);
}
public boolean removeGolem(LivingEntity e) {
return golems.remove(e);
}
public Set<Wolf> getPets() {
return pets;
}

View File

@ -29,8 +29,9 @@ public enum Msg
LEAVE_NOT_PLAYING("You are not in the arena.", "Not in arena."),
LEAVE_PLAYER_LEFT("You left the arena. Thanks for playing!", "Left arena.", Material.WOOD_DOOR),
PLAYER_DIED("% died!", "% died!", Material.BONE),
GOLEM_DIED("A friendly Golem has died!", "A Golem has died!", Material.PUMPKIN),
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_FROM_ARENA("Enjoy the rest of the show!", "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!"),