Created
August 2, 2011 09:55
-
-
Save xZise/1119919 to your computer and use it in GitHub Desktop.
Not working interact example
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
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