Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -15,21 +15,21 @@
@@ -16,7 +21,19 @@
}
public boolean a(ItemStack itemstack) {
- return this.key.isEmpty() || !itemstack.isEmpty() && itemstack.hasName() && this.key.equals(itemstack.getName().getString());
public boolean unlocksWith(ItemStack itemstack) {
- return this.key.isEmpty() || !itemstack.isEmpty() && itemstack.hasCustomHoverName() && this.key.equals(itemstack.getHoverName().getString());
+ // CraftBukkit start - SPIGOT-6307: Check for color codes if the lock contains color codes
+ if (this.key.isEmpty()) return true;
+ if (!itemstack.isEmpty() && itemstack.hasName()) {
+ if (!itemstack.isEmpty() && itemstack.hasCustomHoverName()) {
+ if (this.key.indexOf(ChatColor.COLOR_CHAR) == -1) {
+ // The lock key contains no color codes, so let's ignore colors in the item display name (vanilla Minecraft behavior):
+ return this.key.equals(itemstack.getName().getString());
+ return this.key.equals(itemstack.getHoverName().getString());
+ } else {
+ // The lock key contains color codes, so let's take them into account:
+ return this.key.equals(CraftChatMessage.fromComponent(itemstack.getName()));
+ return this.key.equals(CraftChatMessage.fromComponent(itemstack.getHoverName()));
+ }
+ }
+ return false;
+ // CraftBukkit end
}
public void a(NBTTagCompound nbttagcompound) {
public void addToTag(NBTTagCompound nbttagcompound) {