Skip to content

Commit

Permalink
Fixed tag apply (#969)
Browse files Browse the repository at this point in the history
* add 1.20.4 support (#949)

add 1.20.4 support

* Fixed tag apply

Fixed tag apply for 1.18.2, 1.17.1, 1.12.2 and 1.8.8 where the tag wouldnt get applied ever (because the NBTTag was getting applied only if the item was null with no additive tags)

---------

Co-authored-by: Andrei Dascălu <[email protected]>
  • Loading branch information
KKiiya and andrei1058 authored Feb 3, 2024
1 parent f59e3ce commit f4226f6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemSta
NBTTagCompound tag = itemStack.getTag();
if (tag == null) {
tag = new NBTTagCompound();
itemStack.setTag(tag);
}

tag.setString("BedWars1058", data);
itemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(itemStack);
}

Expand All @@ -390,10 +390,10 @@ public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack i, S
NBTTagCompound tag = itemStack.getTag();
if (tag == null) {
tag = new NBTTagCompound();
itemStack.setTag(tag);
}

tag.setString(key, value);
itemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(itemStack);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemSta
NBTTagCompound tag = itemStack.getTag();
if (tag == null) {
tag = new NBTTagCompound();
itemStack.setTag(tag);
}

tag.setString("BedWars1058", data);
itemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(itemStack);
}

Expand All @@ -431,10 +431,10 @@ public ItemStack setTag(ItemStack itemStack, String key, String value) {
NBTTagCompound tag = is.getTag();
if (tag == null) {
tag = new NBTTagCompound();
is.setTag(tag);
}

tag.setString(key, value);
is.setTag(tag);
return CraftItemStack.asBukkitCopy(is);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,10 @@ public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemSta
NBTTagCompound tag = itemStack.getTag();
if (tag == null) {
tag = new NBTTagCompound();
itemStack.setTag(tag);
}

tag.setString("BedWars1058", data);
itemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(itemStack);
}

Expand All @@ -394,10 +394,10 @@ public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack item
NBTTagCompound tag = is.getTag();
if (tag == null) {
tag = new NBTTagCompound();
is.setTag(tag);
}

tag.setString(key, value);
is.setTag(tag);
return CraftItemStack.asBukkitCopy(is);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemSta
NBTTagCompound tag = itemStack.getTag();
if (tag == null) {
tag = new NBTTagCompound();
itemStack.setTag(tag);
}

tag.setString("BedWars1058", data);
itemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(itemStack);
}

Expand All @@ -424,10 +424,10 @@ public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack item
NBTTagCompound tag = is.getTag();
if (tag == null) {
tag = new NBTTagCompound();
is.setTag(tag);
}

tag.setString(key, value);
is.setTag(tag);
return CraftItemStack.asBukkitCopy(is);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemSta
NBTTagCompound tag = itemStack.t();
if (tag == null) {
tag = new NBTTagCompound();
itemStack.c(tag);
}

tag.a("BedWars1058", data);
itemStack.c(tag);
return CraftItemStack.asBukkitCopy(itemStack);
}

Expand All @@ -404,10 +404,10 @@ public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack item
NBTTagCompound tag = is.t();
if (tag == null) {
tag = new NBTTagCompound();
is.c(tag);
}

tag.a(key, value);
is.c(tag);
return CraftItemStack.asBukkitCopy(is);
}

Expand Down

0 comments on commit f4226f6

Please sign in to comment.