Skip to content

Instantly share code, notes, and snippets.

@tenowg
Created July 28, 2013 05:35
Show Gist options
  • Save tenowg/6097536 to your computer and use it in GitHub Desktop.
Save tenowg/6097536 to your computer and use it in GitHub Desktop.
Feature Example
public class InRegion extends Feature implements Tickable {
/*
* Marking something as @RegionEvent will make this method
* fire everytime the event Type (in this case PlayerChatEvent) is
* fired by Spout. Each Features events are parsed on loadup and
* automaticly registered with Spout's EventManager.
*/
@RegionEvent
public void executeIt(PlayerChatEvent event, EventRegion region) {
chatEvent.getPlayer().sendMessage("You Chatted in " + region.getName());
}
@RegionEvent
@EventOrder(Order.EARLY)
public void execute(PlayerQuitEvent event, EventRegion region) {
// Do something when a player quits while in region.
// EventOrder tells the Spout EventManager to run the event early.
}
@FeatureCommand(alias = "test")
@FearureCommandPermission("test")
public void commandTest(FeatureCommandArgs args) {
// Do some command based on permission "raz.feature.{regionname}.test"
}
@OnTick
public void tickTask(float dt) {
// Will always run, as the default load is Intensity.IGNORE
}
@OnTick(load = Intensity.LOW)
public void someTask(float dt) {
// Do Something on Tick, will not run if TPS is 8 or lower
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment