mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-27 04:55:25 +01:00
allow Snow & Iron Golems to be made in the arena. Track them and display when they die
This commit is contained in:
parent
e473c72743
commit
76dc0c1df3
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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!"),
|
||||
|
Loading…
Reference in New Issue
Block a user