(PlayerInteractEvent e)
| 54 | } |
| 55 | |
| 56 | @EventHandler |
| 57 | public void onClick(PlayerInteractEvent e) { |
| 58 | if (e.getAction() != Action.RIGHT_CLICK_BLOCK || e.getItem() == null) { |
| 59 | return; |
| 60 | } |
| 61 | if (!ItemUtils.compare(e.getItem(), item)) { |
| 62 | return; |
| 63 | } |
| 64 | Location[] locations = selections.getOrDefault(e.getPlayer().getUniqueId(), new Location[2]); |
| 65 | if (locations[0] != null && locations[1] != null) { |
| 66 | locations[0] = null; |
| 67 | locations[1] = null; |
| 68 | } |
| 69 | if (locations[0] == null) { |
| 70 | locations[0] = e.getClickedBlock().getLocation(); |
| 71 | e.getPlayer().sendMessage(RedLib.msg("firstLocationSet")); |
| 72 | } else if (locations[1] == null) { |
| 73 | locations[1] = e.getClickedBlock().getLocation(); |
| 74 | e.getPlayer().sendMessage(RedLib.msg("secondLocationSet")); |
| 75 | } |
| 76 | selections.put(e.getPlayer().getUniqueId(), locations); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Gets the item used by this SelectionTool |
nothing calls this directly
no test coverage detected