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