mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Add setting for proxy online mode status
TODO: Add isProxyOnlineMode check to Metrics
This commit is contained in:
parent
a55727ff06
commit
f7ae11f984
4 changed files with 53 additions and 27 deletions
|
@ -233,19 +233,20 @@
|
|||
Thread thread1 = new Thread(new ServerWatchdog(this));
|
||||
|
||||
thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(DedicatedServer.LOGGER));
|
||||
@@ -215,6 +318,12 @@
|
||||
}
|
||||
}
|
||||
@@ -213,7 +316,13 @@
|
||||
|
||||
return true;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ // Paper start
|
||||
+ public java.io.File getPluginsFolder() {
|
||||
+ return (java.io.File) this.options.valueOf("plugins");
|
||||
+ }
|
||||
}
|
||||
+ // Paper end
|
||||
+
|
||||
|
||||
@Override
|
||||
public boolean isSpawningMonsters() {
|
||||
return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters();
|
||||
@@ -293,6 +402,7 @@
|
||||
this.queryThreadGs4.stop();
|
||||
}
|
||||
|
@ -291,7 +292,20 @@
|
|||
return false;
|
||||
} else if (this.getPlayerList().getOps().isEmpty()) {
|
||||
return false;
|
||||
@@ -541,16 +659,52 @@
|
||||
@@ -453,7 +571,11 @@
|
||||
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
|
||||
@@ -541,16 +663,52 @@
|
||||
|
||||
@Override
|
||||
public String getPluginNames() {
|
||||
|
@ -348,7 +362,7 @@
|
|||
}
|
||||
|
||||
public void storeUsingWhiteList(boolean useWhitelist) {
|
||||
@@ -660,4 +814,15 @@
|
||||
@@ -660,4 +818,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/players/GameProfileCache.java
|
||||
+++ b/net/minecraft/server/players/GameProfileCache.java
|
||||
@@ -85,10 +85,11 @@
|
||||
@@ -85,10 +85,12 @@
|
||||
}
|
||||
|
||||
public void onProfileLookupFailed(String s1, Exception exception) {
|
||||
|
@ -9,11 +9,21 @@
|
|||
}
|
||||
};
|
||||
|
||||
+ 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();
|
||||
|
||||
@@ -117,7 +118,7 @@
|
||||
@@ -105,7 +107,7 @@
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -117,7 +119,7 @@
|
||||
GameProfileCache.GameProfileInfo usercache_usercacheentry = new GameProfileCache.GameProfileInfo(profile, date);
|
||||
|
||||
this.safeAdd(usercache_usercacheentry);
|
||||
|
@ -22,7 +32,7 @@
|
|||
}
|
||||
|
||||
private long getNextOperation() {
|
||||
@@ -142,15 +143,15 @@
|
||||
@@ -142,15 +144,15 @@
|
||||
usercache_usercacheentry.setLastAccess(this.getNextOperation());
|
||||
optional = Optional.of(usercache_usercacheentry.getProfile());
|
||||
} else {
|
||||
|
@ -41,7 +51,7 @@
|
|||
}
|
||||
|
||||
return optional;
|
||||
@@ -208,7 +209,7 @@
|
||||
@@ -208,7 +210,7 @@
|
||||
|
||||
label54:
|
||||
{
|
||||
|
@ -50,7 +60,7 @@
|
|||
|
||||
try {
|
||||
JsonArray jsonarray = (JsonArray) this.gson.fromJson(bufferedreader, JsonArray.class);
|
||||
@@ -217,7 +218,7 @@
|
||||
@@ -217,7 +219,7 @@
|
||||
DateFormat dateformat = GameProfileCache.createDateFormat();
|
||||
|
||||
jsonarray.forEach((jsonelement) -> {
|
||||
|
@ -59,7 +69,7 @@
|
|||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -250,6 +251,11 @@
|
||||
@@ -250,6 +252,11 @@
|
||||
}
|
||||
} catch (FileNotFoundException filenotfoundexception) {
|
||||
;
|
||||
|
@ -71,7 +81,7 @@
|
|||
} catch (JsonParseException | IOException ioexception) {
|
||||
GameProfileCache.LOGGER.warn("Failed to load profile cache {}", this.file, ioexception);
|
||||
}
|
||||
@@ -257,14 +263,15 @@
|
||||
@@ -257,14 +264,15 @@
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -89,7 +99,7 @@
|
|||
|
||||
try {
|
||||
BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8);
|
||||
@@ -289,6 +296,14 @@
|
||||
@@ -289,6 +297,14 @@
|
||||
} catch (IOException ioexception) {
|
||||
;
|
||||
}
|
||||
|
|
|
@ -10,16 +10,17 @@
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraft.util.StringUtil;
|
||||
@@ -62,7 +65,7 @@
|
||||
@@ -62,7 +65,8 @@
|
||||
return new String[i];
|
||||
});
|
||||
|
||||
- if (server.usesAuthentication()) {
|
||||
+ 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;
|
||||
@@ -85,7 +88,7 @@
|
||||
@@ -85,7 +89,7 @@
|
||||
try {
|
||||
gameprofilebanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
|
@ -28,7 +29,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +146,7 @@
|
||||
@@ -143,7 +147,7 @@
|
||||
try {
|
||||
ipbanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
|
@ -37,7 +38,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +187,7 @@
|
||||
@@ -184,7 +188,7 @@
|
||||
try {
|
||||
oplist.load();
|
||||
} catch (IOException ioexception) {
|
||||
|
@ -46,7 +47,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +231,7 @@
|
||||
@@ -228,7 +232,7 @@
|
||||
try {
|
||||
whitelist.load();
|
||||
} catch (IOException ioexception) {
|
||||
|
@ -55,10 +56,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -347,6 +350,38 @@
|
||||
@@ -346,7 +350,39 @@
|
||||
private void movePlayerFile(File playerDataFolder, String fileName, String uuid) {
|
||||
File file5 = new File(file, fileName + ".dat");
|
||||
File file6 = new File(playerDataFolder, uuid + ".dat");
|
||||
|
||||
+
|
||||
+ // CraftBukkit start - Use old file name to seed lastKnownName
|
||||
+ CompoundTag root = null;
|
||||
+
|
||||
|
@ -71,7 +73,7 @@
|
|||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception);
|
||||
+ // Paper end
|
||||
+ }
|
||||
+
|
||||
|
||||
+ if (root != null) {
|
||||
+ if (!root.contains("bukkit")) {
|
||||
+ root.put("bukkit", new CompoundTag());
|
||||
|
|
|
@ -1891,7 +1891,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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue