Correctly handle taunt cooldowns

This commit is contained in:
Graphica 2017-06-28 18:32:52 -04:00 committed by cnr
parent c2b025e883
commit 2021a7e321
4 changed files with 31 additions and 13 deletions

View File

@ -35,10 +35,12 @@ public class BlowAKissTaunt extends TauntGadget
}
@Override
public void onStart(Player player)
public boolean onStart(Player player)
{
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
return;
{
return false;
}
HashSet<Material> ignore = new HashSet<>();
ignore.add(Material.AIR);
@ -46,6 +48,8 @@ public class BlowAKissTaunt extends TauntGadget
BlowAKissEffect blowAKissEffect = new BlowAKissEffect(player, loc, this);
blowAKissEffect.start();
return true;
}
@Override

View File

@ -29,9 +29,7 @@ import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.events.EnableArcadeSpawnEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
import mineplex.core.gadget.types.TauntGadget;
import mineplex.core.game.GameDisplay;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
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.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE),
-15, Material.WATCH, (byte) 0);
setCanPlayWithPvp(false);
setPvpCooldown(PVP_COOLDOWN);
setShouldPlay(true);
setEventType(UpdateType.FAST);
addDisabledGames(GameDisplay.Smash, GameDisplay.SmashTeams, GameDisplay.SmashDomination);
}
@Override
public void onStart(Player player)
public boolean onStart(Player player)
{
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());
_clocks.put(player.getUniqueId(), new ArrayList<>());
@ -73,16 +74,23 @@ public class EternalTaunt extends TauntGadget
if (!Manager.getDisguiseManager().isDisguised(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);
}
return true;
}
@Override
public void onPlay(Player player)
{
if (!_clocks.containsKey(player.getUniqueId()))
{
return;
}
int i = getPlayerTicks(player);

View File

@ -36,10 +36,12 @@ public class RainbowTaunt extends TauntGadget
}
@Override
public void onStart(Player player)
public boolean onStart(Player player)
{
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
return;
{
return false;
}
Vector dir = player.getLocation().getDirection();
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.setTargetLocation(new EffectLocation(end));
rainbowTauntEffect.start();
return true;
}
@Override

View File

@ -76,11 +76,13 @@ public abstract class TauntGadget extends Gadget
public void start(Player player)
{
onStart(player);
if (onStart(player))
{
_ticksPerPlayer.put(player.getUniqueId(), 0);
}
}
public abstract void onStart(Player player);
public abstract boolean onStart(Player player);
public void play(Player player)
{