aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch
blob: 327879d17d2d8313fed9eae7f880f3a5eb0d3ada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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

diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 726bb3fcb25321d80caa5967cca86733a234b939..1e73010b292b4d46daaa33ea5b9480bf00944390 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -557,7 +557,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
     public boolean enforceSecureProfile() {
         DedicatedServerProperties dedicatedserverproperties = this.getProperties();
 
-        return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.canValidateProfileKeys();
+        // Paper start - Add setting for proxy online mode status
+        return dedicatedserverproperties.enforceSecureProfile
+            && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
+            && this.services.canValidateProfileKeys();
+        // Paper end - Add setting for proxy online mode status
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 3c9c6a697143c7e980add58576ad288b8f51ae35..92c22dc10e385f1942f2ec375bbce9faf257462b 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -89,7 +89,8 @@ public class GameProfileCache {
                 }
             };
 
-        if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name
+        if (!org.apache.commons.lang3.StringUtils.isBlank(name) // Paper - Don't lookup a profile with a blank name
+                && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) // Paper - Add setting for proxy online mode status
             repository.findProfilesByNames(new String[]{name}, profilelookupcallback);
             GameProfile gameprofile = (GameProfile) atomicreference.get();
 
@@ -106,7 +107,7 @@ public class GameProfileCache {
     }
 
     private static boolean usesAuthentication() {
-        return GameProfileCache.usesAuthentication;
+        return io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode(); // Paper - Add setting for proxy online mode status
     }
 
     public void add(GameProfile profile) {
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index 9143ce01650b51e7f6a677c5941ade91a506449f..86c88e81e275d52576122a5083b419e64cb011fc 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -65,7 +65,8 @@ public class OldUsersConverter {
             return new String[i];
         });
 
-        if (server.usesAuthentication() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.
+        if (server.usesAuthentication() ||
+            (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode())) { // Spigot: bungee = online mode, for now.  // Paper - Add setting for proxy online mode status
             server.getProfileRepository().findProfilesByNames(astring, 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 ec7f1845e7d547761efb070bbd91d921f71a0509..edf6fb3db243e4c9b28641504e383f0b03e672d2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1821,7 +1821,7 @@ public final class CraftServer implements Server {
         if (result == null) {
             GameProfile profile = null;
             // Only fetch an online UUID in online mode
-            if (this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.
+            if (this.getOnlineMode() || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) { // Paper - Add setting for proxy online mode status
                 // This is potentially blocking :(
                 profile = this.console.getProfileCache().get(name).orElse(null);
             }