From f6a4c343a5d4d156e55b7c13dbf534f77ec7e4b0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 20 Jun 2021 21:36:58 +0200 Subject: [PATCH 01/12] Add StatCommand Fix LoadEvaluation --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../steamwar/bungeecore/LoadEvaluation.java | 4 +- .../bungeecore/commands/StatCommand.java | 48 +++++++++++++++++++ .../steamwar/messages/BungeeCore.properties | 1 + 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/de/steamwar/bungeecore/commands/StatCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 2344d565..50cb2059 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -121,6 +121,7 @@ public class BungeeCore extends Plugin { new UnIgnoreCommand(); new PollresultCommand(); new ResourcereloadCommand(); + new StatCommand(); if(!EVENT_MODE){ new WebregisterCommand(); diff --git a/src/de/steamwar/bungeecore/LoadEvaluation.java b/src/de/steamwar/bungeecore/LoadEvaluation.java index 0732d75f..b1f7a0d9 100644 --- a/src/de/steamwar/bungeecore/LoadEvaluation.java +++ b/src/de/steamwar/bungeecore/LoadEvaluation.java @@ -64,12 +64,14 @@ public class LoadEvaluation { public static double getCPULoad() { try { - Process process = new ProcessBuilder("cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS=\"\" '{printf \"%.2f\\n\", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'").start(); + Process process = new ProcessBuilder("bash", "-c", "cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS=\"\" '{printf \"%.2f\\n\", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'").start(); process.waitFor(); return Double.parseDouble(new BufferedReader(new InputStreamReader(process.getInputStream())).readLine()) / 100.0; } catch (IOException e) { + e.printStackTrace(); return 1D; } catch (InterruptedException e) { + e.printStackTrace(); Thread.currentThread().interrupt(); return 1D; } diff --git a/src/de/steamwar/bungeecore/commands/StatCommand.java b/src/de/steamwar/bungeecore/commands/StatCommand.java new file mode 100644 index 00000000..e87eabd6 --- /dev/null +++ b/src/de/steamwar/bungeecore/commands/StatCommand.java @@ -0,0 +1,48 @@ +package de.steamwar.bungeecore.commands; + +import de.steamwar.bungeecore.LoadEvaluation; +import de.steamwar.bungeecore.Message; +import net.md_5.bungee.api.CommandSender; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public class StatCommand extends BasicCommand { + + public StatCommand() { + super("stat", "bungeecore.softreload","stats"); + } + + @Override + public void execute(CommandSender sender, String[] args) { + try { + Process process = new ProcessBuilder("ps", "x").start(); + process.waitFor(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); + Map serverCounts = new HashMap<>(); + bufferedReader.lines().forEach(s -> { + if (!s.contains("--port") || s.contains("grep")) { + return; + } + String server = "SW"; + if (s.contains("ssh -L")) { + server = s.substring(s.indexOf("ssh -L") + 6).split(" ")[2]; + } + serverCounts.put(server, serverCounts.computeIfAbsent(server, s1 -> 0) + 1); + }); + serverCounts.forEach((s, integer) -> { + if (s.equals("SW")) { + Message.send("STAT_SERVER", sender, s, LoadEvaluation.getRamPercentage(), LoadEvaluation.getCPULoad(), integer); + } else { + Message.send("STAT_SERVER", sender, s.toUpperCase(), LoadEvaluation.getRemoteRamPercentage(s), LoadEvaluation.getRemoteCPULoad(s), integer); + } + }); + } catch (Exception e) { + throw new SecurityException(e.getMessage(), e); + } + } + +} diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index a92b7c55..025f2e45 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -104,6 +104,7 @@ MOD_YELLOW_PLUR=§7Deaktiviere die Mods\n§e{0}\n§7um weiter auf §eSteam§8War #Various commands ALERT=§f{0} +STAT_SERVER=§7Server §f{0} - §7Ram §f{1} §7CPU §f{2} §7Server Count §f{3} #Ban&Mute-Command BAN_TEAM_BANNED={0} §c{1} wurde von {2} {3} gebannt. §f§lGrund: §f{4} From 4120e989ce87c690903fe0782d01ccc80823cf4d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 20 Jun 2021 21:38:12 +0200 Subject: [PATCH 02/12] Add StatCommand Fix LoadEvaluation --- src/de/steamwar/bungeecore/LoadEvaluation.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/LoadEvaluation.java b/src/de/steamwar/bungeecore/LoadEvaluation.java index b1f7a0d9..59fda6c2 100644 --- a/src/de/steamwar/bungeecore/LoadEvaluation.java +++ b/src/de/steamwar/bungeecore/LoadEvaluation.java @@ -68,10 +68,8 @@ public class LoadEvaluation { process.waitFor(); return Double.parseDouble(new BufferedReader(new InputStreamReader(process.getInputStream())).readLine()) / 100.0; } catch (IOException e) { - e.printStackTrace(); return 1D; } catch (InterruptedException e) { - e.printStackTrace(); Thread.currentThread().interrupt(); return 1D; } From 5959f8eb6f7ea1490a56cc271b47cfb0bb02e383 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 20 Jun 2021 21:38:45 +0200 Subject: [PATCH 03/12] Add StatCommand Fix LoadEvaluation --- .../bungeecore/commands/StatCommand.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/StatCommand.java b/src/de/steamwar/bungeecore/commands/StatCommand.java index e87eabd6..5422e63c 100644 --- a/src/de/steamwar/bungeecore/commands/StatCommand.java +++ b/src/de/steamwar/bungeecore/commands/StatCommand.java @@ -1,3 +1,22 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.LoadEvaluation; @@ -6,14 +25,13 @@ import net.md_5.bungee.api.CommandSender; import java.io.BufferedReader; import java.io.InputStreamReader; -import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class StatCommand extends BasicCommand { public StatCommand() { - super("stat", "bungeecore.softreload","stats"); + super("stat", "bungeecore.softreload", "stats"); } @Override From fa70a46b64e12c22c0e8b42115b81fbe9e80a455 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Jun 2021 08:09:23 +0200 Subject: [PATCH 04/12] Remove useless checks --- src/de/steamwar/bungeecore/commands/StatCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/StatCommand.java b/src/de/steamwar/bungeecore/commands/StatCommand.java index 5422e63c..506ecab9 100644 --- a/src/de/steamwar/bungeecore/commands/StatCommand.java +++ b/src/de/steamwar/bungeecore/commands/StatCommand.java @@ -42,7 +42,7 @@ public class StatCommand extends BasicCommand { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); Map serverCounts = new HashMap<>(); bufferedReader.lines().forEach(s -> { - if (!s.contains("--port") || s.contains("grep")) { + if (!s.contains("--port")) { return; } String server = "SW"; From c750231b144a1bc7bef675766105cae7b1251e41 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 26 Jun 2021 11:13:01 +0200 Subject: [PATCH 05/12] Add + to Local Chat --- .../bungeecore/listeners/ChatListener.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index b41ea78f..9fd80619 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -19,10 +19,7 @@ package de.steamwar.bungeecore.listeners; -import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.Message; -import de.steamwar.bungeecore.Servertype; -import de.steamwar.bungeecore.Subserver; +import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.commands.BauCommand; import de.steamwar.bungeecore.commands.TpCommand; import de.steamwar.bungeecore.comms.packets.PingPacket; @@ -51,6 +48,8 @@ public class ChatListener extends BasicListener { sanitize7(e); if(e.getMessage().startsWith("/")) onCommand(e); + else if(e.getMessage().startsWith("+")) + onPlusMessage(e); else onChat(e); } @@ -116,6 +115,21 @@ public class ChatListener extends BasicListener { scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "YoyoNow", sender.getDisplayName(), Message.parse("CHAT_YOYONOW_4", sender)), 12, TimeUnit.SECONDS); } + private void onPlusMessage(ChatEvent e) { + ProxiedPlayer p = (ProxiedPlayer) e.getSender(); + Subserver subserver = Subserver.getSubserver(p); + if(/*subserver instanceof Bauserver*/true) { + String[] smolArgs = e.getMessage().split(" "); + String[] args = new String[smolArgs.length + 1]; + smolArgs[0] = smolArgs[0].substring(1); + args[0] = ""; + System.arraycopy(smolArgs, 0, args, 1, smolArgs.length); + localChat(e, args); + } else { + onChat(e); + } + } + private void onChat(ChatEvent e){ if(e.getSender() instanceof ProxiedPlayer){ ProxiedPlayer sender = (ProxiedPlayer) e.getSender(); From 955cb8863a0e57259e490186da07c3fa0aed2993 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 26 Jun 2021 11:14:13 +0200 Subject: [PATCH 06/12] Remove Debug --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 9fd80619..aeffc193 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -118,7 +118,7 @@ public class ChatListener extends BasicListener { private void onPlusMessage(ChatEvent e) { ProxiedPlayer p = (ProxiedPlayer) e.getSender(); Subserver subserver = Subserver.getSubserver(p); - if(/*subserver instanceof Bauserver*/true) { + if(subserver instanceof Bauserver) { String[] smolArgs = e.getMessage().split(" "); String[] args = new String[smolArgs.length + 1]; smolArgs[0] = smolArgs[0].substring(1); From 906be50771cd2ef488433d9a17ef596b4b048d3f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 27 Jun 2021 08:10:15 +0200 Subject: [PATCH 07/12] Compress ChatListener.onPlusMessage --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index aeffc193..12903c07 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -119,9 +119,8 @@ public class ChatListener extends BasicListener { ProxiedPlayer p = (ProxiedPlayer) e.getSender(); Subserver subserver = Subserver.getSubserver(p); if(subserver instanceof Bauserver) { - String[] smolArgs = e.getMessage().split(" "); + String[] smolArgs = e.getMessage().substring(1).split(" "); String[] args = new String[smolArgs.length + 1]; - smolArgs[0] = smolArgs[0].substring(1); args[0] = ""; System.arraycopy(smolArgs, 0, args, 1, smolArgs.length); localChat(e, args); From 47711b746ea4c15e2c0e5c62b0fd7afcc319d9d0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 10 Jul 2021 22:04:56 +0200 Subject: [PATCH 08/12] Add DevCommand --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../bungeecore/commands/DevCommand.java | 86 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 src/de/steamwar/bungeecore/commands/DevCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 2344d565..fe19b80d 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -108,6 +108,7 @@ public class BungeeCore extends Plugin { new DenyCommand("watchcat", "wc"); new TeamCommand(); new ServerTeamchatCommand(); + new DevCommand(); new EventCommand(); new EventreloadCommand(); new EventRescheduleCommand(); diff --git a/src/de/steamwar/bungeecore/commands/DevCommand.java b/src/de/steamwar/bungeecore/commands/DevCommand.java new file mode 100644 index 00000000..c266520a --- /dev/null +++ b/src/de/steamwar/bungeecore/commands/DevCommand.java @@ -0,0 +1,86 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bungeecore.commands; + +import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.config.ServerInfo; +import net.md_5.bungee.api.connection.ProxiedPlayer; + +import java.io.File; +import java.net.InetSocketAddress; +import java.util.Arrays; +import java.util.Collections; +import java.util.stream.Collectors; + +public class DevCommand extends BasicCommand { + + private final File DevServerDir = new File("/configs/DevServer"); + + public DevCommand() { + super("dev", ""); + } + + @Override + public void execute(CommandSender sender, String[] args) { + if (!(sender instanceof ProxiedPlayer)) { + return; + } + String[] devSever = DevServerDir.list(); + if (devSever == null || devSever.length == 0) { + sender.sendMessage("§eSteam§8War§8» §cDer Server ist derzeit nicht erreichbar."); + } else if (devSever.length == 1) { + String[] server = devSever[0].split("\\."); + sendToServer((ProxiedPlayer) sender, server[0], Integer.parseInt(server[1])); + } else { + if (args.length != 0) { + for (String s : devSever) { + String[] server = s.split("\\."); + if (args[0].equals(server[0])) { + sendToServer((ProxiedPlayer) sender, server[0], Integer.parseInt(server[1])); + return; + } + } + } + sender.sendMessage("§eSteam§8War§8» §cUnbekannter DevServer."); + } + } + + private void sendToServer(ProxiedPlayer proxiedPlayer, String name, int port) { + InetSocketAddress address = new InetSocketAddress("127.0.0.1", port); + ServerInfo serverInfo = ProxyServer.getInstance().constructServerInfo("Dev-" + name, address, "SteamWar.de - Subserver", false); + proxiedPlayer.connect(serverInfo); + } + + @Override + public Iterable onTabComplete(CommandSender sender, String[] args) { + if (!(sender instanceof ProxiedPlayer)) { + return Collections.emptyList(); + } + String[] devSever = DevServerDir.list(); + if (devSever == null) { + return Collections.emptyList(); + } + if (args.length > 1) { + return Collections.emptyList(); + } + return Arrays.stream(devSever).map(s -> s.split("\\.")).map(s -> s[0]).collect(Collectors.toList()); + } +} From b16b258ba2659b902b0ed8a05c728209c7c6962b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 10 Jul 2021 22:38:44 +0200 Subject: [PATCH 09/12] Add DevCommand --- .../bungeecore/commands/DevCommand.java | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/DevCommand.java b/src/de/steamwar/bungeecore/commands/DevCommand.java index c266520a..baba06d6 100644 --- a/src/de/steamwar/bungeecore/commands/DevCommand.java +++ b/src/de/steamwar/bungeecore/commands/DevCommand.java @@ -28,6 +28,7 @@ import java.io.File; import java.net.InetSocketAddress; import java.util.Arrays; import java.util.Collections; +import java.util.function.Predicate; import java.util.stream.Collectors; public class DevCommand extends BasicCommand { @@ -50,19 +51,25 @@ public class DevCommand extends BasicCommand { String[] server = devSever[0].split("\\."); sendToServer((ProxiedPlayer) sender, server[0], Integer.parseInt(server[1])); } else { - if (args.length != 0) { - for (String s : devSever) { - String[] server = s.split("\\."); - if (args[0].equals(server[0])) { - sendToServer((ProxiedPlayer) sender, server[0], Integer.parseInt(server[1])); - return; - } - } + if (args.length == 0) { + send(devSever, (ProxiedPlayer) sender, s -> s.equalsIgnoreCase(((ProxiedPlayer) sender).getDisplayName()), () -> sender.sendMessage("§eSteam§8War§8» §cBitte gib einen DevServer an.")); + } else { + send(devSever, (ProxiedPlayer) sender, args[0]::equalsIgnoreCase, () -> sender.sendMessage("§eSteam§8War§8» §cDer Server ist derzeit nicht erreichbar.")); } - sender.sendMessage("§eSteam§8War§8» §cUnbekannter DevServer."); } } + private void send(String[] devServer, ProxiedPlayer sender, Predicate test, Runnable error) { + for (String s : devServer) { + String[] server = s.split("\\."); + if (test.test(server[0])) { + sendToServer(sender, server[0], Integer.parseInt(server[1])); + break; + } + } + error.run(); + } + private void sendToServer(ProxiedPlayer proxiedPlayer, String name, int port) { InetSocketAddress address = new InetSocketAddress("127.0.0.1", port); ServerInfo serverInfo = ProxyServer.getInstance().constructServerInfo("Dev-" + name, address, "SteamWar.de - Subserver", false); @@ -81,6 +88,9 @@ public class DevCommand extends BasicCommand { if (args.length > 1) { return Collections.emptyList(); } - return Arrays.stream(devSever).map(s -> s.split("\\.")).map(s -> s[0]).collect(Collectors.toList()); + return Arrays.stream(devSever).map(s -> s.split("\\.")).map(s -> s[0]).filter(s -> { + if (args.length == 0) return true; + return s.startsWith(args[0]); + }).collect(Collectors.toList()); } } From 1879f74eadfa85618fb73d265b602fbd162436a6 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 10 Jul 2021 22:43:15 +0200 Subject: [PATCH 10/12] Add DevCommand --- src/de/steamwar/bungeecore/commands/DevCommand.java | 7 ++++--- src/de/steamwar/messages/BungeeCore.properties | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/DevCommand.java b/src/de/steamwar/bungeecore/commands/DevCommand.java index baba06d6..5daa909a 100644 --- a/src/de/steamwar/bungeecore/commands/DevCommand.java +++ b/src/de/steamwar/bungeecore/commands/DevCommand.java @@ -19,6 +19,7 @@ package de.steamwar.bungeecore.commands; +import de.steamwar.bungeecore.Message; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; @@ -46,15 +47,15 @@ public class DevCommand extends BasicCommand { } String[] devSever = DevServerDir.list(); if (devSever == null || devSever.length == 0) { - sender.sendMessage("§eSteam§8War§8» §cDer Server ist derzeit nicht erreichbar."); + Message.send("DEV_NO_SERVER", sender); } else if (devSever.length == 1) { String[] server = devSever[0].split("\\."); sendToServer((ProxiedPlayer) sender, server[0], Integer.parseInt(server[1])); } else { if (args.length == 0) { - send(devSever, (ProxiedPlayer) sender, s -> s.equalsIgnoreCase(((ProxiedPlayer) sender).getDisplayName()), () -> sender.sendMessage("§eSteam§8War§8» §cBitte gib einen DevServer an.")); + send(devSever, (ProxiedPlayer) sender, s -> s.equalsIgnoreCase(((ProxiedPlayer) sender).getDisplayName()), () -> Message.send("DEV_UNKNOWN_SERVER", sender)); } else { - send(devSever, (ProxiedPlayer) sender, args[0]::equalsIgnoreCase, () -> sender.sendMessage("§eSteam§8War§8» §cDer Server ist derzeit nicht erreichbar.")); + send(devSever, (ProxiedPlayer) sender, args[0]::equalsIgnoreCase, () -> Message.send("DEV_NO_SERVER", sender)); } } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index a92b7c55..06fdc7f8 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -9,6 +9,9 @@ INVALID_TIME=§cUngültige Zeitangabe. STEAMWAR_BRAND=§eSteam§8War.de §7({0}) §r<- §e{1} §7({2})§r +DEV_NO_SERVER=§cDer Server ist derzeit nicht erreichbar. +DEV_UNKNOWN_SERVER=§cBitte gib einen DevServer an. + #ModLoader blocker MODLOADER_INSTALLED=§7Du hast §e{0} §7installiert. Daher kannst du keinen Arenen beitreten. MODLOADER_DENIED=§cMit Fabric, Forge und LiteLoader kannst du keinen Arenen beitreten. From 86664ea399ab5dcc916d39b1dcb78d82997f6e98 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 11 Jul 2021 08:24:54 +0200 Subject: [PATCH 11/12] Fix Typo --- src/de/steamwar/bungeecore/commands/DevCommand.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/DevCommand.java b/src/de/steamwar/bungeecore/commands/DevCommand.java index 5daa909a..7e5ed2d4 100644 --- a/src/de/steamwar/bungeecore/commands/DevCommand.java +++ b/src/de/steamwar/bungeecore/commands/DevCommand.java @@ -45,17 +45,17 @@ public class DevCommand extends BasicCommand { if (!(sender instanceof ProxiedPlayer)) { return; } - String[] devSever = DevServerDir.list(); - if (devSever == null || devSever.length == 0) { + String[] devServer = DevServerDir.list(); + if (devServer == null || devServer.length == 0) { Message.send("DEV_NO_SERVER", sender); - } else if (devSever.length == 1) { - String[] server = devSever[0].split("\\."); + } else if (devServer.length == 1) { + String[] server = devServer[0].split("\\."); sendToServer((ProxiedPlayer) sender, server[0], Integer.parseInt(server[1])); } else { if (args.length == 0) { - send(devSever, (ProxiedPlayer) sender, s -> s.equalsIgnoreCase(((ProxiedPlayer) sender).getDisplayName()), () -> Message.send("DEV_UNKNOWN_SERVER", sender)); + send(devServer, (ProxiedPlayer) sender, s -> s.equalsIgnoreCase(((ProxiedPlayer) sender).getDisplayName()), () -> Message.send("DEV_UNKNOWN_SERVER", sender)); } else { - send(devSever, (ProxiedPlayer) sender, args[0]::equalsIgnoreCase, () -> Message.send("DEV_NO_SERVER", sender)); + send(devServer, (ProxiedPlayer) sender, args[0]::equalsIgnoreCase, () -> Message.send("DEV_NO_SERVER", sender)); } } } From 587395002a1ec2016bf32327211a17c8bad22f46 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 11 Jul 2021 13:23:29 +0200 Subject: [PATCH 12/12] Better 7 sanitize --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index b850835e..65b7e89c 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -64,6 +64,10 @@ public class ChatListener extends BasicListener { e.setMessage("/" + e.getMessage().substring(1)); }else if(begin.startsWith("77") && begin.substring(2).matches("[A-Za-z]+")){ e.setMessage("//" + e.getMessage().substring(2)); + }else if(begin.startsWith("7/") && begin.substring(2).matches("[A-Za-z]+")){ + e.setMessage("//" + e.getMessage().substring(2)); + }else if(begin.startsWith("/7") && begin.substring(2).matches("[A-Za-z]+")){ + e.setMessage("//" + e.getMessage().substring(2)); } }