Fixed NPE when player clicks in air

This commit is contained in:
Eric 2016-08-06 13:32:37 +02:00
parent 417aaa36d3
commit bb54c7da67

View File

@ -62,6 +62,7 @@ public class ShopInteractListener implements Listener {
Player p = e.getPlayer(); Player p = e.getPlayer();
Block b = e.getClickedBlock(); Block b = e.getClickedBlock();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) { if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) { if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (ClickType.getPlayerClickType(p) != null) { if (ClickType.getPlayerClickType(p) != null) {
@ -100,6 +101,7 @@ public class ShopInteractListener implements Listener {
} }
} }
} }
}
@EventHandler @EventHandler
public void onPlayerInteract(PlayerInteractEvent e) { public void onPlayerInteract(PlayerInteractEvent e) {