Skip to content

Commit

Permalink
Fixed NullPointerException (#967)
Browse files Browse the repository at this point in the history
* add 1.20.4 support (#949)

add 1.20.4 support

* Fixed NullPointerException

Fixed NullPointerException

Error Log: https://pastebin.com/DCWeqQKQ

---------

Co-authored-by: Andrei Dascălu <[email protected]>
  • Loading branch information
ImYenil and andrei1058 authored Feb 3, 2024
1 parent f4226f6 commit 134a361
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public v1_12_R1(Plugin plugin, String name) {
@Override
public String getTag(org.bukkit.inventory.ItemStack itemStack, String key) {
net.minecraft.server.v1_12_R1.ItemStack i = CraftItemStack.asNMSCopy(itemStack);
if (i == null) {
return null;
}
NBTTagCompound tag = i.getTag();
return tag == null ? null : tag.hasKey(key) ? tag.getString(key) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ public ItemStack setTag(ItemStack itemStack, String key, String value) {
@Override
public String getTag(ItemStack itemStack, String key) {
net.minecraft.server.v1_8_R3.ItemStack i = CraftItemStack.asNMSCopy(itemStack);
if (i == null) {
return null;
}
NBTTagCompound tag = i.getTag();
return tag == null ? null : tag.hasKey(key) ? tag.getString(key) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public void registerCommand(String name, Command clasa) {
@Override
public String getTag(org.bukkit.inventory.ItemStack itemStack, String key) {
net.minecraft.server.v1_16_R3.ItemStack i = CraftItemStack.asNMSCopy(itemStack);
if (i == null) {
return null;
}
NBTTagCompound tag = i.getTag();
return tag == null ? null : tag.hasKey(key) ? tag.getString(key) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public void registerCommand(String name, Command clasa) {
@Override
public String getTag(org.bukkit.inventory.ItemStack itemStack, String key) {
ItemStack i = CraftItemStack.asNMSCopy(itemStack);
if (i == null) {
return null;
}
NBTTagCompound tag = i.getTag();
return tag == null ? null : tag.hasKey(key) ? tag.getString(key) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public void registerCommand(String name, Command clasa) {
@Override
public String getTag(org.bukkit.inventory.ItemStack itemStack, String key) {
ItemStack i = CraftItemStack.asNMSCopy(itemStack);
if (i == null) {
return null;
}
NBTTagCompound tag = i.t();
return tag == null ? null : tag.e(key) ? tag.l(key) : null;
}
Expand Down

0 comments on commit 134a361

Please sign in to comment.