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