mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
e4d10a6d67
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 122289ff Add FaceAttachable interface to handle Grindstone facing in common with Switches a6db750e SPIGOT-5647: ZombieVillager entity should have getVillagerType() CraftBukkit Changes:bbe3d58e
SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException3075579f
Add FaceAttachable interface to handle Grindstone facing in common with Switches95bd4238
SPIGOT-5647: ZombieVillager entity should have getVillagerType()4d975ac3
SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current
33 lines
1.6 KiB
Diff
33 lines
1.6 KiB
Diff
From 61ba1e4e6a02527b8bd1e309d69341df4737cdcc Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach@zachbr.io>
|
|
Date: Thu, 6 Feb 2020 19:20:27 -0600
|
|
Subject: [PATCH] Be more tolerant of invalid attributes
|
|
|
|
Prior to this commit, the player would be disconnected if they ever encountered an attribute with a name that did
|
|
not match Bukkit's expected vanilla scheme. It appears that datapacks can set whatever attribute name they want,
|
|
ignoring vanilla's typical scheme.
|
|
|
|
In a more perfect world the API would expose some way to interact with these attributes, however Bukkit is not
|
|
particularly flexible in this area. Perhaps this is an area for future expansion at a later time.
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
|
|
index 77e584b129..007d28b16c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
|
|
@@ -47,6 +47,12 @@ public class CraftAttributeMap implements Attributable {
|
|
public static Attribute fromMinecraft(String nms) {
|
|
String[] split = nms.split("\\.", 2);
|
|
|
|
+ // Paper start - Datapacks can set their own attributes that may not match our expectations, ignore them
|
|
+ if (split.length != 2) {
|
|
+ return null;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
String generic = split[0];
|
|
String descriptor = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, split[1]); // movementSpeed -> MOVEMENT_SPEED
|
|
String fin = generic + "_" + descriptor;
|
|
--
|
|
2.25.1
|
|
|