Created
April 7, 2013 00:15
-
-
Save riking/5328229 to your computer and use it in GitHub Desktop.
QuitReason test plugin
This file contains 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
name: TestPlugin | |
main: test.TestPlugin | |
version: 1 |
This file contains 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 test; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.player.PlayerKickEvent; | |
import org.bukkit.event.player.PlayerQuitEvent; | |
public class TestPlugin extends JavaPlugin implements Listener { | |
public void onEnable() { | |
getServer().getPluginManager().registerEvents((Listener)this, (JavaPlugin)this); | |
} | |
@EventHandler | |
public void onQuit(PlayerQuitEvent e) { | |
System.out.println("Quit event"); | |
System.out.println("Reason: " + e.getQuitReason()); | |
System.out.println("Player: " + e.getPlayer().getName()); | |
} | |
@EventHandler | |
public void onKick(PlayerKickEvent e) { | |
System.out.println("Kick event"); | |
System.out.println("Reason: " + e.getQuitReason()); | |
System.out.println("Player: " + e.getPlayer().getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment