Fixed double message issue of offhand.

This commit is contained in:
Alastair 2017-06-13 02:33:47 +01:00
parent 64da16507c
commit fca3d737db
1 changed files with 2 additions and 1 deletions

View File

@ -199,7 +199,7 @@ public class Listeners implements Listener {
catch(NullPointerException e){
}*/
if (player.getItemInHand() != null && player.getItemInHand().getType() == WandMaterial // was type id
if (event.getItem() != null && event.getItem().getType() == WandMaterial // was type id
&& (!UseOnlyServerAxe || (checkItemForName(event.getItem()) && event.getItem().getItemMeta().getDisplayName().equals("\u00A7ePortal Region Selector")))) {
// This checks if the action was a left or right click and if it was directly effecting a block.
@ -219,6 +219,7 @@ public class Listeners implements Listener {
// Returns the event so no more code is executed(stops unnecessary code being executed)
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
System.out.println(event.getHand());
Location blockloc = event.getClickedBlock().getLocation();
player.setMetadata("Pos2X", new FixedMetadataValue(plugin, blockloc.getBlockX()));
player.setMetadata("Pos2Y", new FixedMetadataValue(plugin, blockloc.getBlockY()));