Instantly return null if didn't receive locale packet before calling messages sending method
This commit is contained in:
parent
e922422922
commit
fbf5f32415
@ -45,19 +45,12 @@ public class I18NUtils {
|
||||
public static String getLocale(Player player) {
|
||||
if (Utils.MAJOR_VERSION > 15) {
|
||||
return player.getLocale().toLowerCase();
|
||||
} else {
|
||||
long startTime = System.currentTimeMillis();
|
||||
for (;;) {
|
||||
if (PLAYER_LOCALE.containsKey(player.getUniqueId())) {
|
||||
} else if (PLAYER_LOCALE.containsKey(player.getUniqueId())) {
|
||||
return PLAYER_LOCALE.get(player.getUniqueId());
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - startTime > 500) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addLocale(UUID uuid, String locale) {
|
||||
if (PLAYER_LOCALE == null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user