Skip to content

Instantly share code, notes, and snippets.

@xZise
Created August 2, 2011 09:55
Show Gist options
  • Save xZise/1119919 to your computer and use it in GitHub Desktop.
Save xZise/1119919 to your computer and use it in GitHub Desktop.
Not working interact example
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.plugin.java.JavaPlugin;
public class Plugin extends JavaPlugin {
@Override
public void onDisable() {
}
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_INTERACT, new PlayerListener() {
@Override
public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
Player player = event.getPlayer();
player.sendMessage("Hit! block == null ? " + (block == null) + " cancelled ? " + event.isCancelled());
}
}, Priority.Normal, this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment