Fix Perks not being unregistered from the EventHandler
This commit is contained in:
parent
cf85742583
commit
89efc22208
@ -813,11 +813,35 @@ public abstract class Game implements Listener
|
||||
|
||||
HandlerList.unregisterAll(kit);
|
||||
|
||||
for (Perk perk : kit.GetPerks())
|
||||
if (kit instanceof ProgressingKit)
|
||||
{
|
||||
HandlerList.unregisterAll(perk);
|
||||
perk.unregisteredEvents();
|
||||
if (((ProgressingKit) kit).hasUpgrades())
|
||||
{
|
||||
ProgressingKit pKit = (ProgressingKit) kit;
|
||||
for (Perk[] perks : pKit.getPerks())
|
||||
{
|
||||
for (Perk perk : perks)
|
||||
{
|
||||
if (perk == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
HandlerList.unregisterAll(perk);
|
||||
perk.unregisteredEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Perk perk : kit.GetPerks())
|
||||
{
|
||||
HandlerList.unregisterAll(perk);
|
||||
perk.unregisteredEvents();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,7 @@ public class HomingArrow
|
||||
arrowToPlayer.multiply(1.9);
|
||||
|
||||
UtilAction.velocity(_arrow, arrowToPlayer);
|
||||
|
||||
if (_updates % firework == 0)
|
||||
UtilFirework.playFirework(_arrow.getLocation(), Type.BALL, Color.RED, true, false);
|
||||
|
||||
|
@ -113,6 +113,8 @@ public abstract class Skyfall extends Game
|
||||
private static final long DEATHMATCH_START_TIME = 1000*30; // 30 Seconds
|
||||
private static final long DEATHMATCH_WAIT_TIME = 1000*10; // 10 Seconds
|
||||
|
||||
private static final int TNT_EXPLOSION_RADIUS = 14;
|
||||
|
||||
private static final long EAT_RECHARGE = 500; // 0.5 Second
|
||||
|
||||
private int _islandBounds;
|
||||
@ -904,22 +906,10 @@ public abstract class Skyfall extends Game
|
||||
|
||||
Player player = _tntMap.remove(event.getEntity());
|
||||
|
||||
for (Player other : UtilPlayer.getNearby(event.getEntity()
|
||||
.getLocation(), 14))
|
||||
Manager.GetCondition()
|
||||
.Factory()
|
||||
.Explosion("Throwing TNT", other, player, 50, 0.1, false,
|
||||
false);
|
||||
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), TNT_EXPLOSION_RADIUS))
|
||||
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false);
|
||||
|
||||
Location loc = event.getEntity().getLocation();
|
||||
for (Block block : UtilBlock.getSurrounding(loc.getBlock(), true))
|
||||
{
|
||||
if (block.getType() == _boosterRings.get(0).getType())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -15,6 +15,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.skyfall.HomingArrow;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
|
||||
/**
|
||||
* Perk that lets Players shot
|
||||
|
Loading…
Reference in New Issue
Block a user