SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'usernameChanger' of SteamWar/BungeeCore into master

Dieser Commit ist enthalten in:
Lixfel 2020-03-12 17:04:37 +01:00 committet von Gitea
Commit 2e7c326613
2 geänderte Dateien mit 11 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -61,4 +61,13 @@ public class WebregisterCommand extends BasicCommand {
throw new SecurityException("Could not create webaccount", e); throw new SecurityException("Could not create webaccount", e);
} }
} }
public static void changeUsername(String oldUsername, String newUsername){
ProcessBuilder pb = new ProcessBuilder("php", "/var/www/changename.php", oldUsername, newUsername);
try {
pb.start();
} catch (IOException e) {
throw new SecurityException("Could not change username", e);
}
}
} }

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.sql; package de.steamwar.bungeecore.sql;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.commands.WebregisterCommand;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.PendingConnection;
@ -53,6 +54,7 @@ public class SteamwarUser {
String userName = connection.getName(); String userName = connection.getName();
if(!user.userName.equals(userName)){ if(!user.userName.equals(userName)){
SQL.update("UPDATE UserData SET UserName = ? WHERE id = ?", userName, user.id); SQL.update("UPDATE UserData SET UserName = ? WHERE id = ?", userName, user.id);
WebregisterCommand.changeUsername(user.userName, userName);
user.userName = userName; user.userName = userName;
} }
}else{ }else{