Add language via db #194
@ -332,11 +332,7 @@ public class SQLProvider implements Provider {
|
||||
|
||||
private SteamwarUser newSteamwarUser(ResultSet rs) throws SQLException {
|
||||
String dbLocale = rs.getString("Locale");
|
||||
Locale locale = null;
|
||||
if (dbLocale != null) {
|
||||
locale = Locale.forLanguageTag(dbLocale);
|
||||
}
|
||||
return new SteamwarUser(rs.getInt("id"), UUID.fromString(rs.getString("UUID")), rs.getString("UserName"), UserGroup.getUsergroup(rs.getString("UserGroup")), rs.getInt("Team"), rs.getBoolean("Bedrock"), locale);
|
||||
return new SteamwarUser(rs.getInt("id"), UUID.fromString(rs.getString("UUID")), rs.getString("UserName"), UserGroup.getUsergroup(rs.getString("UserGroup")), rs.getInt("Team"), rs.getBoolean("Bedrock"), dbLocale != null ? Locale.forLanguageTag(dbLocale) : null);
|
||||
}
|
||||
|
||||
|
||||
private static final Statement insert = new Statement("INSERT INTO Exception (server, message, stacktrace) VALUES (?, ?, ?)");
|
||||
|
@ -55,7 +55,7 @@ public class SteamwarUser {
|
||||
private final UserGroup userGroup;
|
||||
private final int team;
|
||||
private final boolean bedrock;
|
||||
private final Locale locale;
|
||||
private Locale locale;
|
||||
|
||||
public SteamwarUser(int id, UUID uuid, String userName, UserGroup userGroup, int team, boolean bedrock, Locale locale) {
|
||||
this.id = id;
|
||||
@ -96,9 +96,9 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public Locale getLocale() {
|
||||
Locale locale = this.locale;
|
||||
if (locale == null)
|
||||
locale = WorldOfColorWrapper.impl.getLocale(Bukkit.getPlayer(uuid));
|
||||
if(locale != null)
|
||||
return locale;
|
||||
locale = WorldOfColorWrapper.impl.getLocale(Bukkit.getPlayer(uuid));
|
||||
if (locale != null)
|
||||
Lixfel
hat
Das ist unnötig (Entweder in DB oder gibts gar keine Info) Das ist unnötig (Entweder in DB oder gibts gar keine Info)
YoyoNow
hat
s.o. s.o.
|
||||
return locale;
|
||||
return Locale.getDefault();
|
||||
Lixfel
hat
Bitte stattdessen ein != null return machen. Bitte stattdessen ein != null return machen.
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Das funktioniert so nicht. byLanguageTag oder so ähnlich.