Use access transformers for player profile API (#7468)

This commit is contained in:
Bjarne Koll 2022-02-18 18:30:37 +01:00
parent bf59b03506
commit 9425b30b18
2 changed files with 12 additions and 80 deletions

View file

@ -267,8 +267,17 @@ public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES
# Optimize isValidLocation # Optimize isValidLocation
public net.minecraft.world.level.chunk.LevelChunkSection states public net.minecraft.world.level.chunk.LevelChunkSection states
# Player.setPlayerProfile API # Player Profile API
public-f net.minecraft.world.entity.player.Player gameProfile public-f net.minecraft.world.entity.player.Player gameProfile
public org.bukkit.craftbukkit.profile.CraftProfileProperty
public org.bukkit.craftbukkit.profile.CraftPlayerTextures
public org.bukkit.craftbukkit.profile.CraftPlayerTextures copyFrom(Lorg/bukkit/profile/PlayerTextures;)V
public org.bukkit.craftbukkit.profile.CraftPlayerTextures rebuildPropertyIfDirty()V
public org.bukkit.craftbukkit.profile.CraftPlayerProfile getProperty(Ljava/lang/String;)Lcom/mojang/authlib/properties/Property;
public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/String;Lcom/mojang/authlib/properties/Property;)V
public org.bukkit.craftbukkit.profile.CraftPlayerProfile toString(Lcom/mojang/authlib/properties/PropertyMap;)Ljava/lang/String;
public org.bukkit.craftbukkit.profile.CraftPlayerProfile equals(Lcom/mojang/authlib/properties/PropertyMap;Lcom/mojang/authlib/properties/PropertyMap;)Z
public org.bukkit.craftbukkit.profile.CraftPlayerProfile hashCode(Lcom/mojang/authlib/properties/PropertyMap;)I
# Generator Settings # Generator Settings
public net.minecraft.world.level.levelgen.SurfaceRules$Condition public net.minecraft.world.level.levelgen.SurfaceRules$Condition

View file

@ -676,20 +676,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nonnull @Nonnull
public static GameProfile validateSkullProfile(@Nonnull GameProfile gameProfile) { public static GameProfile validateSkullProfile(@Nonnull GameProfile gameProfile) {
@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile {
}
@Nullable
- Property getProperty(String propertyName) {
+ public Property getProperty(String propertyName) { // Paper - public
return Iterables.getFirst(this.properties.get(propertyName), null);
}
- void setProperty(String propertyName, @Nullable Property property) {
+ public void setProperty(String propertyName, @Nullable Property property) { // Paper - public
// Assert: (property == null) || property.getName().equals(propertyName)
this.removeProperty(propertyName);
if (property != null) {
@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile {
} }
} }
@ -704,33 +690,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
void rebuildDirtyProperties() { void rebuildDirtyProperties() {
@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile {
return builder.toString();
}
- private static String toString(@Nonnull PropertyMap propertyMap) {
+ public static String toString(@Nonnull PropertyMap propertyMap) { // Paper - public
StringBuilder builder = new StringBuilder();
builder.append("{");
propertyMap.asMap().forEach((propertyName, properties) -> {
@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile {
return true;
}
- private static boolean equals(@Nonnull PropertyMap propertyMap, @Nonnull PropertyMap other) {
+ public static boolean equals(@Nonnull PropertyMap propertyMap, @Nonnull PropertyMap other) { // Paper - public
if (propertyMap.size() != other.size()) return false;
// We take the order of properties into account here, because it is
// also relevant in the serialized and NBT forms of GameProfiles.
@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile {
return result;
}
- private static int hashCode(PropertyMap propertyMap) {
+ public static int hashCode(PropertyMap propertyMap) { // Paper - public
int result = 1;
for (Property property : propertyMap.values()) {
result = 31 * result + CraftProfileProperty.hashCode(property);
@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile {
@Override @Override
public Map<String, Object> serialize() { public Map<String, Object> serialize() {
@ -764,16 +723,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerTextures.ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerTextures.java --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerTextures.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerTextures.java +++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerTextures.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -0,0 +0,0 @@ public final class CraftPlayerTextures implements PlayerTextures {
import org.bukkit.craftbukkit.util.JsonHelper;
import org.bukkit.profile.PlayerTextures;
-final class CraftPlayerTextures implements PlayerTextures {
+public final class CraftPlayerTextures implements PlayerTextures { // Paper - public
static final String PROPERTY_NAME = "textures";
private static final String MINECRAFT_HOST = "textures.minecraft.net";
@@ -0,0 +0,0 @@ final class CraftPlayerTextures implements PlayerTextures {
} }
} }
@ -782,7 +732,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// The textures data is loaded lazily: // The textures data is loaded lazily:
private boolean loaded = false; private boolean loaded = false;
@@ -0,0 +0,0 @@ final class CraftPlayerTextures implements PlayerTextures { @@ -0,0 +0,0 @@ public final class CraftPlayerTextures implements PlayerTextures {
// GameProfiles (even if these modifications are later reverted). // GameProfiles (even if these modifications are later reverted).
private boolean dirty = false; private boolean dirty = false;
@ -791,30 +741,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.profile = profile; this.profile = profile;
} }
- void copyFrom(@Nonnull PlayerTextures other) {
+ public void copyFrom(@Nonnull PlayerTextures other) { // Paper - public
if (other == this) return;
Preconditions.checkArgument(other instanceof CraftPlayerTextures, "Expecting CraftPlayerTextures, got %s", other.getClass().getName());
CraftPlayerTextures otherTextures = (CraftPlayerTextures) other;
@@ -0,0 +0,0 @@ final class CraftPlayerTextures implements PlayerTextures {
return this.profile.getProperty(PROPERTY_NAME);
}
- void rebuildPropertyIfDirty() {
+ public void rebuildPropertyIfDirty() { // Paper - public
if (!this.dirty) return;
// Assert: loaded
this.dirty = false;
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftProfileProperty.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftProfileProperty.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftProfileProperty.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftProfileProperty.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import org.apache.commons.io.IOUtils;
import org.bukkit.craftbukkit.configuration.ConfigSerializationUtil;
-final class CraftProfileProperty {
+public final class CraftProfileProperty { // Paper - public
/**
* Different JSON formatting styles to use for encoded property values.