GameStages Integration - TCreopargh/CraftTweakerIntegration GitHub Wiki

You can now listen to events that are related to Game Stages.

IEventManager expansion

You can call these methods with the events global keyword.

Methods Description
onGameStageAdd(mods.ctintegration.gamestages.GameStageAddEvent) Fires when a game stage is added to a player, is cancelable
onGameStageAdded(mods.ctintegration.gamestages.GameStageAddedEvent) Fires when a game stage is Successfully added to a player, is NOT cancelable
onGameStageRemove(mods.ctintegration.gamestages.GameStageRemoveEvent) Fires when a game stage is removed from a player, is cancelable
onGameStageRemoved(mods.ctintegration.gamestages.GameStageRemovedEvent) Fires when a game stage is Successfully removed from a player, is NOT cancelable
onGameStageCleared(mods.ctintegration.gamestages.GameStageClearedEvent) Fires when a player's game stages are cleared

IGameStageEvent

All above events, excluding GameStageClearedEvent (which implements IPlayerEvent), all implement IGameStageEvent allowing the following methods:

ZenGetter Return Value Description
gameStage string The game stage name related to the event

Also IGameStageEvent extends IPlayerEvent which allows you to get the player instance.

Examples

events.onGameStageAdd(function(event as mods.ctintegration.gamestages.GameStageAddEvent) {
   event.player.sendChat("Gamestage add! " + event.gameStage);
});
events.onGameStageAdded(function(event as mods.ctintegration.gamestages.GameStageAddedEvent) {
   event.player.sendChat("Gamestage added! " + event.gameStage);
});
events.onGameStageRemove(function(event as mods.ctintegration.gamestages.GameStageRemoveEvent) {
   event.player.sendChat("Gamestage remove! " + event.gameStage);
});
events.onGameStageRemoved(function(event as mods.ctintegration.gamestages.GameStageRemovedEvent) {
   event.player.sendChat("Gamestage remove! " + event.gameStage);
});
events.onGameStageCleared(function(event as mods.ctintegration.gamestages.GameStageClearedEvent) {
   event.player.sendChat("Gamestage Cleared! ");
});