Skip to content

Commit

Permalink
move event.getPlayer() to just before it's used
Browse files Browse the repository at this point in the history
  • Loading branch information
zefir-git committed Nov 30, 2024
1 parent 6bc022b commit 240cbd4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
public final class POSOpen implements Listener {
@EventHandler
public void openPOS(final @NotNull PlayerInteractEvent event) {
final @NotNull Player player = event.getPlayer();
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
final @NotNull Optional<Block> block = Optional.ofNullable(event.getClickedBlock());
if (block.isEmpty()) return;
Expand All @@ -34,6 +33,7 @@ public void openPOS(final @NotNull PlayerInteractEvent event) {

event.setUseInteractedBlock(Event.Result.DENY);

final @NotNull Player player = event.getPlayer();
if (player.getUniqueId().equals(pos.get().seller.owner.getUniqueId())) {
POS.openOwnerGui(player, chest, pos.get());
return;
Expand Down

0 comments on commit 240cbd4

Please sign in to comment.