aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0198-Allow-specifying-a-custom-authentication-servers-dow.patch
blob: 04850d36ca0f0d4db5f7baef4be4f132282c3419 (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
From fee8c1007a09297383dd293f9003f41e347c37c7 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 d10d60921b..2b5dde6d99 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;
@@ -285,4 +286,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 852dc7162a..74bc08f85c 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -239,6 +239,10 @@ public class LoginListener implements PacketLoginInListener, ITickable {
                             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.c.error("Couldn't verify username because servers are unavailable");
                         }
-- 
2.21.0