Added event to be called when game stops
This commit is contained in:
parent
b441dc5edf
commit
8bcb5bc948
@ -0,0 +1,41 @@
|
||||
package mineplex.core.arcadeevents;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is called when a game stops in arcade
|
||||
* It's called inside Arcade and handled inside Core,
|
||||
* so we can track game events in core
|
||||
*/
|
||||
public class CoreGameStopEvent extends Event
|
||||
{
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private GameType _gameType;
|
||||
|
||||
/**
|
||||
* @param gameType the type of the game
|
||||
*/
|
||||
public CoreGameStopEvent(GameType gameType)
|
||||
{
|
||||
_gameType = gameType;
|
||||
}
|
||||
|
||||
public GameType getGameType()
|
||||
{
|
||||
return _gameType;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -51,6 +51,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.arcadeevents.CoreGameStartEvent;
|
||||
import mineplex.core.arcadeevents.CoreGameStopEvent;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -745,13 +746,19 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
UtilServer.getServer().getPluginManager().callEvent(stateEvent);
|
||||
|
||||
System.out.println(GetName() + " state set to " + state.toString());
|
||||
|
||||
|
||||
if (state.equals(GameState.Prepare))
|
||||
{
|
||||
mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());;
|
||||
CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(gameType);
|
||||
UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent);
|
||||
}
|
||||
else if (state.equals(GameState.End))
|
||||
{
|
||||
mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());;
|
||||
CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(gameType);
|
||||
UtilServer.getServer().getPluginManager().callEvent(coreGameStopEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStateTime(long time)
|
||||
|
Loading…
Reference in New Issue
Block a user