mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-03 21:52:05 -07:00
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:
@@ -34,6 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+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..00000000000000000000000000000000
|
||||
+@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..00000000000000000000000000000000
|
||||
+
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ @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..00000000000000000000000000000000
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public String getName() {
|
||||
+ return profile.getName();
|
||||
+ return this.emptyName ? null : this.profile.getName();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -136,6 +147,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @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..00000000000000000000000000000000
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ 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..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @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..00000000000000000000000000000000
|
||||
+ "]";
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return this.profile.hashCode();
|
||||
+ }
|
||||
+
|
||||
+ private class PropertySet extends AbstractSet<ProfileProperty> {
|
||||
+
|
||||
+ @Override
|
||||
@@ -539,6 +566,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+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..00000000000000000000000000000000
|
||||
+ @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@@ -659,8 +689,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.profile.PlayerProfile;
|
||||
import org.bukkit.profile.PlayerTextures;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.profile.PlayerTextures;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@SerializableAs("PlayerProfile")
|
||||
-public final class CraftPlayerProfile implements PlayerProfile {
|
||||
@@ -687,10 +717,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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());
|
||||
if (this.uniqueId != null) {
|
||||
map.put("uniqueId", this.uniqueId.toString());
|
||||
@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
||||
});
|
||||
this.properties.forEach((propertyName, property) -> propertiesData.add(CraftProfileProperty.serialize(property)));
|
||||
map.put("properties", propertiesData);
|
||||
}
|
||||
+ // Paper - diff on change
|
||||
|
Reference in New Issue
Block a user