From 94398901316fd334d0762c484f0cf5826696ef87 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Aug 2022 11:23:42 +0200 Subject: [PATCH 1/9] Ignore took ms to process event in db Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ErrorLogger.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/bungeecore/ErrorLogger.java b/src/de/steamwar/bungeecore/ErrorLogger.java index c60d7aa..ef80a0b 100644 --- a/src/de/steamwar/bungeecore/ErrorLogger.java +++ b/src/de/steamwar/bungeecore/ErrorLogger.java @@ -90,6 +90,7 @@ public class ErrorLogger extends Handler { contains.add("No client connected for pending server"); contains.add("Error occurred processing connection for"); contains.add("Server is online mode!"); + contains.add(" took "); ignoreContains = Collections.unmodifiableList(contains); } } From 698f710138d9a7b9bdf39ebcafdf0d30a8797950 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Aug 2022 18:15:02 +0200 Subject: [PATCH 2/9] Use /servers for server starts Signed-off-by: Lixfel --- CommonCore | 2 +- src/de/steamwar/bungeecore/ServerStarter.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CommonCore b/CommonCore index 47bd9af..6cb3bc5 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 47bd9af03eb987f94777f3b13f6ae6c30f153393 +Subproject commit 6cb3bc5ff5ee955ccdde281183991d0877e54169 diff --git a/src/de/steamwar/bungeecore/ServerStarter.java b/src/de/steamwar/bungeecore/ServerStarter.java index c6bdca0..f452f3f 100644 --- a/src/de/steamwar/bungeecore/ServerStarter.java +++ b/src/de/steamwar/bungeecore/ServerStarter.java @@ -19,12 +19,12 @@ public class ServerStarter { private static final Portrange BAU_PORTS = BungeeCore.MAIN_SERVER ? new Portrange(10100, 20000) : new Portrange(2100, 2200); private static final Portrange ARENA_PORTS = BungeeCore.MAIN_SERVER ? new Portrange(3000, 3100) : (BungeeCore.EVENT_MODE ? new Portrange(4000, 5000) : BAU_PORTS); - private static final String BACKBONE = System.getProperty("user.home") + "/"; - private static final String SERVER_PATH = BACKBONE + "server/"; - private static final String EVENT_PATH = BACKBONE + "event/"; - public static final String TEMP_WORLD_PATH = BACKBONE + "arenaserver/"; - public static final String TUTORIAL_PATH = BACKBONE + "tutorials/"; - public static final String WORLDS19_PATH = BACKBONE + "userworlds19/"; + private static final String SERVER_PATH = "/servers/"; + private static final String USER_HOME = System.getProperty("user.home") + "/"; + private static final String EVENT_PATH = USER_HOME + "event/"; + public static final String TEMP_WORLD_PATH = USER_HOME + "arenaserver/"; + public static final String TUTORIAL_PATH = USER_HOME + "tutorials/"; + public static final String WORLDS19_PATH = USER_HOME + "userworlds19/"; private File directory = null; private String worldDir = null; From 43a9b92b41413ba0b830babda550ef903b3af166 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Aug 2022 19:10:26 +0200 Subject: [PATCH 3/9] Bye Bye Mail. Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/BungeeCore.java | 2 +- ...erCommand.java => WebpasswordCommand.java} | 49 +++++++------------ .../steamwar/bungeecore/sql/SteamwarUser.java | 4 +- .../steamwar/messages/BungeeCore.properties | 11 ++--- .../messages/BungeeCore_de.properties | 11 ++--- 5 files changed, 29 insertions(+), 48 deletions(-) rename src/de/steamwar/bungeecore/commands/{WebregisterCommand.java => WebpasswordCommand.java} (56%) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 5660af1..a63d71a 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -168,7 +168,7 @@ public class BungeeCore extends Plugin { if(!EVENT_MODE){ new BauCommand(); - new WebregisterCommand(); + new WebpasswordCommand(); new FightCommand(); new ChallengeCommand(); new HistoricCommand(); diff --git a/src/de/steamwar/bungeecore/commands/WebregisterCommand.java b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java similarity index 56% rename from src/de/steamwar/bungeecore/commands/WebregisterCommand.java rename to src/de/steamwar/bungeecore/commands/WebpasswordCommand.java index 6197f0f..d5bc7ec 100644 --- a/src/de/steamwar/bungeecore/commands/WebregisterCommand.java +++ b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java @@ -20,57 +20,44 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; -import de.steamwar.bungeecore.sql.SWException; import de.steamwar.command.SWCommand; +import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -public class WebregisterCommand extends SWCommand { +public class WebpasswordCommand extends SWCommand { - public WebregisterCommand() { - super("webregister", null, "web", "webpw"); + public WebpasswordCommand() { + super("webpassword", null, "web", "webpw"); } @Register(description = "WEB_USAGE") - public void genericCommand(ProxiedPlayer player, String email) { - ProcessBuilder pb = new ProcessBuilder("php", "/var/www/register.php", player.getName(), email); + public void genericCommand(ProxiedPlayer player, String password) { + 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); try { Process regProcess = pb.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(regProcess.getInputStream())); String errorLine; - boolean error = false; - while((errorLine = reader.readLine()) != null){ - switch(errorLine){ - 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); + if((errorLine = reader.readLine()) != null) { + if ("updated".equals(errorLine)) { + Message.send("WEB_UPDATED", player); + return; + } else { + throw new SecurityException("Could not create webaccount " + errorLine); } - error = true; } - if(error) - return; - - Message.send("WEB_EMAIL_SEND", player); + Message.send("WEB_CREATED", player); } catch (IOException e) { - Message.send("WEB_INTERNAL_ERROR", player); throw new SecurityException("Could not create webaccount", e); } } diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 96c92d5..a5cb605 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -22,7 +22,7 @@ package de.steamwar.bungeecore.sql; import com.google.gson.JsonParser; import de.steamwar.bungeecore.BungeeCore; 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.network.NetworkSender; import de.steamwar.messages.ChatSender; @@ -121,7 +121,7 @@ public class SteamwarUser { String userName = connection.getName(); if (!user.userName.equals(userName)) { updateName.update(userName, user.id); - WebregisterCommand.changeUsername(user.userName, userName); + WebpasswordCommand.changeUsername(user.userName, userName); user.userName = userName; } } else { diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 203618f..a2ba6ff 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -498,13 +498,10 @@ UNIGNORE_NOT_IGNORED=§cYou are not ignoring this player. UNIGNORE_UNIGNORED=§7You ignored §e{0}§8. #WebregisterCommand -WEB_USAGE=§8/§7webregister §8[§eE-Mail§8] -WEB_ALREADY=§cYou already have a webaccount. -WEB_ALREADY_EMAIL=§cYou already used this E-Mail address on another account... -WEB_NOT_EMAIL=§c[E-Mail], not [free text]! -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. +WEB_USAGE=§8/§7webpassword §8[§epassword§8] +WEB_UPDATED=§7Your password was updated. +WEB_CREATED=§7Your webaccount was created. +WEB_PASSWORD_LENGTH=§cYour password is shorter than 8 characters. #ChatListener CHAT_LIXFEL_ACTION_BAR=§4§lTechnical problems? diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 28df9b1..b23a577 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -477,13 +477,10 @@ UNIGNORE_NOT_IGNORED=§cDu ignorierst diesen Spieler nicht. UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8. #WebregisterCommand -WEB_USAGE=§8/§7webregister §8[§eE-Mail§8] -WEB_ALREADY=§cDu hast bereits einen Webaccount. -WEB_ALREADY_EMAIL=§cDie E-Mail hast du bereits für einen anderen Account verwendet... -WEB_NOT_EMAIL=§c[E-Mail], nicht [Freitext]! -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. +WEB_USAGE=§8/§7webpassword §8[§ePasswort§8] +WEB_UPDATED=§7Dein Passwort wurde aktualisiert. +WEB_CREATED=§7Dein Webaccount wurde erstellt. +WEB_PASSWORD_LENGTH=§cDein Passwort ist kürzer als 8 Zeichen. #ChatListener CHAT_LIXFEL_ACTION_BAR=§4§lTechnische Probleme? From 11106ab2408c7f99fa71e16a6c9b5bb51d9f8cef Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Aug 2022 19:15:28 +0200 Subject: [PATCH 4/9] Bye Bye Mail. Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/WebpasswordCommand.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java index d5bc7ec..39e29b5 100644 --- a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java +++ b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.Message; import de.steamwar.command.SWCommand; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -49,14 +48,14 @@ public class WebpasswordCommand extends SWCommand { String errorLine; if((errorLine = reader.readLine()) != null) { if ("updated".equals(errorLine)) { - Message.send("WEB_UPDATED", player); + ChatSender.of(player).system("WEB_UPDATED"); return; } else { throw new SecurityException("Could not create webaccount " + errorLine); } } - Message.send("WEB_CREATED", player); + ChatSender.of(player).system("WEB_CREATED"); } catch (IOException e) { throw new SecurityException("Could not create webaccount", e); } From 5cf577c9e5433814ef4fb11911d07197dbaee604 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Aug 2022 19:22:21 +0200 Subject: [PATCH 5/9] Bye Bye Mail. Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/WebpasswordCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java index 39e29b5..ec79a8c 100644 --- a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java +++ b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java @@ -30,7 +30,7 @@ import java.io.InputStreamReader; public class WebpasswordCommand extends SWCommand { public WebpasswordCommand() { - super("webpassword", null, "web", "webpw"); + super("webpassword", null, "webpw", "web"); } @Register(description = "WEB_USAGE") From bd1420cc9091f176eb02b1137b19d323fa0a5189 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Aug 2022 19:35:46 +0200 Subject: [PATCH 6/9] Bye Bye Mail. Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/WebpasswordCommand.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java index ec79a8c..2e45c27 100644 --- a/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java +++ b/src/de/steamwar/bungeecore/commands/WebpasswordCommand.java @@ -33,6 +33,7 @@ public class WebpasswordCommand extends SWCommand { super("webpassword", null, "webpw", "web"); } + @Register(description = "WEB_USAGE") public void genericCommand(ProxiedPlayer player, String password) { if(password.length() < 8) { From b8404a74a7674d9896ded76d9d85102044085451 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 22 Aug 2022 06:50:53 +0200 Subject: [PATCH 7/9] Update to paper 1.19.2 Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ServerStarter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/ServerStarter.java b/src/de/steamwar/bungeecore/ServerStarter.java index f452f3f..a0b4ec8 100644 --- a/src/de/steamwar/bungeecore/ServerStarter.java +++ b/src/de/steamwar/bungeecore/ServerStarter.java @@ -109,7 +109,7 @@ public class ServerStarter { public ServerStarter build19(UUID owner) { directory = new File(SERVER_PATH, "Bau19"); - serverJar = "paper-1.19.1.jar"; + serverJar = "paper-1.19.2.jar"; worldDir = WORLDS19_PATH; worldName = String.valueOf(SteamwarUser.get(owner).getId()); buildWithWorld(owner, new File(directory, "Bauwelt").getPath()); From e4cd94aecd0486b53c37c157108aef23c7e7180e Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 22 Aug 2022 14:31:04 +0200 Subject: [PATCH 8/9] Fix lobbyconnection on disconnect Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/ConnectionListener.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java index 95f6a89..44bba9f 100644 --- a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java +++ b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java @@ -105,6 +105,9 @@ public class ConnectionListener extends BasicListener { @EventHandler public void onServerKickEvent(ServerKickEvent ev) { + if(!ev.getPlayer().isConnected()) + return; + ServerInfo kickedFrom; if (ev.getPlayer().getServer() != null){ From ea94195db8d8023b59daab76f882581ab644bd70 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 22 Aug 2022 16:07:21 +0200 Subject: [PATCH 9/9] Fix folder inconsistencies Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/BungeeCore.java | 8 -------- src/de/steamwar/bungeecore/ServerStarter.java | 12 +++++++----- src/de/steamwar/bungeecore/commands/BauCommand.java | 4 ++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index a63d71a..591132a 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -61,11 +61,7 @@ public class BungeeCore extends Plugin { public static boolean MAIN_SERVER; public static String CHAT_PREFIX; - public static String WORLD_FOLDER; - public static String BAUWELT_PROTOTYP; public static String LOBBY_SERVER; - public static String USERWORLDS15; - public static String BAUWELT15; public static boolean EVENT_MODE; private static BungeeCore instance; @@ -299,11 +295,7 @@ public class BungeeCore extends Plugin { } CHAT_PREFIX = config.getString("prefix"); - WORLD_FOLDER = config.getString("worldfolder"); - BAUWELT_PROTOTYP = config.getString("bauweltprototyp"); LOBBY_SERVER = config.getString("lobbyserver"); - USERWORLDS15 = config.getString("userworlds15"); - BAUWELT15 = config.getString("bauwelt15"); EVENT_MODE = config.getBoolean("eventmode"); Broadcaster.setBroadCastMsgs(config.getStringList("broadcasts").toArray(new String[1])); PollSystem.init(config.getString("poll.question"), config.getStringList("poll.answers")); diff --git a/src/de/steamwar/bungeecore/ServerStarter.java b/src/de/steamwar/bungeecore/ServerStarter.java index a0b4ec8..a805523 100644 --- a/src/de/steamwar/bungeecore/ServerStarter.java +++ b/src/de/steamwar/bungeecore/ServerStarter.java @@ -24,6 +24,8 @@ public class ServerStarter { private static final String EVENT_PATH = USER_HOME + "event/"; public static final String TEMP_WORLD_PATH = USER_HOME + "arenaserver/"; public static final String TUTORIAL_PATH = USER_HOME + "tutorials/"; + public static final String WORLDS12_PATH = USER_HOME + "userworlds/"; + public static final String WORLDS15_PATH = USER_HOME + "userworlds15/"; public static final String WORLDS19_PATH = USER_HOME + "userworlds19/"; private File directory = null; @@ -118,19 +120,19 @@ public class ServerStarter { public ServerStarter build15(UUID owner) { directory = new File(SERVER_PATH, "Bau15"); - worldDir = BungeeCore.USERWORLDS15; + worldDir = WORLDS15_PATH; worldName = String.valueOf(SteamwarUser.get(owner).getId()); - buildWithWorld(owner, BungeeCore.BAUWELT15); + buildWithWorld(owner, new File(directory, "Bauwelt").getPath()); return this; } public ServerStarter build12(UUID owner) { - directory = new File(SERVER_PATH, "UserBau"); + directory = new File(SERVER_PATH, "Bau12"); serverJar = "spigot-1.12.2.jar"; xmx = "256M"; - worldDir = BungeeCore.WORLD_FOLDER; + worldDir = WORLDS12_PATH; worldName = owner.toString(); - buildWithWorld(owner, BungeeCore.BAUWELT_PROTOTYP); + buildWithWorld(owner, new File(directory, "Bauwelt").getPath()); return this; } diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 9f59bf4..41496b9 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -236,8 +236,8 @@ public class BauCommand extends BasicCommand { SteamwarUser user = SteamwarUser.get(p.getUniqueId()); versionSelector(p, args, 1, () -> deleteConfirmation(p, () -> deleteWorld(p, ServerStarter.WORLDS19_PATH + user.getId())), - () -> deleteConfirmation(p, () -> deleteWorld(p, BungeeCore.USERWORLDS15 + user.getId())), - () -> deleteConfirmation(p, () -> deleteWorld(p, BungeeCore.WORLD_FOLDER + p.getUniqueId().toString())), + () -> deleteConfirmation(p, () -> deleteWorld(p, ServerStarter.WORLDS15_PATH + user.getId())), + () -> deleteConfirmation(p, () -> deleteWorld(p, ServerStarter.WORLDS12_PATH + p.getUniqueId().toString())), () -> HelpCommand.sendBauHelp(ChatSender.of(p))); }