Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Improve ItemStack filtering.
Dieser Commit ist enthalten in:
Ursprung
47b57e6bcf
Commit
1c13d076af
@ -204,10 +204,14 @@ public final class ItemStack {
|
|||||||
public void c(NBTTagCompound nbttagcompound) {
|
public void c(NBTTagCompound nbttagcompound) {
|
||||||
this.item = Item.d(nbttagcompound.getShort("id"));
|
this.item = Item.d(nbttagcompound.getShort("id"));
|
||||||
this.count = nbttagcompound.getByte("Count");
|
this.count = nbttagcompound.getByte("Count");
|
||||||
|
/* CraftBukkit start - Route through setData for filtering
|
||||||
this.damage = nbttagcompound.getShort("Damage");
|
this.damage = nbttagcompound.getShort("Damage");
|
||||||
if (this.damage < 0) {
|
if (this.damage < 0) {
|
||||||
this.damage = 0;
|
this.damage = 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
this.setData(nbttagcompound.getShort("Damage"));
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
if (nbttagcompound.hasKeyOfType("tag", 10)) {
|
if (nbttagcompound.hasKeyOfType("tag", 10)) {
|
||||||
// CraftBukkit - make defensive copy as this data may be coming from the save thread
|
// CraftBukkit - make defensive copy as this data may be coming from the save thread
|
||||||
@ -258,6 +262,11 @@ public final class ItemStack {
|
|||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter invalid plant data
|
||||||
|
if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(this.getItem())) == Blocks.DOUBLE_PLANT && (i > 5 || i < 0)) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.damage = i;
|
this.damage = i;
|
||||||
@ -565,6 +574,7 @@ public final class ItemStack {
|
|||||||
|
|
||||||
public void setItem(Item item) {
|
public void setItem(Item item) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
this.setData(this.getData()); // CraftBukkit - Set data again to ensure it is filtered properly
|
||||||
}
|
}
|
||||||
|
|
||||||
public IChatBaseComponent E() {
|
public IChatBaseComponent E() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren