SteamWar/BungeeCore
Archiviert
13
2
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-08-20 19:10:26 +02:00
Ursprung 698f710138
Commit 43a9b92b41
5 geänderte Dateien mit 29 neuen und 48 gelöschten Zeilen

Datei anzeigen

@ -168,7 +168,7 @@ public class BungeeCore extends Plugin {
if(!EVENT_MODE){ if(!EVENT_MODE){
new BauCommand(); new BauCommand();
new WebregisterCommand(); new WebpasswordCommand();
new FightCommand(); new FightCommand();
new ChallengeCommand(); new ChallengeCommand();
new HistoricCommand(); new HistoricCommand();

Datei anzeigen

@ -20,57 +20,44 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.sql.SWException;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
public class WebregisterCommand extends SWCommand { public class WebpasswordCommand extends SWCommand {
public WebregisterCommand() { public WebpasswordCommand() {
super("webregister", null, "web", "webpw"); super("webpassword", null, "web", "webpw");
} }
@Register(description = "WEB_USAGE") @Register(description = "WEB_USAGE")
public void genericCommand(ProxiedPlayer player, String email) { public void genericCommand(ProxiedPlayer player, String password) {
ProcessBuilder pb = new ProcessBuilder("php", "/var/www/register.php", player.getName(), email); if(password.length() < 8) {
ChatSender.of(player).system("WEB_PASSWORD_LENGTH");
return;
}
ProcessBuilder pb = new ProcessBuilder("php", "/var/www/register.php", player.getName(), password);
pb.redirectErrorStream(true); pb.redirectErrorStream(true);
try { try {
Process regProcess = pb.start(); Process regProcess = pb.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(regProcess.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(regProcess.getInputStream()));
String errorLine; String errorLine;
boolean error = false; if((errorLine = reader.readLine()) != null) {
while((errorLine = reader.readLine()) != null){ if ("updated".equals(errorLine)) {
switch(errorLine){ Message.send("WEB_UPDATED", player);
case "username_exists":
Message.send("WEB_ALREADY", player);
break;
case "email_exists":
Message.send("WEB_ALREADY_EMAIL", player);
// SWException.log("Bungee", "Duplicate E-Mail", player.getName() + " " + args[0]);
break;
case "invalid_email":
Message.send("WEB_NOT_EMAIL", player);
break;
case "email_updated":
Message.send("WEB_EMAIL_REFRESH", player);
break;
default:
Message.send("WEB_INTERNAL_ERROR", player);
SWException.log("Bungee", "Unknown Wordpress User Creation Error", errorLine);
}
error = true;
}
if(error)
return; return;
} else {
throw new SecurityException("Could not create webaccount " + errorLine);
}
}
Message.send("WEB_EMAIL_SEND", player); Message.send("WEB_CREATED", player);
} catch (IOException e) { } catch (IOException e) {
Message.send("WEB_INTERNAL_ERROR", player);
throw new SecurityException("Could not create webaccount", e); throw new SecurityException("Could not create webaccount", e);
} }
} }

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bungeecore.sql;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.commands.WebregisterCommand; import de.steamwar.bungeecore.commands.WebpasswordCommand;
import de.steamwar.bungeecore.listeners.ConnectionListener; import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.bungeecore.network.NetworkSender; import de.steamwar.bungeecore.network.NetworkSender;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
@ -121,7 +121,7 @@ public class SteamwarUser {
String userName = connection.getName(); String userName = connection.getName();
if (!user.userName.equals(userName)) { if (!user.userName.equals(userName)) {
updateName.update(userName, user.id); updateName.update(userName, user.id);
WebregisterCommand.changeUsername(user.userName, userName); WebpasswordCommand.changeUsername(user.userName, userName);
user.userName = userName; user.userName = userName;
} }
} else { } else {

Datei anzeigen

@ -498,13 +498,10 @@ UNIGNORE_NOT_IGNORED=§cYou are not ignoring this player.
UNIGNORE_UNIGNORED=§7You ignored §e{0}§8. UNIGNORE_UNIGNORED=§7You ignored §e{0}§8.
#WebregisterCommand #WebregisterCommand
WEB_USAGE=§8/§7webregister §8[§eE-Mail§8] WEB_USAGE=§8/§7webpassword §8[§epassword§8]
WEB_ALREADY=§cYou already have a webaccount. WEB_UPDATED=§7Your password was updated.
WEB_ALREADY_EMAIL=§cYou already used this E-Mail address on another account... WEB_CREATED=§7Your webaccount was created.
WEB_NOT_EMAIL=§c[E-Mail], not [free text]! WEB_PASSWORD_LENGTH=§cYour password is shorter than 8 characters.
WEB_EMAIL_REFRESH=§aYour E-Mail was updated.
WEB_INTERNAL_ERROR=§cAn internal error occurred, please contact a developer.
WEB_EMAIL_SEND=§aAn E-Mail to reset your password has been sent.
#ChatListener #ChatListener
CHAT_LIXFEL_ACTION_BAR=§4§lTechnical problems? CHAT_LIXFEL_ACTION_BAR=§4§lTechnical problems?

Datei anzeigen

@ -477,13 +477,10 @@ UNIGNORE_NOT_IGNORED=§cDu ignorierst diesen Spieler nicht.
UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8. UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8.
#WebregisterCommand #WebregisterCommand
WEB_USAGE=§8/§7webregister §8[§eE-Mail§8] WEB_USAGE=§8/§7webpassword §8[§ePasswort§8]
WEB_ALREADY=§cDu hast bereits einen Webaccount. WEB_UPDATED=§7Dein Passwort wurde aktualisiert.
WEB_ALREADY_EMAIL=§cDie E-Mail hast du bereits für einen anderen Account verwendet... WEB_CREATED=§7Dein Webaccount wurde erstellt.
WEB_NOT_EMAIL=§c[E-Mail], nicht [Freitext]! WEB_PASSWORD_LENGTH=§cDein Passwort ist kürzer als 8 Zeichen.
WEB_EMAIL_REFRESH=§aDeine E-Mail-Adresse wurde aktualisiert.
WEB_INTERNAL_ERROR=§cEin interner Fehler ist aufgetreten, bitte wende dich an einen Developer.
WEB_EMAIL_SEND=§aEine E-Mail zum Setzen des Passworts wurde gesendet.
#ChatListener #ChatListener
CHAT_LIXFEL_ACTION_BAR=§4§lTechnische Probleme? CHAT_LIXFEL_ACTION_BAR=§4§lTechnische Probleme?