@@ -120,18 +120,18 @@ public class SuggestionsTest {
120120 .then(Commands . argument(" item" , ArgumentTypes . itemStack())
121121
122122 // Declare a new integer argument with the bounds of 1 to 99
123- .then(Commands . argument(" stacksize " , IntegerArgumentType . integer(1 , 99 ))
123+ .then(Commands . argument(" amount " , IntegerArgumentType . integer(1 , 99 ))
124124
125125 // Here, we use method references, since otherwise, our command definition would grow too big
126- .suggests(SuggestionsTest :: getStackSizeSuggestions )
126+ .suggests(SuggestionsTest :: getAmountSuggestions )
127127 .executes(SuggestionsTest :: executeCommandLogic)
128128
129129 )
130130 )
131131 .build();
132132 }
133133
134- private static CompletableFuture<Suggestions > getStackSizeSuggestions (final CommandContext<CommandSourceStack > ctx , final SuggestionsBuilder builder ) {
134+ private static CompletableFuture<Suggestions > getAmountSuggestions (final CommandContext<CommandSourceStack > ctx , final SuggestionsBuilder builder ) {
135135 // Suggest 1, 16, 32, and 64 to the user when they reach the 'amount' argument
136136 builder. suggest(1 );
137137 builder. suggest(16 );
@@ -147,7 +147,8 @@ public class SuggestionsTest {
147147 }
148148
149149 // If the player has no empty slot, we tell the player that they have no free inventory space
150- if (player. getInventory(). firstEmpty() == - 1 ) {
150+ final int firstEmptySlot = player. getInventory(). firstEmpty();
151+ if (firstEmptySlot == - 1 ) {
151152 player. sendRichMessage(" <light_purple>You do not have enough space in your inventory!" );
152153 return Command . SINGLE_SUCCESS ;
153154 }
@@ -158,7 +159,6 @@ public class SuggestionsTest {
158159
159160 // Set the item's amount and give it to the player
160161 item. setAmount(amount);
161- final int firstEmptySlot = player. getInventory(). firstEmpty();
162162 player. getInventory(). setItem(firstEmptySlot, item);
163163
164164 // Send a confirmation message
0 commit comments