Archiviert
1
0

Code Review Stuff

Dieser Commit ist enthalten in:
Chaoscaot 2023-12-19 20:49:37 +01:00
Ursprung 53249cec61
Commit a2ce616dbb
4 geänderte Dateien mit 12 neuen und 6 gelöschten Zeilen

@ -1 +1 @@
Subproject commit e83ab4762d77567a01b0b71bdf12b65bf2aca3bd Subproject commit 9a3630b07cb870266669ba120985a2c0a8ebbf5c

Datei anzeigen

@ -66,7 +66,7 @@ public class PunishmentCommand {
return null; return null;
} }
return SteamwarUser.getOrCreate(uuid, name, u -> {}); return SteamwarUser.getOrCreate(uuid, name, u -> {}, (o, n) -> {});
} }
private static UUID getUUIDofOfflinePlayer(String playerName) { private static UUID getUUIDofOfflinePlayer(String playerName) {

Datei anzeigen

@ -19,16 +19,13 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Token; import de.steamwar.sql.Token;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
public class WebpasswordCommand extends SWCommand { public class WebpasswordCommand extends SWCommand {
@ -51,4 +48,13 @@ public class WebpasswordCommand extends SWCommand {
ChatSender.of(player).system("WEB_UPDATED"); ChatSender.of(player).system("WEB_UPDATED");
} }
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

@ -46,7 +46,7 @@ public class BanListener extends BasicListener {
event.registerIntent(BungeeCore.get()); event.registerIntent(BungeeCore.get());
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
PendingConnection connection = event.getConnection(); PendingConnection connection = event.getConnection();
SteamwarUser user = SteamwarUser.getOrCreate(connection.getUniqueId(), connection.getName(), ConnectionListener::newPlayer); SteamwarUser user = SteamwarUser.getOrCreate(connection.getUniqueId(), connection.getName(), ConnectionListener::newPlayer, WebpasswordCommand::changeUsername);
if (user.isPunished(Punishment.PunishmentType.Ban)) { if (user.isPunished(Punishment.PunishmentType.Ban)) {
event.setCancelled(true); event.setCancelled(true);
BannedUserIPs.banIP(user.getId(), connection.getAddress().getAddress().getHostAddress()); BannedUserIPs.banIP(user.getId(), connection.getAddress().getAddress().getHostAddress());