Paper/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch

44 lines
2.8 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 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
2022-06-03 06:26:56 +02:00
index 2a4aacd2461401a109d749eee262813367fe4a70..a8de81b1a153525b2d0d6b01802b7733947527a2 100644
2021-06-11 14:02:28 +02:00
--- 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 {
2021-06-11 14:02:28 +02:00
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/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
2022-06-07 22:12:48 +02:00
index dc932515bada7f84a386827f3b7e1e8f69bd7159..6d015b226ea32f9d658ca9674b9500494c837949 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
2022-06-07 22:12:48 +02:00
@@ -358,6 +358,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
2021-06-11 14:02:28 +02:00
ServerLoginPacketListenerImpl.this.gameProfile = ServerLoginPacketListenerImpl.this.createFakeProfile(gameprofile);
ServerLoginPacketListenerImpl.this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT;
} else {
2022-06-07 22:12:48 +02:00
+ // Paper start
+ if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) {
+ ServerLoginPacketListenerImpl.this.disconnect(Component.literal(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage));
+ } else // Paper end
ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.authservers_down"));
2021-06-11 14:02:28 +02:00
ServerLoginPacketListenerImpl.LOGGER.error("Couldn't verify username because servers are unavailable");
}