SteamWar/BungeeCore
Archiviert
13
2

Fix error messages

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-02-29 09:24:15 +01:00
Ursprung e6ae4603de
Commit 66d832d058
2 geänderte Dateien mit 11 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -3,6 +3,7 @@ package de.steamwar.bungeecore;
import de.steamwar.bungeecore.sql.SWException;
import net.md_5.bungee.api.ProxyServer;
import java.text.MessageFormat;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@ -35,7 +36,7 @@ public class ErrorLogger extends Handler {
thrown = thrown.getCause();
}
SWException.log("Bungee", record.getMessage(), stacktrace.toString());
SWException.log("Bungee", MessageFormat.format(record.getMessage(), record.getParameters()), stacktrace.toString());
}
@Override

Datei anzeigen

@ -47,7 +47,14 @@ public class SteamwarUser {
}
public static SteamwarUser getOrCreate(PendingConnection connection){
SteamwarUser user = SteamwarUser.get(connection.getUniqueId());
SteamwarUser user;
try{
user = SteamwarUser.get(connection.getUniqueId());
}catch(SecurityException e){
//Exception only thrown for first time users
//Reason: java.sql.SQLException: Invalid utf8mb4 character string: 'ACED00'
user = null;
}
if(user != null){
String userName = connection.getName();
@ -75,7 +82,7 @@ public class SteamwarUser {
public static SteamwarUser get(UUID uuid){
if(usersByUUID.containsKey(uuid))
return usersByUUID.get(uuid);
return dbInit(SQL.select("SELECT * FROM UserData WHERE UUID = '" + uuid.toString() + "'")); //Fix getOrCreate exceptions for first time users
return dbInit(SQL.select("SELECT * FROM UserData WHERE UUID = ?", uuid.toString()));
}
public static SteamwarUser get(ProxiedPlayer player){