geforkt von Mirrors/Paper
Added a setArmorContents method to PlayerInventory.
It handles error checking. Null item stacks and air item stacks are both converted to clear slot calls to prevent crashing the client. By: Raphfrk <raphfrk@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
4ae1ef6d1d
Commit
421600527f
@ -71,4 +71,18 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setArmorContents(ItemStack[] items) {
|
||||||
|
int cnt = getSize();
|
||||||
|
if (items == null) {
|
||||||
|
items = new ItemStack[4];
|
||||||
|
}
|
||||||
|
for (ItemStack item : items) {
|
||||||
|
if (item == null || item.getTypeId() == 0) {
|
||||||
|
clear(cnt++);
|
||||||
|
} else {
|
||||||
|
setItem(cnt++, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren