Skip to content

Commit dce5958

Browse files
committed
remove unneeded Optional
1 parent 240cbd4 commit dce5958

File tree

1 file changed

+5
-4
lines changed
  • src/main/java/pro/cloudnode/smp/bankaccounts/events

1 file changed

+5
-4
lines changed

src/main/java/pro/cloudnode/smp/bankaccounts/events/POSOpen.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.bukkit.inventory.DoubleChestInventory;
1212
import org.bukkit.inventory.ItemStack;
1313
import org.jetbrains.annotations.NotNull;
14+
import org.jetbrains.annotations.Nullable;
1415
import pro.cloudnode.smp.bankaccounts.Account;
1516
import pro.cloudnode.smp.bankaccounts.BankAccounts;
1617
import pro.cloudnode.smp.bankaccounts.POS;
@@ -22,13 +23,13 @@ public final class POSOpen implements Listener {
2223
@EventHandler
2324
public void openPOS(final @NotNull PlayerInteractEvent event) {
2425
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
25-
final @NotNull Optional<Block> block = Optional.ofNullable(event.getClickedBlock());
26-
if (block.isEmpty()) return;
27-
if (!(block.get().getState() instanceof final @NotNull Chest chest)) return;
26+
final @Nullable Block block = event.getClickedBlock();
27+
if (block == null) return;
28+
if (!(block.getState() instanceof final @NotNull Chest chest)) return;
2829
if (chest.getInventory().isEmpty()) return;
2930
if (chest.getInventory() instanceof DoubleChestInventory) return;
3031

31-
final @NotNull Optional<POS> pos = POS.get(block.get());
32+
final @NotNull Optional<POS> pos = POS.get(block);
3233
if (pos.isEmpty()) return;
3334

3435
event.setUseInteractedBlock(Event.Result.DENY);

0 commit comments

Comments
 (0)