diff --git a/changelog.md b/changelog.md index 5e02f26..bf0bfd6 100644 --- a/changelog.md +++ b/changelog.md @@ -39,6 +39,7 @@ These changes will (most likely) be included in the next version. - Players no longer take fall damage when they leave (or get removed from) an arena while falling. - Players no longer take damage from projectiles shot by pets of other players. - Normal shulker boxes are now properly removed from inventories of players using the My Items class. +- Class pets are now correctly removed from the arena when their owner dies, rather than when they leave. - MobArena no longer nags players with the `mobarena.admin.teleport` permission when they engage in a teleport that would have otherwise been blocked. - MobArena now correctly sets the source property on auto-ignited TNT. diff --git a/src/main/java/com/garbagemule/MobArena/ArenaImpl.java b/src/main/java/com/garbagemule/MobArena/ArenaImpl.java index 7697b71..c32b2e7 100644 --- a/src/main/java/com/garbagemule/MobArena/ArenaImpl.java +++ b/src/main/java/com/garbagemule/MobArena/ArenaImpl.java @@ -810,6 +810,9 @@ public class ArenaImpl implements Arena } leavingPlayers.add(p); + // Remove pets. + monsterManager.removePets(p); + // Clear inventory if player is an arena player, and unmount if (arenaPlayers.contains(p)) { unmount(p); @@ -866,6 +869,9 @@ public class ArenaImpl implements Arena ArenaPlayerDeathEvent event = new ArenaPlayerDeathEvent(p, this, last); plugin.getServer().getPluginManager().callEvent(event); + // Remove pets. + monsterManager.removePets(p); + // Clear the player's inventory, and unmount if (arenaPlayers.remove(p)) { unmount(p); @@ -1131,9 +1137,6 @@ public class ArenaImpl implements Arena } }); - // Remove pets. - monsterManager.removePets(p); - // readyPlayers before lobbyPlayers because of startArena sanity-checks readyPlayers.remove(p); specPlayers.remove(p);