You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preconditions.checkArgument(slot != null, "slot must not be null");
160
142
161
-
switch (slot) {
162
-
caseHAND:
163
-
returnthis.getItemInMainHand();
164
-
caseOFF_HAND:
165
-
returnthis.getItemInOffHand();
166
-
caseFEET:
167
-
returnjava.util.Objects.requireNonNullElseGet(this.getBoots(), () -> newItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
168
-
caseLEGS:
169
-
returnjava.util.Objects.requireNonNullElseGet(this.getLeggings(), () -> newItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
170
-
caseCHEST:
171
-
returnjava.util.Objects.requireNonNullElseGet(this.getChestplate(), () -> newItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
172
-
caseHEAD:
173
-
returnjava.util.Objects.requireNonNullElseGet(this.getHelmet(), () -> newItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
174
-
// Paper start
175
-
caseBODY:
176
-
thrownewIllegalArgumentException("BODY is not valid for players!");
177
-
// Paper end
178
-
default:
143
+
returnswitch (slot) {
144
+
caseHAND -> this.getItemInMainHand();
145
+
caseOFF_HAND, FEET, LEGS, CHEST, HEAD -> CraftItemStack.asCraftMirror(this.getInventory().equipment.get(CraftEquipmentSlot.getNMS(slot)));
146
+
caseBODY -> thrownewIllegalArgumentException("BODY is not valid for players!");
147
+
default ->
179
148
thrownewIllegalArgumentException("Could not get slot " + slot + " - not a valid slot for PlayerInventory");
180
-
}
149
+
};
181
150
}
182
151
183
152
@Override
184
153
publicintgetHeldItemSlot() {
185
-
returnthis.getInventory().selected;
154
+
returnthis.getInventory().getSelectedSlot();
186
155
}
187
156
188
157
@Override
189
158
publicvoidsetHeldItemSlot(intslot) {
190
159
Preconditions.checkArgument(slot >= 0 && slot < Inventory.getSelectionSize(), "Slot (%s) is not between 0 and %s inclusive", slot, Inventory.getSelectionSize() - 1);
0 commit comments