Paper/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch

82 lines
4.2 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com>
Date: Fri, 5 Aug 2016 01:03:08 +0200
Subject: [PATCH] Add setting for proxy online mode status
TODO: Add isProxyOnlineMode check to Metrics
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 1b8e5671c9dc8c15ce33d351c1bb20f28919b9a2..c52dc0346f93527965ef29a0ccdc4bf3debe302e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -23,6 +23,7 @@ import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import co.aikar.timings.Timings;
import co.aikar.timings.TimingsManager;
+import org.spigotmc.SpigotConfig;
public class PaperConfig {
@@ -242,4 +243,13 @@ public class PaperConfig {
private static void saveEmptyScoreboardTeams() {
saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false);
}
+
+ public static boolean bungeeOnlineMode = true;
+ private static void bungeeOnlineMode() {
+ bungeeOnlineMode = getBoolean("settings.bungee-online-mode", true);
+ }
+
+ public static boolean isProxyOnlineMode() {
+ return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode);
+ }
}
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 87f5f4108796aa12b454bbf39b8c1d699bac78f2..3eb4bee81a8543cc06b9d5898f5f6c0e9dbbf554 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
2021-06-12 08:02:49 +02:00
@@ -97,6 +97,7 @@ public class GameProfileCache {
2021-06-11 14:02:28 +02:00
}
};
+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) // Paper - only run in online mode - 100 COL
repository.findProfilesByNames(new String[]{name}, Agent.MINECRAFT, profilelookupcallback);
GameProfile gameprofile = (GameProfile) atomicreference.get();
2021-06-12 08:02:49 +02:00
@@ -114,7 +115,7 @@ public class GameProfileCache {
2021-06-11 14:02:28 +02:00
}
private static boolean usesAuthentication() {
- return GameProfileCache.usesAuthentication;
+ return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper
}
2021-06-12 08:02:49 +02:00
public synchronized void add(GameProfile profile) { // Paper - synchronize
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index 8e27b43e2f6ce4d7f5007fe02db1722e73c30a58..6aacc724c8c8d6fbe3067226989039ca9cee4929 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
2021-06-12 08:02:49 +02:00
@@ -65,7 +65,8 @@ public class OldUsersConverter {
2021-06-11 14:02:28 +02:00
return new String[i];
});
- if (server.usesAuthentication() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.
+ if (server.usesAuthentication()
+ || (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode())) { // Spigot: bungee = online mode, for now. // Paper - Handle via setting
server.getProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback);
} else {
String[] astring1 = astring;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 568777b6cad6f87f1ad7be361ebe47a6bc55cb2d..6387f01a9aeb72817988d1609188ca20b5ca4f6e 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1516,7 +1516,7 @@ public final class CraftServer implements Server {
2021-06-11 14:02:28 +02:00
// Spigot Start
GameProfile profile = null;
// Only fetch an online UUID in online mode
2021-06-12 08:02:49 +02:00
- if ( this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ if ( this.getOnlineMode() || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
2021-06-11 14:02:28 +02:00
{
profile = this.console.getProfileCache().get( name );
2021-06-11 14:02:28 +02:00
}