mirror of
https://github.com/TotalFreedomMC/VulnerabilityPatcher.git
synced 2025-02-05 06:12:46 +00:00
Fixed where new signs would throw NPE
This commit is contained in:
parent
03393f0c34
commit
bd4c2bb449
1 changed files with 14 additions and 10 deletions
|
@ -507,13 +507,17 @@ public class NBTModifier_1_16_3
|
|||
if (item != null && item.getType().name().contains("SIGN"))
|
||||
{
|
||||
net.minecraft.server.v1_16_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
||||
NBTTagCompound tag = nmsItem.getTag().getCompound("BlockEntityTag");
|
||||
String text1 = tag.getString("Text1").toLowerCase();
|
||||
String text2 = tag.getString("Text2").toLowerCase();
|
||||
String text3 = tag.getString("Text3").toLowerCase();
|
||||
String text4 = tag.getString("Text4").toLowerCase();
|
||||
NBTTagCompound tag = nmsItem.getTag();
|
||||
if (tag != null)
|
||||
{
|
||||
NBTTagCompound blockEntityTag = tag.getCompound("BlockEntityTag");
|
||||
String text1 = blockEntityTag.hasKey("Text1") ? tag.getString("Text1").toLowerCase() : "";
|
||||
String text2 = blockEntityTag.hasKey("Text2") ? tag.getString("Text2").toLowerCase() : "";
|
||||
String text3 = blockEntityTag.hasKey("Text3") ? tag.getString("Text3").toLowerCase() : "";
|
||||
String text4 = blockEntityTag.hasKey("Text4") ? tag.getString("Text4").toLowerCase() : "";
|
||||
return text1.contains("\"nbt\":") || text2.contains("\"nbt\":") || text3.contains("\"nbt\":") || text4.contains("\"nbt\":");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -522,10 +526,10 @@ public class NBTModifier_1_16_3
|
|||
ItemStack item = event.getItemInHand();
|
||||
net.minecraft.server.v1_16_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
||||
NBTTagCompound tag = nmsItem.getTag().getCompound("BlockEntityTag");
|
||||
String text1 = tag.getString("Text1").toLowerCase();
|
||||
String text2 = tag.getString("Text2").toLowerCase();
|
||||
String text3 = tag.getString("Text3").toLowerCase();
|
||||
String text4 = tag.getString("Text4").toLowerCase();
|
||||
String text1 = tag.hasKey("Text1") ? tag.getString("Text1").toLowerCase() : "";
|
||||
String text2 = tag.hasKey("Text2") ? tag.getString("Text2").toLowerCase() : "";
|
||||
String text3 = tag.hasKey("Text3") ? tag.getString("Text3").toLowerCase() : "";
|
||||
String text4 = tag.hasKey("Text4") ? tag.getString("Text4").toLowerCase() : "";
|
||||
if (text1.contains("\"nbt\":"))
|
||||
{
|
||||
tag.setString("Text1", "{\"text\":\"NBT tag removed\"}");
|
||||
|
|
Loading…
Reference in a new issue