Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11405)
Upstream has released updates that appear 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: 1fc1020a PR-1049: Add MenuType API 8ae2e3be PR-1055: Expand riptiding API cac68bfb SPIGOT-7890: AttributeModifier#getUniqueId() doesn't match the UUID passed to its constructor 7004fcf2 SPIGOT-7886: Fix mistake in AttributeModifier UUID shim 1ac7f950 PR-1054: Add FireworkMeta#hasPower 4cfb565f SPIGOT-7873: Add powered state for skulls CraftBukkit Changes: bbb30e7a8 SPIGOT-7894: NPE when sending tile entity update ba21e9472 SPIGOT-7895: PlayerItemBreakEvent not firing 0fb24bbe0 SPIGOT-7875: Fix PlayerItemConsumeEvent cancellation causing client-side desync 815066449 SPIGOT-7891: Can't remove second ingredient of MerchantRecipe 45c206f2c PR-1458: Add MenuType API 19c8ef9ae SPIGOT-7867: Merchant instanceof AbstractVillager always returns false 4e006d28f PR-1468: Expand riptiding API bd8aded7d Ignore checks in CraftPlayerProfile for ResolvableProfile used in profile components 8679620b5 SPIGOT-7889: Fix tool component deserialisation without speed and/or correct-for-drops 8d5222691 SPIGOT-7882, PR-1467: Fix conversion of name in Profile Component to empty if it is missing 63f91669a SPIGOT-7887: Remove duplicate ProjectileHitEvent for fireballs 7070de8c8 SPIGOT-7878: Server#getLootTable does not return null on invalid loot table 060ee6cae SPIGOT-7876: Can't kick player or disconnect player in PlayerLoginEvent when checking for cookies 7ccb86cc0 PR-1465: Add FireworkMeta#hasPower 804ad6491 SPIGOT-7873: Add powered state for skulls f9610cdcb Improve minecart movement Spigot Changes: a759b629 Rebuild patches Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
parent
4ff58c4c48
commit
d1a72eac31
684 changed files with 864 additions and 837 deletions
|
@ -16,10 +16,10 @@ public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980efd65eb9a1
|
||||
index 0000000000000000000000000000000000000000..23181027bb077417655913c29377bed720c9e9c1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
@@ -0,0 +1,422 @@
|
||||
@@ -0,0 +1,449 @@
|
||||
+package com.destroystokyo.paper.profile;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
|
@ -34,6 +34,7 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.players.GameProfileCache;
|
||||
+import net.minecraft.util.StringUtil;
|
||||
+import net.minecraft.world.item.component.ResolvableProfile;
|
||||
+import org.apache.commons.lang3.StringUtils;
|
||||
+import org.apache.commons.lang3.Validate;
|
||||
+import org.bukkit.configuration.serialization.SerializableAs;
|
||||
|
@ -52,6 +53,8 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+@SerializableAs("PlayerProfile")
|
||||
+public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
||||
+
|
||||
+ private boolean emptyName;
|
||||
+ private boolean emptyUUID;
|
||||
+ private GameProfile profile;
|
||||
+ private final PropertySet properties = new PropertySet();
|
||||
+
|
||||
|
@ -61,6 +64,8 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+
|
||||
+ public CraftPlayerProfile(UUID id, String name) {
|
||||
+ this.profile = createAuthLibProfile(id, name);
|
||||
+ this.emptyName = name == null;
|
||||
+ this.emptyUUID = id == null;
|
||||
+ }
|
||||
+
|
||||
+ public CraftPlayerProfile(GameProfile profile) {
|
||||
|
@ -68,6 +73,11 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ this.profile = profile;
|
||||
+ }
|
||||
+
|
||||
+ public CraftPlayerProfile(ResolvableProfile resolvableProfile) {
|
||||
+ this(resolvableProfile.id().orElse(null), resolvableProfile.name().orElse(null));
|
||||
+ copyProfileProperties(resolvableProfile.gameProfile(), this.profile);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasProperty(String property) {
|
||||
+ return profile.getProperties().containsKey(property);
|
||||
|
@ -106,7 +116,7 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ @Nullable
|
||||
+ @Override
|
||||
+ public UUID getId() {
|
||||
+ return profile.getId().equals(Util.NIL_UUID) ? null : profile.getId();
|
||||
+ return this.emptyUUID ? null : this.profile.getId();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -116,6 +126,7 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ final UUID previousId = this.getId();
|
||||
+ this.profile = createAuthLibProfile(uuid, previousProfile.getName());
|
||||
+ copyProfileProperties(previousProfile, this.profile);
|
||||
+ this.emptyUUID = uuid == null;
|
||||
+ return previousId;
|
||||
+ }
|
||||
+
|
||||
|
@ -127,7 +138,7 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ @Nullable
|
||||
+ @Override
|
||||
+ public String getName() {
|
||||
+ return profile.getName();
|
||||
+ return this.emptyName ? null : this.profile.getName();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -136,6 +147,7 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ GameProfile prev = this.profile;
|
||||
+ this.profile = createAuthLibProfile(prev.getId(), name);
|
||||
+ copyProfileProperties(prev, this.profile);
|
||||
+ this.emptyName = name == null;
|
||||
+ return prev.getName();
|
||||
+ }
|
||||
+
|
||||
|
@ -184,6 +196,15 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull ResolvableProfile buildResolvableProfile() {
|
||||
+ if (this.emptyName || this.emptyUUID) {
|
||||
+ return new ResolvableProfile(this.emptyName ? Optional.empty() : Optional.of(this.profile.getName()), this.emptyUUID ? Optional.empty() : Optional.of(this.profile.getId()), this.profile.getProperties());
|
||||
+ } else {
|
||||
+ return new ResolvableProfile(this.buildGameProfile());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public CraftPlayerProfile clone() {
|
||||
+ CraftPlayerProfile clone = new CraftPlayerProfile(this.getId(), this.getName());
|
||||
+ clone.setProperties(getProperties());
|
||||
|
@ -251,6 +272,7 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ public boolean complete(boolean textures) {
|
||||
+ return complete(textures, GlobalConfiguration.get().proxies.isProxyOnlineMode());
|
||||
+ }
|
||||
+
|
||||
+ public boolean complete(boolean textures, boolean onlineMode) {
|
||||
+ if (this.isComplete() && (!textures || hasTextures())) { // Don't do lookup if we already have everything
|
||||
+ return true;
|
||||
|
@ -328,6 +350,10 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ return craft.getGameProfile();
|
||||
+ }
|
||||
+
|
||||
+ public static ResolvableProfile asResolvableProfileCopy(PlayerProfile profile) {
|
||||
+ return ((SharedPlayerProfile) profile).buildResolvableProfile();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Map<String, Object> serialize() {
|
||||
+ Map<String, Object> map = new LinkedHashMap<>();
|
||||
|
@ -368,10 +394,16 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object obj) {
|
||||
+ if (this == obj) return true;
|
||||
+ if (!(obj instanceof CraftPlayerProfile otherProfile)) return false;
|
||||
+ return Objects.equals(this.profile, otherProfile.profile);
|
||||
+ public boolean equals(final Object o) {
|
||||
+ if (this == o) return true;
|
||||
+ if (o == null || this.getClass() != o.getClass()) return false;
|
||||
+ final CraftPlayerProfile that = (CraftPlayerProfile) o;
|
||||
+ return this.emptyName == that.emptyName && this.emptyUUID == that.emptyUUID && Objects.equals(this.profile, that.profile);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return Objects.hash(this.emptyName, this.emptyUUID, this.profile);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -382,11 +414,6 @@ index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980ef
|
|||
+ "]";
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return this.profile.hashCode();
|
||||
+ }
|
||||
+
|
||||
+ private class PropertySet extends AbstractSet<ProfileProperty> {
|
||||
+
|
||||
+ @Override
|
||||
|
@ -531,14 +558,15 @@ index 0000000000000000000000000000000000000000..985e6fc43a0946943847e0c283426242
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/SharedPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/SharedPlayerProfile.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e993885017
|
||||
index 0000000000000000000000000000000000000000..332700f84c5587e47a4d2056bfbb5413de97e9f2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/SharedPlayerProfile.java
|
||||
@@ -0,0 +1,23 @@
|
||||
@@ -0,0 +1,26 @@
|
||||
+package com.destroystokyo.paper.profile;
|
||||
+
|
||||
+import com.mojang.authlib.GameProfile;
|
||||
+import com.mojang.authlib.properties.Property;
|
||||
+import net.minecraft.world.item.component.ResolvableProfile;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
|
@ -557,6 +585,8 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9
|
|||
+ @Nullable void setProperty(@NotNull String propertyName, @Nullable Property property);
|
||||
+
|
||||
+ @NotNull GameProfile buildGameProfile();
|
||||
+
|
||||
+ @NotNull ResolvableProfile buildResolvableProfile();
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 6afede80c10503a261d0f735c351d943597be9ff..993296f9c2457809bd6b844c309895f417eb42a5 100644
|
||||
|
@ -594,7 +624,7 @@ index 416b26c2ab62b29d640169166980e398d5824b14..774d81c702edb76a2f6184d4dc53687d
|
|||
String s1 = name.toLowerCase(Locale.ROOT);
|
||||
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 1fd2f6053e660674baa239f142a720d59e64c776..5ab2836f14e1a7482e7136004507d66c4abb4bdd 100644
|
||||
index 16110e41480ad4508e56c196c551debdf0e96811..c5618c1a773442c9c016b67ea64d83f8efcb3b89 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -262,6 +262,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
|
||||
|
@ -615,7 +645,7 @@ index 1fd2f6053e660674baa239f142a720d59e64c776..5ab2836f14e1a7482e7136004507d66c
|
|||
CraftItemFactory.instance();
|
||||
CraftEntityFactory.instance();
|
||||
}
|
||||
@@ -2843,5 +2847,39 @@ public final class CraftServer implements Server {
|
||||
@@ -2840,5 +2844,39 @@ public final class CraftServer implements Server {
|
||||
public boolean suggestPlayerNamesWhenNullTabCompletions() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
|
||||
}
|
||||
|
@ -656,11 +686,11 @@ index 1fd2f6053e660674baa239f142a720d59e64c776..5ab2836f14e1a7482e7136004507d66c
|
|||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
index c49db689827b20ad211f06b9bad7062c8ef82c68..ce30a8853d5095ce5bf1ec902b41d27db9e35b4f 100644
|
||||
index 210fdad5f2041368fc359b275f1cbf05b70b6989..d9cc76d7e60001957c0f59fdc32d016f3589aa08 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
@@ -28,7 +28,7 @@ import org.bukkit.profile.PlayerProfile;
|
||||
import org.bukkit.profile.PlayerTextures;
|
||||
@@ -31,7 +31,7 @@ import org.bukkit.profile.PlayerTextures;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@SerializableAs("PlayerProfile")
|
||||
-public final class CraftPlayerProfile implements PlayerProfile {
|
||||
|
@ -668,7 +698,7 @@ index c49db689827b20ad211f06b9bad7062c8ef82c68..ce30a8853d5095ce5bf1ec902b41d27d
|
|||
|
||||
@Nonnull
|
||||
public static GameProfile validateSkullProfile(@Nonnull GameProfile gameProfile) {
|
||||
@@ -107,8 +107,10 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
@@ -132,8 +132,10 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -681,16 +711,16 @@ index c49db689827b20ad211f06b9bad7062c8ef82c68..ce30a8853d5095ce5bf1ec902b41d27d
|
|||
}
|
||||
|
||||
void rebuildDirtyProperties() {
|
||||
@@ -251,6 +253,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
@@ -283,6 +285,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
+ // Paper - diff on change
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if (this.getUniqueId() != null) {
|
||||
map.put("uniqueId", this.getUniqueId().toString());
|
||||
@@ -266,10 +269,12 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
});
|
||||
if (this.uniqueId != null) {
|
||||
map.put("uniqueId", this.uniqueId.toString());
|
||||
@@ -296,10 +299,12 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
this.properties.forEach((propertyName, property) -> propertiesData.add(CraftProfileProperty.serialize(property)));
|
||||
map.put("properties", propertiesData);
|
||||
}
|
||||
+ // Paper - diff on change
|
||||
|
@ -702,7 +732,7 @@ index c49db689827b20ad211f06b9bad7062c8ef82c68..ce30a8853d5095ce5bf1ec902b41d27d
|
|||
UUID uniqueId = ConfigSerializationUtil.getUuid(map, "uniqueId", true);
|
||||
String name = ConfigSerializationUtil.getString(map, "name", true);
|
||||
|
||||
@@ -283,7 +288,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
@@ -313,7 +318,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
profile.properties.put(property.name(), property);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue