Reuse removePotionEffects() in ArenaImpl.

This commit also rearranges the method, placing it closer to the cleanup methods.
This commit is contained in:
Andreas Troelsen 2018-06-23 17:14:25 +02:00
parent cbf18ff720
commit ae3b394b46

View File

@ -1033,12 +1033,6 @@ public class ArenaImpl implements Arena
} }
} }
private void removePotionEffects(Player p) {
for (PotionEffect effect : p.getActivePotionEffects()) {
p.removePotionEffect(effect.getType());
}
}
private void startSpawner() { private void startSpawner() {
// Set the spawn flags to enable monster spawning. // Set the spawn flags to enable monster spawning.
world.setSpawnFlags(true, true); world.setSpawnFlags(true, true);
@ -1171,10 +1165,7 @@ public class ArenaImpl implements Arena
} }
InventoryManager.clearInventory(p); InventoryManager.clearInventory(p);
p.getActivePotionEffects().stream() removePotionEffects(p);
.map(PotionEffect::getType)
.forEach(p::removePotionEffect);
arenaPlayer.setArenaClass(arenaClass); arenaPlayer.setArenaClass(arenaClass);
arenaClass.grantItems(p); arenaClass.grantItems(p);
@ -1343,6 +1334,12 @@ public class ArenaImpl implements Arena
p.recalculatePermissions(); p.recalculatePermissions();
} }
private void removePotionEffects(Player p) {
p.getActivePotionEffects().stream()
.map(PotionEffect::getType)
.forEach(p::removePotionEffect);
}
private void cleanup() { private void cleanup() {
removeMonsters(); removeMonsters();
removeBlocks(); removeBlocks();