Store the NotePlayer so it can be cancelled if it is disabled
This commit is contained in:
parent
f32de9d37d
commit
cfe22f4f68
@ -99,10 +99,19 @@ public class SetWindup extends GadgetSet
|
||||
{
|
||||
super.customDisable(player);
|
||||
|
||||
_charge.remove(player);
|
||||
player.removePotionEffect(PotionEffectType.SPEED);
|
||||
player.removePotionEffect(PotionEffectType.JUMP);
|
||||
UtilPlayer.removeWorldBorder(player);
|
||||
WindupData data = _charge.remove(player);
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
if (data.NotePlayer != null)
|
||||
{
|
||||
data.NotePlayer.cancel();
|
||||
}
|
||||
|
||||
player.removePotionEffect(PotionEffectType.SPEED);
|
||||
player.removePotionEffect(PotionEffectType.JUMP);
|
||||
UtilPlayer.removeWorldBorder(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -133,11 +142,11 @@ public class SetWindup extends GadgetSet
|
||||
location.setYaw(0);
|
||||
location.add(location.getDirection());
|
||||
|
||||
player.getWorld().playSound(location, Sound.SPLASH, 1, 1);
|
||||
player.getWorld().playSound(location, Sound.ENDERMAN_TELEPORT, 1, 1);
|
||||
player.getWorld().playSound(location, Sound.FIZZ, 1, 1);
|
||||
player.getWorld().playSound(location, Sound.BAT_TAKEOFF, 1, 1);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, location, 1, 0.5F, 1, 0.1F, 30, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, location, 1, 0.5F, 1, 0.1F, 30, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, location, 1, 0.5F, 1, 0, 30, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, location, 1, 0.5F, 1, 0, 30, ViewDist.NORMAL);
|
||||
data.reset();
|
||||
player.setExp(data.Charge);
|
||||
setArmour(player, COLOUR);
|
||||
@ -174,7 +183,7 @@ public class SetWindup extends GadgetSet
|
||||
|
||||
if (_song != null)
|
||||
{
|
||||
new NotePlayer(Manager.getPlugin(), _song, other -> true, 1, false, player);
|
||||
data.NotePlayer = new NotePlayer(Manager.getPlugin(), _song, other -> true, 1, false, player);
|
||||
}
|
||||
}
|
||||
// Effect is charging
|
||||
@ -270,6 +279,7 @@ public class SetWindup extends GadgetSet
|
||||
float Charge;
|
||||
long EffectStart;
|
||||
Color Current;
|
||||
NotePlayer NotePlayer;
|
||||
|
||||
WindupData()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user