@@ -67,23 +67,28 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
67
67
68
68
@ SuppressWarnings ("StatementWithEmptyBody" )
69
69
@ Override
70
- public InteractionResult use (BlockState state , Level level , BlockPos pos , Player player , InteractionHand hand , BlockHitResult hit ) {
70
+ public @ NotNull InteractionResult use (@ NotNull BlockState state , Level level , @ NotNull BlockPos pos ,
71
+ @ NotNull Player player , @ NotNull InteractionHand hand ,
72
+ @ NotNull BlockHitResult hit ) {
71
73
if (level .isClientSide )
72
74
return InteractionResult .SUCCESS ;
73
75
74
76
ItemStack handStack = player .getItemInHand (hand );
75
77
76
78
BankAccount account = null ;
77
79
78
- if (NumismaticsTags .AllItemTags .CARDS .matches (handStack ) && CardItem .isBound (handStack )
79
- && (account = Numismatics .BANK .getAccount (CardItem .get (handStack ))) != null && account .isAuthorized (player )) {
80
- // intentionally left blank
80
+ if (NumismaticsTags .AllItemTags .CARDS .matches (handStack ) && CardItem .isBound (handStack )) {
81
+ account = Numismatics .BANK .getAccount (CardItem .get (handStack ));
81
82
}
82
83
if (account == null ) {
83
84
account = Numismatics .BANK .getAccount (player );
84
85
}
85
86
86
- Utils .openScreen ((ServerPlayer ) player , account , account ::sendToMenu );
87
- return InteractionResult .SUCCESS ;
87
+ if (account .isAuthorized (player )) {
88
+ Utils .openScreen ((ServerPlayer ) player , account , account ::sendToMenu );
89
+ return InteractionResult .SUCCESS ;
90
+ } else {
91
+ return InteractionResult .FAIL ;
92
+ }
88
93
}
89
94
}
0 commit comments