From a50b41db2b9aeba183caec19ad4b45dcc39024a5 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 11 Oct 2020 22:55:26 +0200 Subject: [PATCH 1/4] Allow Fabric --- src/de/steamwar/bungeecore/BungeeCore.java | 17 ++++++- .../bungeecore/listeners/mods/Fabric.java | 45 ------------------- 2 files changed, 16 insertions(+), 46 deletions(-) delete mode 100644 src/de/steamwar/bungeecore/listeners/mods/Fabric.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 56760a1e..51a88edf 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -216,7 +216,22 @@ public class BungeeCore extends Plugin { config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile); }catch(IOException e){ log("Could not save/load config.yml", e); - ProxyServer.getInstance().stop(); + //ProxyServer.getInstance().stop(); + CHAT_PREFIX = "§eSteam§8War» §r"; + WORLD_FOLDER = "/home/minecraft/userworlds/"; + BAUWELT_PROTOTYP = "/home/minecraft/backbone/server/UserBau/Bauwelt2"; + LOBBY_SERVER = "Lobby"; + USERWORLDS15 = "/home/minecraft/userworlds15/"; + BAUWELT15 = "/home/minecraft/backbone/server/Bau15/Bauwelt"; + Broadcaster.setBroadCastMsgs(new String[] {}); + Persistent.setChatPrefix(CHAT_PREFIX); + Persistent.setLobbyServer(LOBBY_SERVER); + + SQL.connect( + "jdbc:mysql://127.0.0.1:3306/developer", + Password.getUsername(), + Password.getPassword() + ); return; } diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java deleted file mode 100644 index b108be17..00000000 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - 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.listeners.mods; - -import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.listeners.BasicListener; -import net.md_5.bungee.api.connection.Connection; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.PluginMessageEvent; -import net.md_5.bungee.event.EventHandler; - -public class Fabric extends BasicListener { - - @EventHandler - public void onPluginMessageEvent(PluginMessageEvent e){ - Connection sender = e.getSender(); - if(!(sender instanceof ProxiedPlayer)) - return; - - if(!e.getTag().equals("minecraft:brand")) - return; - - if(new String(e.getData()).contains("fabric")){ - ProxiedPlayer p = (ProxiedPlayer) sender; - p.disconnect(BungeeCore.stringToText("§7Die Verwendung von Fabric ist auf §eSteam§8War §7nicht gestattet.")); - } - } -} From 13767c6d83a50c814efb111102af72d78c0d84b6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 12 Oct 2020 11:22:07 +0200 Subject: [PATCH 2/4] Removed Fabric --- src/de/steamwar/bungeecore/BungeeCore.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 51a88edf..b524e480 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -22,7 +22,6 @@ package de.steamwar.bungeecore; import de.steamwar.bungeecore.commands.*; import de.steamwar.bungeecore.comms.SpigotReceiver; import de.steamwar.bungeecore.listeners.*; -import de.steamwar.bungeecore.listeners.mods.Fabric; import de.steamwar.bungeecore.listeners.mods.Forge; import de.steamwar.bungeecore.listeners.mods.LabyMod; import de.steamwar.bungeecore.sql.SQL; @@ -80,7 +79,6 @@ public class BungeeCore extends Plugin { new ConnectionListener(); new Forge(); new LabyMod(); - new Fabric(); new ChatListener(); new BanListener(); new CheckListener(); @@ -216,22 +214,7 @@ public class BungeeCore extends Plugin { config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile); }catch(IOException e){ log("Could not save/load config.yml", e); - //ProxyServer.getInstance().stop(); - CHAT_PREFIX = "§eSteam§8War» §r"; - WORLD_FOLDER = "/home/minecraft/userworlds/"; - BAUWELT_PROTOTYP = "/home/minecraft/backbone/server/UserBau/Bauwelt2"; - LOBBY_SERVER = "Lobby"; - USERWORLDS15 = "/home/minecraft/userworlds15/"; - BAUWELT15 = "/home/minecraft/backbone/server/Bau15/Bauwelt"; - Broadcaster.setBroadCastMsgs(new String[] {}); - Persistent.setChatPrefix(CHAT_PREFIX); - Persistent.setLobbyServer(LOBBY_SERVER); - - SQL.connect( - "jdbc:mysql://127.0.0.1:3306/developer", - Password.getUsername(), - Password.getPassword() - ); + ProxyServer.getInstance().stop(); return; } From 080fae613b26c44e4b0f84160fd39e31349982dc Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 12 Oct 2020 11:32:00 +0200 Subject: [PATCH 3/4] Moved Fabric --- src/de/steamwar/bungeecore/BungeeCore.java | 2 + .../bungeecore/listeners/mods/Fabric.java | 52 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/de/steamwar/bungeecore/listeners/mods/Fabric.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index b524e480..488ff53e 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -22,6 +22,7 @@ package de.steamwar.bungeecore; import de.steamwar.bungeecore.commands.*; import de.steamwar.bungeecore.comms.SpigotReceiver; import de.steamwar.bungeecore.listeners.*; +import de.steamwar.bungeecore.listeners.mods.Fabric; import de.steamwar.bungeecore.listeners.mods.Forge; import de.steamwar.bungeecore.listeners.mods.LabyMod; import de.steamwar.bungeecore.sql.SQL; @@ -82,6 +83,7 @@ public class BungeeCore extends Plugin { new ChatListener(); new BanListener(); new CheckListener(); + new Fabric(); commands.put("/b", null); commands.put("/gs", null); diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java new file mode 100644 index 00000000..3f37dee6 --- /dev/null +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -0,0 +1,52 @@ +/* + 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.listeners.mods; + +import de.steamwar.bungeecore.Storage; +import de.steamwar.bungeecore.listeners.BasicListener; +import net.md_5.bungee.api.connection.Connection; +import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.api.event.PlayerDisconnectEvent; +import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.event.EventHandler; + +public class Fabric extends BasicListener { + + @EventHandler + public void onPluginMessageEvent(PluginMessageEvent e){ + Connection sender = e.getSender(); + if(!(sender instanceof ProxiedPlayer)) + return; + + if(!e.getTag().equals("minecraft:brand")) + return; + + if(new String(e.getData()).contains("fabric")){ + ProxiedPlayer p = (ProxiedPlayer) sender; + Storage.fabricPlayers.add(p); + } + } + + @EventHandler + public void onDisconnect(PlayerDisconnectEvent e){ + Storage.fabricPlayers.removeIf(player -> player == e.getPlayer()); + + } +} From 2fe20749106b8b2c064f981aacc40f978947a04b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 12 Oct 2020 11:51:44 +0200 Subject: [PATCH 4/4] Changed to Server Switch Event --- .../steamwar/bungeecore/listeners/mods/Fabric.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index 3f37dee6..e492c039 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -19,12 +19,16 @@ package de.steamwar.bungeecore.listeners.mods; +import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Storage; +import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.listeners.BasicListener; import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.event.ServerSwitchEvent; import net.md_5.bungee.event.EventHandler; public class Fabric extends BasicListener { @@ -41,12 +45,22 @@ public class Fabric extends BasicListener { if(new String(e.getData()).contains("fabric")){ ProxiedPlayer p = (ProxiedPlayer) sender; Storage.fabricPlayers.add(p); + BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du hast Fabric installiert. Mit Fabric kannst du nicht auf die Arenen"); } } @EventHandler public void onDisconnect(PlayerDisconnectEvent e){ Storage.fabricPlayers.removeIf(player -> player == e.getPlayer()); + } + @EventHandler + public void onServerSwitch(ServerSwitchEvent event) { + if(Subserver.getSubserver(event.getPlayer()) != null + && Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA + && Storage.fabricPlayers.contains(event.getPlayer())) { + event.getPlayer().connect(event.getFrom()); + BungeeCore.send(event.getPlayer(), BungeeCore.CHAT_PREFIX + "§cDu kannst nicht auf die Arena mit Fabric"); + } } }