1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Deal with getLocale being nullable during login on BungeeCord (#511)

* Temporary fix for https://github.com/GeyserMC/Floodgate/issues/510, bump cloud to rc candidate

* apparently it is supposed to be nullable. okay then.
This commit is contained in:
chris
2024-05-14 17:41:00 +02:00
committed by GitHub
parent 4404c15f1a
commit f8c84182d6
3 changed files with 6 additions and 4 deletions

View File

@@ -26,6 +26,7 @@
package org.geysermc.floodgate.util;
import java.util.Collection;
import java.util.Locale;
import java.util.UUID;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@@ -63,7 +64,8 @@ public final class BungeeCommandUtil extends CommandUtil {
ProxiedPlayer player = (ProxiedPlayer) source;
UUID uuid = player.getUniqueId();
String username = player.getName();
String locale = Utils.getLocale(player.getLocale());
Locale playerLocale = player.getLocale(); // Is null during the PostLoginEvent, which can cause https://github.com/GeyserMC/Floodgate/issues/510
String locale = Utils.getLocale(playerLocale != null ? playerLocale : Locale.getDefault());
return new PlayerAudience(uuid, username, locale, source, this, true);
}