File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/main/java/pro/cloudnode/smp/bankaccounts/events Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1111import org .bukkit .inventory .DoubleChestInventory ;
1212import org .bukkit .inventory .ItemStack ;
1313import org .jetbrains .annotations .NotNull ;
14+ import org .jetbrains .annotations .Nullable ;
1415import pro .cloudnode .smp .bankaccounts .Account ;
1516import pro .cloudnode .smp .bankaccounts .BankAccounts ;
1617import 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 );
You can’t perform that action at this time.
0 commit comments