Created
August 21, 2012 23:06
-
-
Save admalledd/3420189 to your computer and use it in GitHub Desktop.
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 com.admalledd.bukkit.test_plugin; | |
import org.bukkit.event.EventPriority; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.player.PlayerInteractEvent; | |
import org.bukkit.event.vehicle.VehicleEnterEvent; | |
import org.bukkit.event.vehicle.VehicleExitEvent; | |
public class TestListener implements Listener { | |
//fix for duping dispencers for now. | |
/*@EventHandler | |
public void onBlockDispense(BlockDispenseEvent event){ | |
event.setCancelled(true); | |
System.out.println("blocked dispencer"); | |
}*/ | |
@EventHandler(priority = EventPriority.HIGHEST) | |
public void onPlayerInteract(PlayerInteractEvent event) { | |
if(event.isCancelled()){ | |
System.out.println("interact high cancle"); | |
} | |
else{ | |
System.out.println("interact high good"); | |
} | |
} | |
@EventHandler(priority = EventPriority.MONITOR) | |
public void test2(PlayerInteractEvent event) { | |
if(event.isCancelled()){ | |
System.out.println("interact monitor cancle"); | |
} | |
else{ | |
System.out.println("interact monitor good"); | |
} | |
} | |
@EventHandler(priority = EventPriority.MONITOR) | |
public void test3(VehicleExitEvent event) { | |
if(event.isCancelled()){ | |
System.out.println("exit monitor cancle"); | |
} | |
else{ | |
System.out.println("exit monitor good"); | |
} | |
} | |
@EventHandler(priority = EventPriority.MONITOR) | |
public void test4(VehicleEnterEvent event) { | |
if(event.isCancelled()){ | |
System.out.println("enter monitor cancle"); | |
} | |
else{ | |
System.out.println("enter monitor good"); | |
} | |
} | |
} |
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 com.admalledd.bukkit.test_plugin; | |
import org.bukkit.plugin.PluginDescriptionFile; | |
import org.bukkit.plugin.java.JavaPlugin; | |
/** | |
* Sample plugin for Bukkit | |
* | |
* @author admalledd | |
*/ | |
public class TestPlugin extends JavaPlugin { | |
public void onDisable() { | |
// TODO: Place any custom disable code here | |
// NOTE: All registered events are automatically unregistered when a plugin is disabled | |
// EXAMPLE: Custom code, here we just output some info so we can check all is well | |
System.out.println("Goodbye world!"); | |
} | |
public void onEnable() { | |
// TODO: Place any custom enable code here including the registration of any events | |
// Register our commands | |
//getCommand("pos").setExecutor(new SamplePosCommand(this)); | |
//getCommand("debug").setExecutor(new SampleDebugCommand(this)); | |
getServer().getPluginManager().registerEvents(new TestListener(), this); | |
// EXAMPLE: Custom code, here we just output some info so we can check all is well | |
PluginDescriptionFile pdfFile = this.getDescription(); | |
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment