Correctly handle taunt cooldowns
This commit is contained in:
parent
901d62c8e0
commit
cfc223f52a
@ -35,10 +35,12 @@ public class BlowAKissTaunt extends TauntGadget
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Player player)
|
public boolean onStart(Player player)
|
||||||
{
|
{
|
||||||
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
|
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
|
||||||
return;
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
HashSet<Material> ignore = new HashSet<>();
|
HashSet<Material> ignore = new HashSet<>();
|
||||||
ignore.add(Material.AIR);
|
ignore.add(Material.AIR);
|
||||||
@ -46,6 +48,8 @@ public class BlowAKissTaunt extends TauntGadget
|
|||||||
|
|
||||||
BlowAKissEffect blowAKissEffect = new BlowAKissEffect(player, loc, this);
|
BlowAKissEffect blowAKissEffect = new BlowAKissEffect(player, loc, this);
|
||||||
blowAKissEffect.start();
|
blowAKissEffect.start();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,9 +29,7 @@ import mineplex.core.common.util.UtilText;
|
|||||||
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||||
import mineplex.core.events.EnableArcadeSpawnEvent;
|
import mineplex.core.events.EnableArcadeSpawnEvent;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import mineplex.core.gadget.types.TauntGadget;
|
import mineplex.core.gadget.types.TauntGadget;
|
||||||
import mineplex.core.game.GameDisplay;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -52,18 +50,21 @@ public class EternalTaunt extends TauntGadget
|
|||||||
C.cWhite + "Use /taunt in game to show how long you've been waiting.",
|
C.cWhite + "Use /taunt in game to show how long you've been waiting.",
|
||||||
C.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE),
|
C.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE),
|
||||||
-15, Material.WATCH, (byte) 0);
|
-15, Material.WATCH, (byte) 0);
|
||||||
|
|
||||||
setCanPlayWithPvp(false);
|
setCanPlayWithPvp(false);
|
||||||
setPvpCooldown(PVP_COOLDOWN);
|
setPvpCooldown(PVP_COOLDOWN);
|
||||||
setShouldPlay(true);
|
setShouldPlay(true);
|
||||||
setEventType(UpdateType.FAST);
|
setEventType(UpdateType.FAST);
|
||||||
addDisabledGames(GameDisplay.Smash, GameDisplay.SmashTeams, GameDisplay.SmashDomination);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Player player)
|
public boolean onStart(Player player)
|
||||||
{
|
{
|
||||||
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
|
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
|
||||||
return;
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
UtilFirework.playFirework(player.getLocation(), FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.fromRGB(255, 175, 175)).withFade(Color.RED).build());
|
UtilFirework.playFirework(player.getLocation(), FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.fromRGB(255, 175, 175)).withFade(Color.RED).build());
|
||||||
|
|
||||||
_clocks.put(player.getUniqueId(), new ArrayList<>());
|
_clocks.put(player.getUniqueId(), new ArrayList<>());
|
||||||
@ -73,16 +74,23 @@ public class EternalTaunt extends TauntGadget
|
|||||||
if (!Manager.getDisguiseManager().isDisguised(player))
|
if (!Manager.getDisguiseManager().isDisguised(player))
|
||||||
{
|
{
|
||||||
DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player);
|
DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player);
|
||||||
UtilMorph.disguise(player, disguiseSkeleton, Manager);
|
disguiseSkeleton.setName(player.getName());
|
||||||
|
disguiseSkeleton.setCustomNameVisible(true);
|
||||||
|
disguiseSkeleton.showArmor();
|
||||||
|
Manager.getDisguiseManager().disguise(disguiseSkeleton);
|
||||||
_disguises.put(player.getUniqueId(), disguiseSkeleton);
|
_disguises.put(player.getUniqueId(), disguiseSkeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlay(Player player)
|
public void onPlay(Player player)
|
||||||
{
|
{
|
||||||
if (!_clocks.containsKey(player.getUniqueId()))
|
if (!_clocks.containsKey(player.getUniqueId()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int i = getPlayerTicks(player);
|
int i = getPlayerTicks(player);
|
||||||
|
|
||||||
|
@ -36,10 +36,12 @@ public class RainbowTaunt extends TauntGadget
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Player player)
|
public boolean onStart(Player player)
|
||||||
{
|
{
|
||||||
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
|
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
|
||||||
return;
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Vector dir = player.getLocation().getDirection();
|
Vector dir = player.getLocation().getDirection();
|
||||||
Vector sideA = dir.clone().setX(-dir.getZ()).setZ(dir.getX());
|
Vector sideA = dir.clone().setX(-dir.getZ()).setZ(dir.getX());
|
||||||
@ -51,6 +53,8 @@ public class RainbowTaunt extends TauntGadget
|
|||||||
RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(start, Manager.getPlugin());
|
RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(start, Manager.getPlugin());
|
||||||
rainbowTauntEffect.setTargetLocation(new EffectLocation(end));
|
rainbowTauntEffect.setTargetLocation(new EffectLocation(end));
|
||||||
rainbowTauntEffect.start();
|
rainbowTauntEffect.start();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,11 +76,13 @@ public abstract class TauntGadget extends Gadget
|
|||||||
|
|
||||||
public void start(Player player)
|
public void start(Player player)
|
||||||
{
|
{
|
||||||
onStart(player);
|
if (onStart(player))
|
||||||
_ticksPerPlayer.put(player.getUniqueId(), 0);
|
{
|
||||||
|
_ticksPerPlayer.put(player.getUniqueId(), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void onStart(Player player);
|
public abstract boolean onStart(Player player);
|
||||||
|
|
||||||
public void play(Player player)
|
public void play(Player player)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user