Created
July 26, 2015 21:10
-
-
Save KieronWiltshire/25fc4bc40514ac8cd4d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dracade.ember.core; | |
import com.dracade.ember.Ember; | |
import org.spongepowered.api.event.Subscribe; | |
import org.spongepowered.api.event.entity.player.PlayerDeathEvent; | |
public class TeamDeathmatch implements Minigame { | |
/** | |
* Some minigame constructor. | |
* | |
* @param arena | |
*/ | |
public TeamDeathmatch(TeamArena arena) { | |
try { | |
// Register the arena... (this doesn't have to be done here, just an example) | |
Ember.register(arena, this); | |
} catch (Exception e) { | |
// This exception is thrown if the minigame | |
// is already thrown, deal with this as you please. | |
} | |
} | |
@Override | |
public long getDelay() { | |
return 0; | |
} | |
@Override | |
public long getInterval() { | |
return 20; | |
} | |
@Override | |
public void run() { | |
// some looping code here | |
} | |
/** | |
* Minigames already listen for events by default. | |
* This is so you can create quick minigame scripts in Scala | |
* and other Java VM languages. | |
* | |
* @param e | |
*/ | |
@Subscribe | |
private void onDeath(PlayerDeathEvent e) { | |
// Get the player's team | |
// and spawn him on the relevant side... | |
} | |
/** | |
* You can also listen for these events... | |
* | |
* - MinigameStartedEvent | |
* This is called once you've registered the game. | |
* | |
* - MinigameStoppingEvent | |
* This is called once the unregister method is called, | |
* but is yet to be finalized. | |
* | |
* - MinigameStoppedEvent | |
* This is called once the minigame has finally stopped. | |
* Once this event is called, the minigame object no longer | |
* listens for events. | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment