SteamWar/BungeeCore
Archiviert
13
2

Add TokensCommand #501

Geschlossen
Chaoscaot möchte 5 Commits von tokens-command nach master mergen
4 geänderte Dateien mit 12 neuen und 6 gelöschten Zeilen
Nur Änderungen aus Commit a2ce616dbb werden angezeigt - Alle Commits anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -19,16 +19,13 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Token;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class WebpasswordCommand extends SWCommand {
@ -51,4 +48,13 @@ public class WebpasswordCommand extends SWCommand {
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());
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
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)) {
event.setCancelled(true);
BannedUserIPs.banIP(user.getId(), connection.getAddress().getAddress().getHostAddress());