Paper/Spigot-Server-Patches/0175-Allow-specifying-a-custom-authentication-servers-dow.patch
Zach Brown 70ce6ce831
Move version command update checking to the implementation
This makes it easier for downstream projects (forks) to replace the
version fetching system with their own. It is as simple as implementing
an interface and overriding the default implementation of
org.bukkit.UnsafeValues#getVersionFetcher()

It also makes it easier for us to organize things like the version
history feature.

Lastly I have updated the paper implementation to check against the site
API rather than against jenkins.
2019-05-27 04:13:41 -05:00

47 lines
2.5 KiB
Diff

From 0f32a1be8ccb2b28d30637765777a3599c3aa2ae Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Thu, 17 Aug 2017 16:08:20 -0700
Subject: [PATCH] Allow specifying a custom "authentication servers down" kick
message
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 56cea23b0..f4d089f3e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -1,5 +1,6 @@
package com.destroystokyo.paper;
+import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import java.io.File;
@@ -264,4 +265,9 @@ public class PaperConfig {
private static void suggestPlayersWhenNull() {
suggestPlayersWhenNullTabCompletions = getBoolean("settings.suggest-player-names-when-null-tab-completions", suggestPlayersWhenNullTabCompletions);
}
+
+ public static String authenticationServersDownKickMessage = ""; // empty = use translatable message
+ private static void authenticationServersDownKickMessage() {
+ authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage));
+ }
}
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 91b6f1de8..398f67f4b 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -242,6 +242,10 @@ public class LoginListener implements PacketLoginInListener {
LoginListener.this.i = LoginListener.this.a(gameprofile);
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else {
+ // Paper start
+ if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) {
+ LoginListener.this.disconnect(new ChatComponentText(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage));
+ } else // Paper end
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0]));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}
--
2.21.0