Added Taunts :toot:
This commit is contained in:
parent
56003cccab
commit
0af46005e7
@ -0,0 +1,62 @@
|
||||
package mineplex.core.gadget.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class TauntCommandEvent extends Event
|
||||
{
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
private boolean _gameInProgress;
|
||||
private boolean _alive;
|
||||
private boolean _spectator;
|
||||
private boolean _inPvp;
|
||||
|
||||
public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, boolean inPvp)
|
||||
{
|
||||
_player = player;
|
||||
_gameInProgress = gameInProgress;
|
||||
_alive = alive;
|
||||
_spectator = spectator;
|
||||
_inPvp = inPvp;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public boolean isGameInProgress()
|
||||
{
|
||||
return _gameInProgress;
|
||||
}
|
||||
|
||||
public boolean isAlive()
|
||||
{
|
||||
return _alive;
|
||||
}
|
||||
|
||||
public boolean isSpectator()
|
||||
{
|
||||
return _spectator;
|
||||
}
|
||||
|
||||
public boolean isInPvp()
|
||||
{
|
||||
return _inPvp;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package mineplex.core.gadget.types;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public abstract class TauntGadget extends Gadget
|
||||
{
|
||||
|
||||
protected Player _player;
|
||||
protected long _started;
|
||||
protected boolean _hasStarted = false;
|
||||
|
||||
private boolean _shouldPlay = false;
|
||||
private UpdateType _updateType = UpdateType.TICK;
|
||||
|
||||
public TauntGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
|
||||
String... alternativeSalesPackageNames)
|
||||
{
|
||||
super(manager, GadgetType.TAUNT, name, desc, cost, mat, data, 1, alternativeSalesPackageNames);
|
||||
}
|
||||
|
||||
public TauntGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
|
||||
YearMonth yearMonth, String... alternativeSalesPackageNames)
|
||||
{
|
||||
super(manager, GadgetType.TAUNT, name, desc, cost, mat, data, yearMonth, 1, alternativeSalesPackageNames);
|
||||
}
|
||||
|
||||
public abstract void start();
|
||||
|
||||
public abstract void play();
|
||||
|
||||
public abstract void finish();
|
||||
|
||||
public void setShouldPlay(boolean shouldPlay)
|
||||
{
|
||||
_shouldPlay = shouldPlay;
|
||||
}
|
||||
|
||||
public void setEventType(UpdateType updateType)
|
||||
{
|
||||
_updateType = updateType;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!_hasStarted)
|
||||
return;
|
||||
|
||||
if (!_shouldPlay)
|
||||
return;
|
||||
|
||||
if (event.getType() != _updateType)
|
||||
return;
|
||||
|
||||
play();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package nautilus.game.arcade.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.event.TauntCommandEvent;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
public class TauntCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
|
||||
private ArcadeManager _arcadeManager;
|
||||
|
||||
public TauntCommand(ArcadeManager manager)
|
||||
{
|
||||
super(manager, Rank.ALL, "taunt");
|
||||
_arcadeManager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player player, String[] args)
|
||||
{
|
||||
TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(),
|
||||
_arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), false);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user