Code: // Pseudo code. PlayerInteractEvent { if event.getAction() == Action.right_click_air { // do something } }
@kreashenz I recompiled and used the following code Code: [/SIZE] @EventHandler public void PlayerInteractEvent(PlayerInteractEvent event) { event.getPlayer().sendMessage("Interact event!"); if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK){ event.getPlayer().sendMessage("Click!"); Claim current = GriefPrevention.instance.dataStore.getClaimAt(event.getPlayer().getLocation(), true, null); event.getPlayer().sendMessage(current.toString()); } } [SIZE=3] [/CODE][/SIZE] Let me repost that code... Code: @EventHandler public void PlayerInteractEvent(PlayerInteractEvent event) { event.getPlayer().sendMessage("Interact event!"); if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK){ event.getPlayer().sendMessage("Click!"); Claim current = GriefPrevention.instance.dataStore.getClaimAt(event.getPlayer().getLocation(), true, null); event.getPlayer().sendMessage(current.toString()); } } EDIT by Moderator: merged posts, please use the edit button instead of double posting.
isarij You add this to your onEnable() method: Code:java this.getServer().getPluginManager().registerEvents(this, this); Or if you listeners are in a different class Code:java this.getServer().getPluginManager().registerEvents(ListenerClass, this);
I have to be doing something wrong... Code: public void onEnable(){ getServer().getPluginManager().registerEvents(this, this); } and @EventHandler(priority = EventPriority.HIGH) public void PlayerRightClick(PlayerInteractEvent event){ Player player = event.getPlayer(); Bukkit.broadcastMessage("Interact! " + player.getName()); } Edit: I'm using bukkit 1.2.5
Hahahaha, I love your reaction! "That sound important..." You are right, listening methods do not need event handlers in 1.2.5 EDIT by Moderator: merged posts, please use the edit button instead of double posting.