1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-23 21:20:42 +01:00

some more compile fixes

This commit is contained in:
MiniDigger | Martin 2023-09-22 19:43:52 +02:00
parent 65e89bf179
commit 3f4950410d
3 changed files with 24 additions and 13 deletions

View file

@ -23,6 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.mojang.authlib.yggdrasil.ProfileResult;
+import io.papermc.paper.configuration.GlobalConfiguration; +import io.papermc.paper.configuration.GlobalConfiguration;
+import com.google.common.base.Charsets; +import com.google.common.base.Charsets;
+import com.google.common.collect.Iterables; +import com.google.common.collect.Iterables;
@ -32,6 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.Util; +import net.minecraft.Util;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.players.GameProfileCache; +import net.minecraft.server.players.GameProfileCache;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.Validate;
+import org.bukkit.configuration.serialization.SerializableAs; +import org.bukkit.configuration.serialization.SerializableAs;
+import org.bukkit.craftbukkit.configuration.ConfigSerializationUtil; +import org.bukkit.craftbukkit.configuration.ConfigSerializationUtil;
@ -186,7 +188,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public boolean isComplete() { + public boolean isComplete() {
+ return profile.isComplete(); + return this.getId() != null && StringUtils.isNotBlank(this.getName());
+ } + }
+ +
+ @Override + @Override
@ -239,7 +241,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } + }
+ } + }
+ return this.profile.isComplete(); + return this.isComplete();
+ } + }
+ +
+ public boolean complete(boolean textures) { + public boolean complete(boolean textures) {
@ -249,15 +251,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ MinecraftServer server = MinecraftServer.getServer(); + MinecraftServer server = MinecraftServer.getServer();
+ boolean isCompleteFromCache = this.completeFromCache(true, onlineMode); + boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
+ if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) { + if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
+ GameProfile result = server.getSessionService().fillProfileProperties(profile, true); + ProfileResult result = server.getSessionService().fetchProfile(this.getId(), true);
+ if (result != null) { + if (result != null && result.profile() != null) {
+ copyProfileProperties(result, this.profile, true); + copyProfileProperties(result.profile(), this.profile, true);
+ } + }
+ if (this.profile.isComplete()) { + if (this.isComplete()) {
+ server.getProfileCache().add(this.profile); + server.getProfileCache().add(this.profile);
+ } + }
+ } + }
+ return profile.isComplete() && (!onlineMode || !textures || hasTextures()); + return this.isComplete() && (!onlineMode || !textures || hasTextures());
+ } + }
+ +
+ private static void copyProfileProperties(GameProfile source, GameProfile target) { + private static void copyProfileProperties(GameProfile source, GameProfile target) {
@ -273,13 +275,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ for (Property property : sourceProperties.values()) { + for (Property property : sourceProperties.values()) {
+ targetProperties.removeAll(property.getName()); + targetProperties.removeAll(property.name());
+ targetProperties.put(property.getName(), property); + targetProperties.put(property.name(), property);
+ } + }
+ } + }
+ +
+ private static ProfileProperty toBukkit(Property property) { + private static ProfileProperty toBukkit(Property property) {
+ return new ProfileProperty(property.getName(), property.getValue(), property.getSignature()); + return new ProfileProperty(property.name(), property.value(), property.signature());
+ } + }
+ +
+ public static PlayerProfile asBukkitCopy(GameProfile gameProfile) { + public static PlayerProfile asBukkitCopy(GameProfile gameProfile) {
@ -338,7 +340,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ throw new IllegalArgumentException("Property data (" + propertyData + ") is not a valid Map"); + throw new IllegalArgumentException("Property data (" + propertyData + ") is not a valid Map");
+ } + }
+ Property property = CraftProfileProperty.deserialize((Map<?, ?>) propertyData); + Property property = CraftProfileProperty.deserialize((Map<?, ?>) propertyData);
+ profile.profile.getProperties().put(property.getName(), property); + profile.profile.getProperties().put(property.name(), property);
+ } + }
+ } + }
+ +

View file

@ -2898,14 +2898,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) { + public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) {
+ final ChunkMap chunkMap = level.chunkSource.chunkMap; + final ChunkMap chunkMap = level.chunkSource.chunkMap;
+ for (int index = 0, len = chunkMap.regionManagers.size(); index < len; ++index) { + for (int index = 0, len = chunkMap.regionManagers.size(); index < len; ++index) {
+ chunkMap.regionManagers.get(index).addChunk(holder.pos.x, holder.pos.z); + chunkMap.regionManagers.get(index).addChunk(holder.getPos().x, holder.getPos().z);
+ } + }
+ } + }
+ +
+ public static void onChunkHolderDelete(final ServerLevel level, final ChunkHolder holder) { + public static void onChunkHolderDelete(final ServerLevel level, final ChunkHolder holder) {
+ final ChunkMap chunkMap = level.chunkSource.chunkMap; + final ChunkMap chunkMap = level.chunkSource.chunkMap;
+ for (int index = 0, len = chunkMap.regionManagers.size(); index < len; ++index) { + for (int index = 0, len = chunkMap.regionManagers.size(); index < len; ++index) {
+ chunkMap.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); + chunkMap.regionManagers.get(index).removeChunk(holder.getPos().x, holder.getPos().z);
+ } + }
+ } + }
+ +

View file

@ -39,6 +39,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static final GameRules.Key<GameRules.BooleanValue> RULE_REDUCEDDEBUGINFO = GameRules.register("reducedDebugInfo", GameRules.Category.MISC, GameRules.BooleanValue.create(false, (minecraftserver, gamerules_gameruleboolean) -> { public static final GameRules.Key<GameRules.BooleanValue> RULE_REDUCEDDEBUGINFO = GameRules.register("reducedDebugInfo", GameRules.Category.MISC, GameRules.BooleanValue.create(false, (minecraftserver, gamerules_gameruleboolean) -> {
int i = gamerules_gameruleboolean.get() ? 22 : 23; int i = gamerules_gameruleboolean.get() ? 22 : 23;
- Iterator iterator = minecraftserver.getPlayerList().getPlayers().iterator(); - Iterator iterator = minecraftserver.getPlayerList().getPlayers().iterator();
+ Iterator iterator = minecraftserver.players().iterator(); // Paper
while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
@@ -0,0 +0,0 @@ public class GameRules {
public static final GameRules.Key<GameRules.IntegerValue> RULE_MAX_ENTITY_CRAMMING = GameRules.register("maxEntityCramming", GameRules.Category.MOBS, GameRules.IntegerValue.create(24));
public static final GameRules.Key<GameRules.BooleanValue> RULE_WEATHER_CYCLE = GameRules.register("doWeatherCycle", GameRules.Category.UPDATES, GameRules.BooleanValue.create(true));
public static final GameRules.Key<GameRules.BooleanValue> RULE_LIMITED_CRAFTING = GameRules.register("doLimitedCrafting", GameRules.Category.PLAYER, GameRules.BooleanValue.create(false, (minecraftserver, gamerules_gameruleboolean) -> {
- Iterator iterator = minecraftserver.getPlayerList().getPlayers().iterator();
+ Iterator iterator = minecraftserver.players().iterator(); // Paper + Iterator iterator = minecraftserver.players().iterator(); // Paper
while (iterator.hasNext()) { while (iterator.hasNext()) {