Create 0004-Fixes-the-Blank-SkullOwner-exploit.patch

This commit is contained in:
Telesphoreo 2022-04-22 00:59:19 -05:00
parent 3c9f6d0e01
commit 3780ab8142
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me>
Date: Fri, 22 Apr 2022 00:59:00 -0500
Subject: [PATCH] Fixes the Blank SkullOwner exploit
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 292ae4a68093b7d939a755e1062cee57da186ab1..4ae030580131252b849fd356717d0323c29cf773 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -7,6 +7,9 @@ import java.util.UUID;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
+// Scissors start
+import org.apache.commons.lang3.StringUtils;
+// Scissors end
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
@@ -45,7 +48,9 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT)));
- } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(SKULL_OWNER.NBT).isEmpty()) {
+ // Scissors start
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) {
+ // Scissors end
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
}
}