From b59189ec48902fd75b4d48828338491a328fbbc4 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 31 Mar 2022 12:38:22 +0200 Subject: [PATCH 01/19] Add NoFightServer Punishment type --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../steamwar/bungeecore/commands/ArenaCommand.java | 7 +++++++ .../steamwar/bungeecore/commands/BauCommand.java | 1 + .../bungeecore/commands/ChallengeCommand.java | 7 +++++++ .../steamwar/bungeecore/commands/FightCommand.java | 13 +++++++++++++ .../bungeecore/commands/HistoricCommand.java | 8 ++++++++ .../bungeecore/commands/ReplayCommand.java | 6 ++++++ src/de/steamwar/bungeecore/commands/TpCommand.java | 14 ++++++++++---- src/de/steamwar/bungeecore/sql/Punishment.java | 4 +++- src/de/steamwar/messages/BungeeCore.properties | 6 ++++++ 10 files changed, 62 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 7b9d428..a43ead8 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -132,6 +132,7 @@ public class BungeeCore extends Plugin { new PunishmentCommand("noschemsharing", Punishment.PunishmentType.NoSchemSharing); new PunishmentCommand("noschemsubmitting", Punishment.PunishmentType.NoSchemSubmitting); new PunishmentCommand("nodev", Punishment.PunishmentType.NoDevServer); + new PunishmentCommand("nofight", Punishment.PunishmentType.NoFightServer); if(!EVENT_MODE){ new BauCommand(); diff --git a/src/de/steamwar/bungeecore/commands/ArenaCommand.java b/src/de/steamwar/bungeecore/commands/ArenaCommand.java index d88950f..66caf9f 100644 --- a/src/de/steamwar/bungeecore/commands/ArenaCommand.java +++ b/src/de/steamwar/bungeecore/commands/ArenaCommand.java @@ -23,6 +23,8 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.SubserverSystem; +import de.steamwar.bungeecore.sql.Punishment; +import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; @@ -40,6 +42,11 @@ public class ArenaCommand extends BasicCommand { return; ProxiedPlayer player = (ProxiedPlayer) sender; + SteamwarUser steamwarUser = SteamwarUser.get(player); + if (steamwarUser.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer)) { + return; + } + ServerInfo server = ProxyServer.getInstance().getServerInfo(String.join(" ", args)); if(server == null) { Message.send("ARENA_NOT_FOUND", player); diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 93c4866..20d973d 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -24,6 +24,7 @@ import de.steamwar.bungeecore.comms.packets.BaumemberUpdatePacket; import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.sql.BauweltMember; +import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 7f480c1..155d81e 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -22,6 +22,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker; import de.steamwar.bungeecore.sql.IgnoreSystem; +import de.steamwar.bungeecore.sql.Punishment; +import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; @@ -48,6 +50,11 @@ public class ChallengeCommand extends BasicCommand { if (!(sender instanceof ProxiedPlayer)) return; + SteamwarUser steamwarUser = SteamwarUser.get((ProxiedPlayer) sender); + if (steamwarUser.isPunishedWithMessage((ProxiedPlayer) sender, Punishment.PunishmentType.NoFightServer)) { + return; + } + if(ModLoaderBlocker.isFabric((ProxiedPlayer) sender)) { Message.send("MODLOADER_DENIED", sender); return; diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 736d78d..183a43b 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -21,6 +21,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker; +import de.steamwar.bungeecore.sql.Punishment; +import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; @@ -128,6 +130,12 @@ public class FightCommand extends BasicCommand { return; ProxiedPlayer player = (ProxiedPlayer) sender; + + SteamwarUser steamwarUser = SteamwarUser.get(player); + if (steamwarUser.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer)) { + return; + } + if(alreadyInArena(player)) return; @@ -163,6 +171,11 @@ public class FightCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { + SteamwarUser steamwarUser = SteamwarUser.get((ProxiedPlayer) sender); + if (steamwarUser.isPunishedWithMessage((ProxiedPlayer) sender, Punishment.PunishmentType.NoFightServer)) { + return; + } + createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { Subserver arena = new ServerStarter().arena(mode, map).blueLeader(player).start(); Message.broadcast("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER" diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index f07a6a3..b65ecf6 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -20,8 +20,11 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.sql.Punishment; +import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.LinkedList; @@ -32,6 +35,11 @@ public class HistoricCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { + SteamwarUser steamwarUser = SteamwarUser.get((ProxiedPlayer) sender); + if (steamwarUser.isPunishedWithMessage((ProxiedPlayer) sender, Punishment.PunishmentType.NoFightServer)) { + return; + } + FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> { Subserver arena = new ServerStarter().arena(mode, map).blueLeader(player).start(); Message.broadcast("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER" diff --git a/src/de/steamwar/bungeecore/commands/ReplayCommand.java b/src/de/steamwar/bungeecore/commands/ReplayCommand.java index 9ff3876..feb033a 100644 --- a/src/de/steamwar/bungeecore/commands/ReplayCommand.java +++ b/src/de/steamwar/bungeecore/commands/ReplayCommand.java @@ -24,6 +24,7 @@ import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.inventory.SWStreamInv; import de.steamwar.bungeecore.sql.Fight; +import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SchematicType; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -45,6 +46,11 @@ public class ReplayCommand extends BasicCommand { return; ProxiedPlayer player = (ProxiedPlayer) sender; + SteamwarUser steamwarUser = SteamwarUser.get(player); + if (steamwarUser.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer)) { + return; + } + new SWStreamInv<>(player, Message.parse("REPLAY_TITLE", player), (click, fight) -> { SteamwarUser user = SteamwarUser.get(player.getUniqueId()); ArenaMode mode = fight.getGameMode(); diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index c3a81b2..1bf3ac0 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -20,10 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; -import de.steamwar.bungeecore.sql.BauweltMember; -import de.steamwar.bungeecore.sql.Event; -import de.steamwar.bungeecore.sql.SteamwarUser; -import de.steamwar.bungeecore.sql.Team; +import de.steamwar.bungeecore.sql.*; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; @@ -50,6 +47,7 @@ public class TpCommand extends BasicCommand { public void execute(CommandSender sender, String[] args) { if(!(sender instanceof ProxiedPlayer)) return; + if(!onTp((ProxiedPlayer) sender, args)) Message.send("TP_NOT_FOUND", sender); } @@ -77,6 +75,14 @@ public class TpCommand extends BasicCommand { //Get target player server ServerInfo server = getTargetPlayer(args[0]); + // Check if player is allowed to join fights + if (Subserver.getSubserver(server).getType() == Servertype.ARENA) { + SteamwarUser steamwarUser = SteamwarUser.get(player); + if (steamwarUser.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer)) { + return true; + } + } + //Get target team event arena if(server == null){ Team team = Team.get(args[0]); diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 7f9a24e..c2344a6 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -134,7 +134,9 @@ public class Punishment { NoSchemReceiving(false, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"), NoSchemSharing(false, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"), NoSchemSubmitting(true, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"), - NoDevServer(true, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"); + NoDevServer(true, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"), + NoFightServer(false, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"), + ; private final boolean needsAdmin; private final String teamMessage; diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index d8b87bf..6321e59 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -154,6 +154,12 @@ NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver §7ausgeschlo UNNODEVSERVER_ERROR=§cDer Spieler ist nicht vom Devserver ausgeschlossen. UNNODEVSERVER=§e{0} §7darf nun wieder dem §e§lDevserver beitreten§8. +NOFIGHTSERVER_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lFighten ausgeschlossen§8. §7Grund§8: §f{4} +NOFIGHTSERVER_PERMA=§7Du bist §epermanent §7vom §e§lFighten §7ausgeschlossen§8. §7Grund§8: §e{0} +NOFIGHTSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lFighten §7ausgeschlossen§8. §7Grund§8: §e{1} +UNNOFIGHTSERVER_ERROR=§cDer Spieler ist nicht vom Fighten ausgeschlossen. +UNNOFIGHTSERVER=§e{0} §7darf nun wieder §e§lFights beitreten§8. + #BugCommand BUG_MESSAGE=§7Dein Bugreport wurde gespeichert. From ee4090941e5c5acb576d92aeb78cdbe96f377b7e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 31 Mar 2022 12:49:55 +0200 Subject: [PATCH 02/19] Add SilentMute Punishment type --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../bungeecore/bot/listeners/IngameChatListener.java | 2 +- src/de/steamwar/bungeecore/commands/MsgCommand.java | 3 +++ src/de/steamwar/bungeecore/commands/RCommand.java | 3 +++ src/de/steamwar/bungeecore/listeners/ChatListener.java | 6 ++++++ src/de/steamwar/bungeecore/sql/Punishment.java | 1 + src/de/steamwar/messages/BungeeCore.properties | 4 ++++ 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index a43ead8..e4754ca 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -128,6 +128,7 @@ public class BungeeCore extends Plugin { // Punishment Commands: new PunishmentCommand("ban", Punishment.PunishmentType.Ban); new PunishmentCommand("mute", Punishment.PunishmentType.Mute); + new PunishmentCommand("silentmute", Punishment.PunishmentType.SilentMute); new PunishmentCommand("noschemreceiving", Punishment.PunishmentType.NoSchemReceiving); new PunishmentCommand("noschemsharing", Punishment.PunishmentType.NoSchemSharing); new PunishmentCommand("noschemsubmitting", Punishment.PunishmentType.NoSchemSubmitting); diff --git a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java index e7b709d..23f7cec 100644 --- a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java +++ b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java @@ -51,7 +51,7 @@ public class IngameChatListener extends BasicDiscordListener { event.getMessage().delete().queue(); return; } - if (steamwarUser.isPunished(Punishment.PunishmentType.Mute) || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) { + if (steamwarUser.isPunished(Punishment.PunishmentType.Mute) || steamwarUser.isPunished(Punishment.PunishmentType.SilentMute) || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) { event.getMessage().delete().queue(); return; } diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index 67f7013..af2e3db 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -49,6 +49,9 @@ public class MsgCommand extends BasicCommand { } SteamwarUser user = SteamwarUser.get(player); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) { return; } diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index c9d70dd..d65e181 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -45,6 +45,9 @@ public class RCommand extends BasicCommand { } SteamwarUser user = SteamwarUser.get(player); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) { return; } diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 54b9bb4..cfa8813 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -151,6 +151,9 @@ public class ChatListener extends BasicListener { } SteamwarUser user = SteamwarUser.get(sender); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) { e.setCancelled(true); return; @@ -235,6 +238,9 @@ public class ChatListener extends BasicListener { } SteamwarUser user = SteamwarUser.get(sender); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) { e.setCancelled(true); return; diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index c2344a6..a91be6c 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -131,6 +131,7 @@ public class Punishment { public enum PunishmentType { Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"), Mute( false, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE"), + SilentMute( false, "SILENTMUTE_TEAM", "", "", "UNSILENTMUTE_ERROR", "UNSILENTMUTE"), NoSchemReceiving(false, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"), NoSchemSharing(false, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"), NoSchemSubmitting(true, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"), diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6321e59..2866201 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -130,6 +130,10 @@ MUTE_UNTIL=§7Du bist §ebis zum {0} §e§lgemuted§8. §7Grund§8: §e{1} UNMUTE_ERROR=§cDer Spieler ist nicht gemuted. UNMUTE=§7Du hast §e{0} §e§lentmuted. +SILENTMUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4} +UNSILENTMUTE_ERROR=§cDer Spieler ist nicht gemuted. +UNSILENTMUTE=§7Du hast §e{0} §e§lentmuted. + NOSCHEMRECEIVING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicerhalten ausgeschlossen§8. §7Grund§8: §f{4} NOSCHEMRECEIVING_PERMA=§7Du bist §epermanent §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{0} NOSCHEMRECEIVING_UNTIL=§7Du bist §ebis zum {0} §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{1} From b85cb000ac82d993edf6ecc8082f41fb2290c938 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 31 Mar 2022 13:57:40 +0200 Subject: [PATCH 03/19] Update messages --- src/de/steamwar/messages/BungeeCore.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 2866201..e65e78d 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -158,11 +158,11 @@ NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver §7ausgeschlo UNNODEVSERVER_ERROR=§cDer Spieler ist nicht vom Devserver ausgeschlossen. UNNODEVSERVER=§e{0} §7darf nun wieder dem §e§lDevserver beitreten§8. -NOFIGHTSERVER_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lFighten ausgeschlossen§8. §7Grund§8: §f{4} -NOFIGHTSERVER_PERMA=§7Du bist §epermanent §7vom §e§lFighten §7ausgeschlossen§8. §7Grund§8: §e{0} -NOFIGHTSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lFighten §7ausgeschlossen§8. §7Grund§8: §e{1} -UNNOFIGHTSERVER_ERROR=§cDer Spieler ist nicht vom Fighten ausgeschlossen. -UNNOFIGHTSERVER=§e{0} §7darf nun wieder §e§lFights beitreten§8. +NOFIGHTSERVER_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lKämpfen ausgeschlossen§8. §7Grund§8: §f{4} +NOFIGHTSERVER_PERMA=§7Du bist §epermanent §7vom §e§lKämpfen §7ausgeschlossen§8. §7Grund§8: §e{0} +NOFIGHTSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lKämpfen §7ausgeschlossen§8. §7Grund§8: §e{1} +UNNOFIGHTSERVER_ERROR=§cDer Spieler ist nicht vom Kämpfen ausgeschlossen. +UNNOFIGHTSERVER=§e{0} §7darf nun wieder §e§lKämpfen beitreten§8. #BugCommand BUG_MESSAGE=§7Dein Bugreport wurde gespeichert. From 029285aabac144e50c36f1c90dbf2f92afc37022 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 31 Mar 2022 15:46:48 +0200 Subject: [PATCH 04/19] Revert "Add SilentMute Punishment type" This reverts commit ee4090941e5c5acb576d92aeb78cdbe96f377b7e. --- src/de/steamwar/bungeecore/BungeeCore.java | 1 - .../bungeecore/bot/listeners/IngameChatListener.java | 2 +- src/de/steamwar/bungeecore/commands/MsgCommand.java | 3 --- src/de/steamwar/bungeecore/commands/RCommand.java | 3 --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 6 ------ src/de/steamwar/bungeecore/sql/Punishment.java | 1 - src/de/steamwar/messages/BungeeCore.properties | 4 ---- 7 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index e4754ca..a43ead8 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -128,7 +128,6 @@ public class BungeeCore extends Plugin { // Punishment Commands: new PunishmentCommand("ban", Punishment.PunishmentType.Ban); new PunishmentCommand("mute", Punishment.PunishmentType.Mute); - new PunishmentCommand("silentmute", Punishment.PunishmentType.SilentMute); new PunishmentCommand("noschemreceiving", Punishment.PunishmentType.NoSchemReceiving); new PunishmentCommand("noschemsharing", Punishment.PunishmentType.NoSchemSharing); new PunishmentCommand("noschemsubmitting", Punishment.PunishmentType.NoSchemSubmitting); diff --git a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java index 23f7cec..e7b709d 100644 --- a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java +++ b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java @@ -51,7 +51,7 @@ public class IngameChatListener extends BasicDiscordListener { event.getMessage().delete().queue(); return; } - if (steamwarUser.isPunished(Punishment.PunishmentType.Mute) || steamwarUser.isPunished(Punishment.PunishmentType.SilentMute) || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) { + if (steamwarUser.isPunished(Punishment.PunishmentType.Mute) || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) { event.getMessage().delete().queue(); return; } diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index af2e3db..67f7013 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -49,9 +49,6 @@ public class MsgCommand extends BasicCommand { } SteamwarUser user = SteamwarUser.get(player); - if (user.isPunished(Punishment.PunishmentType.SilentMute)) { - return; - } if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) { return; } diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index d65e181..c9d70dd 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -45,9 +45,6 @@ public class RCommand extends BasicCommand { } SteamwarUser user = SteamwarUser.get(player); - if (user.isPunished(Punishment.PunishmentType.SilentMute)) { - return; - } if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) { return; } diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index cfa8813..54b9bb4 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -151,9 +151,6 @@ public class ChatListener extends BasicListener { } SteamwarUser user = SteamwarUser.get(sender); - if (user.isPunished(Punishment.PunishmentType.SilentMute)) { - return; - } if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) { e.setCancelled(true); return; @@ -238,9 +235,6 @@ public class ChatListener extends BasicListener { } SteamwarUser user = SteamwarUser.get(sender); - if (user.isPunished(Punishment.PunishmentType.SilentMute)) { - return; - } if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) { e.setCancelled(true); return; diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index a91be6c..c2344a6 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -131,7 +131,6 @@ public class Punishment { public enum PunishmentType { Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"), Mute( false, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE"), - SilentMute( false, "SILENTMUTE_TEAM", "", "", "UNSILENTMUTE_ERROR", "UNSILENTMUTE"), NoSchemReceiving(false, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"), NoSchemSharing(false, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"), NoSchemSubmitting(true, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"), diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index e65e78d..3a10db5 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -130,10 +130,6 @@ MUTE_UNTIL=§7Du bist §ebis zum {0} §e§lgemuted§8. §7Grund§8: §e{1} UNMUTE_ERROR=§cDer Spieler ist nicht gemuted. UNMUTE=§7Du hast §e{0} §e§lentmuted. -SILENTMUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4} -UNSILENTMUTE_ERROR=§cDer Spieler ist nicht gemuted. -UNSILENTMUTE=§7Du hast §e{0} §e§lentmuted. - NOSCHEMRECEIVING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicerhalten ausgeschlossen§8. §7Grund§8: §f{4} NOSCHEMRECEIVING_PERMA=§7Du bist §epermanent §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{0} NOSCHEMRECEIVING_UNTIL=§7Du bist §ebis zum {0} §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{1} From 1da5c45b22795bce6f07669c30431547a958f91d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 1 Apr 2022 17:08:08 +0200 Subject: [PATCH 05/19] Allow sql connection parallelity Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/BungeeCore.java | 6 - src/de/steamwar/bungeecore/ErrorLogger.java | 3 +- src/de/steamwar/bungeecore/sql/Statement.java | 199 +++++++++++------- 3 files changed, 120 insertions(+), 88 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 7b9d428..1a4ea14 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -272,12 +272,6 @@ public class BungeeCore extends Plugin { Persistent.setChatPrefix(CHAT_PREFIX); Persistent.setLobbyServer(LOBBY_SERVER); - Statement.connect( - config.getString("db.url"), - config.getString("db.username"), - config.getString("db.password") - ); - if (config.contains("discord")) { SteamwarDiscordBotConfig.loadConfig(config.getSection("discord")); } diff --git a/src/de/steamwar/bungeecore/ErrorLogger.java b/src/de/steamwar/bungeecore/ErrorLogger.java index 5e4ffdf..1f38d82 100644 --- a/src/de/steamwar/bungeecore/ErrorLogger.java +++ b/src/de/steamwar/bungeecore/ErrorLogger.java @@ -20,7 +20,6 @@ package de.steamwar.bungeecore; import de.steamwar.bungeecore.sql.SWException; -import de.steamwar.bungeecore.sql.Statement; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -63,7 +62,7 @@ public class ErrorLogger extends Handler { SWException.log("Bungee", "DDOS", ddosRate + ""); } return; - } else if (!Statement.connectionStable()) { + } else if (stacktrace.contains("ErrorLogger")) { return; } diff --git a/src/de/steamwar/bungeecore/sql/Statement.java b/src/de/steamwar/bungeecore/sql/Statement.java index 1bd849f..7530c42 100644 --- a/src/de/steamwar/bungeecore/sql/Statement.java +++ b/src/de/steamwar/bungeecore/sql/Statement.java @@ -21,128 +21,167 @@ package de.steamwar.bungeecore.sql; import de.steamwar.bungeecore.BungeeCore; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.config.Configuration; +import net.md_5.bungee.config.ConfigurationProvider; +import net.md_5.bungee.config.YamlConfiguration; +import java.io.File; +import java.io.IOException; import java.sql.*; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import java.util.logging.Level; +import java.util.logging.Logger; public class Statement implements AutoCloseable { + + private static final Logger logger = BungeeCore.get().getLogger(); + private static final List statements = new ArrayList<>(); + private static final Deque connections = new ArrayDeque<>(); - private static Connection con; - private static String url; - private static String user; - private static String password; + private static final String URL; + private static final String USER; + private static final String PASSWORD; - public static void connect(String url, String user, String password) { - Statement.url = url; - Statement.user = user; - Statement.password = password; + static { + File file = new File(BungeeCore.get().getDataFolder(), "MySQL.yml"); + Configuration config; try { - con = DriverManager.getConnection(url + "?autoReconnect=true&useServerPrepStmts=true", user, password); - } catch (SQLException e) { + config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file); + } catch (IOException e) { ProxyServer.getInstance().stop(); - throw new SecurityException("Could not start SQL-Connection", e); + throw new SecurityException("", e); } - } - private static void reset() { - closeAll(); - connect(url, user, password); - try { - for (Statement statement : statements) { - statement.init(); - } - } catch (SQLException e) { - throw new SecurityException("Could not reprepare SQL statements", e); - } - } - - @Override - public void close() { - try { - st.close(); - } catch (SQLException e) { - BungeeCore.get().getLogger().log(Level.INFO, "Could not close statement", e); - } - statements.remove(this); + URL = "jdbc:mysql://" + config.getString("HOST") + ":" + config.getString("PORT") + "/" + config.getString("DATABASE"); + USER = config.getString("USER"); + PASSWORD = config.getString("PASSWORD"); } public static void closeAll() { - synchronized (statements) { - for (Statement statement : statements) { + synchronized (connections) { + for(Connection connection : connections) { try { - statement.st.close(); + synchronized (statements) { + statements.forEach(statement -> statement.close(connection)); + } + connection.close(); } catch (SQLException e) { - BungeeCore.get().getLogger().log(Level.INFO, "Could not close statement", e); + logger.log(Level.INFO, "Could not close SQL connection", e); } } - - try { - con.close(); - } catch (SQLException e) { - BungeeCore.get().getLogger().log(Level.INFO, "Could not close SQL connection", e); - } - } - } - - public static boolean connectionStable() { - try { - return !con.isClosed(); - } catch (SQLException e) { - return false; + connections.clear(); } } private final String sql; - private PreparedStatement st; + private final Map cachedStatements = new HashMap<>(); public Statement(String sql) { this.sql = sql; - statements.add(this); - try { - init(); - } catch (SQLException e) { - throw new SecurityException("Could not init SQL statement", e); + synchronized (statements) { + statements.add(this); } } - private void init() throws SQLException { - st = con.prepareStatement(sql); - } - public T select(ResultSetUser user, Object... objects) { - synchronized (statements) { - return prepare(() -> { - ResultSet rs = st.executeQuery(); - T result = user.use(rs); - rs.close(); - return result; - }, objects); - } + return withConnection(st -> { + ResultSet rs = st.executeQuery(); + T result = user.use(rs); + rs.close(); + return result; + }, objects); } public void update(Object... objects) { - synchronized (statements) { - prepare(st::executeUpdate, objects); - } + withConnection(PreparedStatement::executeUpdate, objects); } - private T prepare(SQLRunnable runnable, Object... objects) { + private T withConnection(SQLRunnable runnable, Object... objects) { + Connection connection = aquireConnection(); + + T result; try { - setObjects(objects); - return runnable.run(); + result = tryWithConnection(connection, runnable, objects); } catch (SQLException e) { - reset(); - throw new SecurityException("Could not execute SQL statement", e); + closeConnection(connection); + connection = aquireConnection(); + try { + result = tryWithConnection(connection, runnable, objects); + } catch (SQLException ex) { + closeConnection(connection); + throw new SecurityException("Could not execute statement", ex); + } } + + synchronized (connections) { + connections.push(connection); + } + + return result; } - private void setObjects(Object... objects) throws SQLException { + private T tryWithConnection(Connection connection, SQLRunnable runnable, Object... objects) throws SQLException { + PreparedStatement st = cachedStatements.get(connection); + if(st == null) { + st = connection.prepareStatement(sql); + cachedStatements.put(connection, st); + } + for (int i = 0; i < objects.length; i++) { st.setObject(i + 1, objects[i]); } + + return runnable.run(st); + } + + @Override + public void close() { + cachedStatements.values().forEach(st -> closeStatement(st, false)); + cachedStatements.clear(); + synchronized (statements) { + statements.remove(this); + } + } + + private void close(Connection connection) { + PreparedStatement st = cachedStatements.remove(connection); + if(st != null) + closeStatement(st, true); + } + + private static Connection aquireConnection() { + synchronized (connections) { + if(!connections.isEmpty()) + return connections.pop(); + } + try { + return DriverManager.getConnection(URL + "?autoReconnect=true&useServerPrepStmts=true", USER, PASSWORD); + } catch (SQLException e) { + throw new SecurityException("Could not open connection", e); + } + } + + private static void closeConnection(Connection connection) { + synchronized (statements) { + for (Statement statement : statements) { + statement.close(connection); + } + } + try { + connection.close(); + } catch (SQLException e) { + logger.log(Level.INFO, "Could not close connection", e); + } + } + + private static void closeStatement(PreparedStatement st, boolean silent) { + try { + st.close(); + } catch (SQLException e) { + if(!silent) + logger.log(Level.INFO, "Could not close statement", e); + } } public interface ResultSetUser { @@ -150,6 +189,6 @@ public class Statement implements AutoCloseable { } private interface SQLRunnable { - T run() throws SQLException; + T run(PreparedStatement st) throws SQLException; } } From 3755463c7e0caddde745eedf7acf92b75fa13650 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 1 Apr 2022 17:09:40 +0200 Subject: [PATCH 06/19] Fix error message Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/sql/Statement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/sql/Statement.java b/src/de/steamwar/bungeecore/sql/Statement.java index 7530c42..a216c89 100644 --- a/src/de/steamwar/bungeecore/sql/Statement.java +++ b/src/de/steamwar/bungeecore/sql/Statement.java @@ -50,7 +50,7 @@ public class Statement implements AutoCloseable { config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file); } catch (IOException e) { ProxyServer.getInstance().stop(); - throw new SecurityException("", e); + throw new SecurityException("Could not load SQL connection", e); } URL = "jdbc:mysql://" + config.getString("HOST") + ":" + config.getString("PORT") + "/" + config.getString("DATABASE"); From 2a5ebe51aada6170eb08d703f539e41c2e6c6594 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 2 Apr 2022 08:12:56 +0200 Subject: [PATCH 07/19] Revert april Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/sql/UserGroup.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/UserGroup.java b/src/de/steamwar/bungeecore/sql/UserGroup.java index bf7da6f..6ca7a9a 100644 --- a/src/de/steamwar/bungeecore/sql/UserGroup.java +++ b/src/de/steamwar/bungeecore/sql/UserGroup.java @@ -24,12 +24,12 @@ import java.util.stream.Collectors; public enum UserGroup { - Admin("§4", "§e", "Obererzieher", true, true, true, true), - Developer("§3", "§f", "Seelsorger", true, true, true, true), - Moderator("§c", "§f", "Schichtleiter", true, true, true, true), - Supporter("§9", "§f", "Kindergärtner", false, true, true, true), - Builder("§2", "§f", "Hausmeister", false, true, false, true), - YouTuber("§5", "§f", "Reporter", false, false, false, true), + Admin("§4", "§e", "Admin", true, true, true, true), + Developer("§3", "§f", "Dev", true, true, true, true), + Moderator("§c", "§f", "Mod", true, true, true, true), + Supporter("§9", "§f", "Sup", false, true, true, true), + Builder("§2", "§f", "Arch", false, true, false, true), + YouTuber("§5", "§f", "YT", false, false, false, true), Member("§7", "§7", "", false, false, false, false); private final String colorCode; From c56f221ffc0e95bab8b543b6f58ccde257ebd118 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 2 Apr 2022 08:46:16 +0200 Subject: [PATCH 08/19] Fix checkcommand Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/CheckCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index cb58ab9..76d0e10 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -133,15 +133,15 @@ public class CheckCommand extends BasicCommand { String waitTime = Timestamp.from(Instant.ofEpochMilli(waitedMillis)).toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("CHECK_LIST_WAIT", player, color))); if (current == null) { Message.sendPrefixless("CHECK_LIST_TO_CHECK", player, - waitTime, Message.parse("CHECK_LIST_TO_CHECK_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()), + waitTime, schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName()); } else { Message.sendPrefixless("CHECK_LIST_CHECKING", player, - waitTime, Message.parse("CHECK_LIST_CHECKING_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + current.checker.getName()), + waitTime, schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.getName()); } } From ba0c2623f817a609943eac2f0d85c8588759b0a0 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 2 Apr 2022 08:47:28 +0200 Subject: [PATCH 09/19] Fix checkcommand Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/CheckCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index 76d0e10..cc6b6ae 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -130,7 +130,7 @@ public class CheckCommand extends BasicCommand { CheckSession current = currentSchems.get(schematic.getId()); long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime(); String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a"; - String waitTime = Timestamp.from(Instant.ofEpochMilli(waitedMillis)).toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("CHECK_LIST_WAIT", player, color))); + String waitTime = color + Timestamp.from(Instant.ofEpochMilli(waitedMillis)).toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("CHECK_LIST_WAIT", player))); if (current == null) { Message.sendPrefixless("CHECK_LIST_TO_CHECK", player, Message.parse("CHECK_LIST_TO_CHECK_HOVER", player), diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 59f28bc..1259526 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -246,7 +246,7 @@ CHECK_HELP_DECLINE=§8/§7check decline §8[§eGrund§8] - §7Schematic ablehnen CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Bricht den Prüfvorgang ab CHECK_LIST_HEADER=§e§lZu prüfen sind {0} Schematics CHECK_LIST_TO_CHECK={0} §8{1} §7{2} §e{3} -CHECK_LIST_WAIT={0}d HH:mm +CHECK_LIST_WAIT=d HH:mm CHECK_LIST_TO_CHECK_HOVER=§eSchematic prüfen CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7wird geprüft von §e{4} CHECK_LIST_CHECKING_HOVER=§eZum Prüfer From 186e60e100a93ba2e665b4c0319fdb4f0c735a33 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 2 Apr 2022 11:15:54 +0200 Subject: [PATCH 10/19] Hotfix CheckCommand --- src/de/steamwar/bungeecore/commands/CheckCommand.java | 4 +++- src/de/steamwar/messages/BungeeCore.properties | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index cc6b6ae..5ffa58b 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -130,7 +130,9 @@ public class CheckCommand extends BasicCommand { CheckSession current = currentSchems.get(schematic.getId()); long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime(); String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a"; - String waitTime = color + Timestamp.from(Instant.ofEpochMilli(waitedMillis)).toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("CHECK_LIST_WAIT", player))); + long hours = waitedMillis / 3600000; + long minutes = (waitedMillis - hours * 3600000) / 60000; + String waitTime = color + Message.parse("CHECK_LIST_WAIT", player, hours, (minutes < 10) ? "0" + minutes : minutes); if (current == null) { Message.sendPrefixless("CHECK_LIST_TO_CHECK", player, Message.parse("CHECK_LIST_TO_CHECK_HOVER", player), diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 1259526..d57c5e9 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -246,7 +246,7 @@ CHECK_HELP_DECLINE=§8/§7check decline §8[§eGrund§8] - §7Schematic ablehnen CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Bricht den Prüfvorgang ab CHECK_LIST_HEADER=§e§lZu prüfen sind {0} Schematics CHECK_LIST_TO_CHECK={0} §8{1} §7{2} §e{3} -CHECK_LIST_WAIT=d HH:mm +CHECK_LIST_WAIT={0}:{1} CHECK_LIST_TO_CHECK_HOVER=§eSchematic prüfen CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7wird geprüft von §e{4} CHECK_LIST_CHECKING_HOVER=§eZum Prüfer From bc96ab6d96582c75fdf266806892685364ef2ae9 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 2 Apr 2022 17:51:14 +0200 Subject: [PATCH 11/19] Reduce message spam through asynchronity Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ErrorLogger.java | 1 + .../bungeecore/comms/SpigotReceiver.java | 5 +- .../bungeecore/listeners/BanListener.java | 93 ++++++++++--------- .../bungeecore/listeners/ChatListener.java | 4 +- .../bungeecore/listeners/SessionManager.java | 7 +- 5 files changed, 60 insertions(+), 50 deletions(-) diff --git a/src/de/steamwar/bungeecore/ErrorLogger.java b/src/de/steamwar/bungeecore/ErrorLogger.java index 1f38d82..09cdb40 100644 --- a/src/de/steamwar/bungeecore/ErrorLogger.java +++ b/src/de/steamwar/bungeecore/ErrorLogger.java @@ -87,6 +87,7 @@ public class ErrorLogger extends Handler { contains.add("Error authenticating "); contains.add("read timed out"); contains.add("Connection reset by peer"); + contains.add("No client connected for pending server"); ignoreContains = Collections.unmodifiableList(contains); } } diff --git a/src/de/steamwar/bungeecore/comms/SpigotReceiver.java b/src/de/steamwar/bungeecore/comms/SpigotReceiver.java index 3ad1a68..04b107a 100644 --- a/src/de/steamwar/bungeecore/comms/SpigotReceiver.java +++ b/src/de/steamwar/bungeecore/comms/SpigotReceiver.java @@ -21,9 +21,10 @@ package de.steamwar.bungeecore.comms; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; +import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.comms.handlers.*; -import de.steamwar.bungeecore.comms.packets.FightEndsPacket; import de.steamwar.bungeecore.listeners.BasicListener; +import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.event.EventHandler; @@ -46,7 +47,7 @@ public class SpigotReceiver extends BasicListener { ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); Byte handler = in.readByte(); - handlerMap.get(handler).handle(in, ((Server) event.getSender()).getInfo()); + ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> handlerMap.get(handler).handle(in, ((Server) event.getSender()).getInfo())); } public static void registerHandler(Byte id, SpigotHandler handler) { diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index 195cc19..1743264 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -19,6 +19,7 @@ package de.steamwar.bungeecore.listeners; +import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.BannedUserIPs; import de.steamwar.bungeecore.sql.Punishment; @@ -40,54 +41,58 @@ public class BanListener extends BasicListener { @EventHandler public void onLogin(LoginEvent event) { - SteamwarUser user = SteamwarUser.getOrCreate(event.getConnection()); - if (user.isPunished(Punishment.PunishmentType.Ban)) { - user.updateBanIP(event.getConnection().getAddress().getAddress().getHostAddress()); - event.setCancelled(true); - event.setCancelReason(user.punishmentMessage(Punishment.PunishmentType.Ban, ProxyServer.getInstance().getPlayer(event.getConnection().getUniqueId()))); - return; - } + event.registerIntent(BungeeCore.get()); + ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { + SteamwarUser user = SteamwarUser.getOrCreate(event.getConnection()); + if (user.isPunished(Punishment.PunishmentType.Ban)) { + user.updateBanIP(event.getConnection().getAddress().getAddress().getHostAddress()); + event.setCancelled(true); + event.setCancelReason(user.punishmentMessage(Punishment.PunishmentType.Ban, ProxyServer.getInstance().getPlayer(event.getConnection().getUniqueId()))); + return; + } - List ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); - if(!ips.isEmpty()){ + List ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); + if(!ips.isEmpty()){ - Timestamp highestBan = ips.get(0).getTimestamp(); - boolean perma = false; - for(BannedUserIPs banned : ips) { - SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); - if (bannedUser.isPunished(Punishment.PunishmentType.Ban)) { - Punishment ban = bannedUser.getPunishment(Punishment.PunishmentType.Ban); - if(ban.isPerma()) { - perma = true; - break; + Timestamp highestBan = ips.get(0).getTimestamp(); + boolean perma = false; + for(BannedUserIPs banned : ips) { + SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); + if (bannedUser.isPunished(Punishment.PunishmentType.Ban)) { + Punishment ban = bannedUser.getPunishment(Punishment.PunishmentType.Ban); + if(ban.isPerma()) { + perma = true; + break; + } + if(ban.getEndTime().after(highestBan)) + highestBan = ban.getEndTime(); + } + } + ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " " + + (perma?"perma":highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm"))) + + " Bannumgehung"); + + for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ + if ((target.hasPermission("bungeecore.teamchat")) + && (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY + || target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN)){ + StringBuilder potentialBan = new StringBuilder(); + potentialBan.append(Message.parsePrefixed("BAN_AVOIDING_ALERT", target, user.getUserName())); + + for(BannedUserIPs banned : ips) { + SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); + potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getUserName(), + banned.getTimestamp().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", target))))); + } + + TextComponent msg = new TextComponent(potentialBan.toString()); + msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("BAN_AVOIDING_BAN_HOVER", target)).create())); + msg.setClickEvent(clickEvent); + target.sendMessage(msg); } - if(ban.getEndTime().after(highestBan)) - highestBan = ban.getEndTime(); } } - ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " " - + (perma?"perma":highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm"))) - + " Bannumgehung"); - - for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ - if ((target.hasPermission("bungeecore.teamchat")) - && (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY - || target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN)){ - StringBuilder potentialBan = new StringBuilder(); - potentialBan.append(Message.parsePrefixed("BAN_AVOIDING_ALERT", target, user.getUserName())); - - for(BannedUserIPs banned : ips) { - SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); - potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getUserName(), - banned.getTimestamp().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", target))))); - } - - TextComponent msg = new TextComponent(potentialBan.toString()); - msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("BAN_AVOIDING_BAN_HOVER", target)).create())); - msg.setClickEvent(clickEvent); - target.sendMessage(msg); - } - } - } + event.completeIntent(BungeeCore.get()); + }); } } diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 7be73d7..b8b5cdb 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -167,7 +167,7 @@ public class ChatListener extends BasicListener { return; e.setCancelled(true); - publicChat(user, sender, e.getMessage()); + ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> publicChat(user, sender, e.getMessage())); } } @@ -196,7 +196,7 @@ public class ChatListener extends BasicListener { } } - private void publicChat(SteamwarUser user, ProxiedPlayer sender, String message){ + private void publicChat(SteamwarUser user, ProxiedPlayer sender, String message) { String name = UserElo.getEmblem(user) + sender.getDisplayName(); String chatcolor = user.getUserGroup().getChatColorCode(); diff --git a/src/de/steamwar/bungeecore/listeners/SessionManager.java b/src/de/steamwar/bungeecore/listeners/SessionManager.java index 599ca08..aa3e5c8 100644 --- a/src/de/steamwar/bungeecore/listeners/SessionManager.java +++ b/src/de/steamwar/bungeecore/listeners/SessionManager.java @@ -19,8 +19,10 @@ package de.steamwar.bungeecore.listeners; +import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.sql.Session; import de.steamwar.bungeecore.sql.SteamwarUser; +import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.event.EventHandler; @@ -40,7 +42,8 @@ public class SessionManager extends BasicListener { @EventHandler public void onDisconnect(PlayerDisconnectEvent e){ Timestamp timestamp = sessions.remove(e.getPlayer()); - if(timestamp != null) - Session.insertSession(SteamwarUser.get(e.getPlayer()).getId(), timestamp); + if(timestamp != null) { + ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> Session.insertSession(SteamwarUser.get(e.getPlayer()).getId(), timestamp)); + } } } From d736c07f001061dcef03e8c60283b6313a0e7caa Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 3 Apr 2022 20:57:30 +0200 Subject: [PATCH 12/19] Hotfix stuff --- .../bungeecore/commands/BauCommand.java | 1 - .../bungeecore/commands/ChallengeCommand.java | 7 ---- .../bungeecore/commands/FightCommand.java | 5 --- .../bungeecore/commands/HistoricCommand.java | 5 --- .../bungeecore/commands/TpCommand.java | 16 +++++----- .../steamwar/messages/BungeeCore.properties | 32 +++++++++---------- 6 files changed, 24 insertions(+), 42 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 20d973d..93c4866 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -24,7 +24,6 @@ import de.steamwar.bungeecore.comms.packets.BaumemberUpdatePacket; import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.sql.BauweltMember; -import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 155d81e..7f480c1 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -22,8 +22,6 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker; import de.steamwar.bungeecore.sql.IgnoreSystem; -import de.steamwar.bungeecore.sql.Punishment; -import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; @@ -50,11 +48,6 @@ public class ChallengeCommand extends BasicCommand { if (!(sender instanceof ProxiedPlayer)) return; - SteamwarUser steamwarUser = SteamwarUser.get((ProxiedPlayer) sender); - if (steamwarUser.isPunishedWithMessage((ProxiedPlayer) sender, Punishment.PunishmentType.NoFightServer)) { - return; - } - if(ModLoaderBlocker.isFabric((ProxiedPlayer) sender)) { Message.send("MODLOADER_DENIED", sender); return; diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 183a43b..f94f04a 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -171,11 +171,6 @@ public class FightCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { - SteamwarUser steamwarUser = SteamwarUser.get((ProxiedPlayer) sender); - if (steamwarUser.isPunishedWithMessage((ProxiedPlayer) sender, Punishment.PunishmentType.NoFightServer)) { - return; - } - createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { Subserver arena = new ServerStarter().arena(mode, map).blueLeader(player).start(); Message.broadcast("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER" diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index b65ecf6..65a42e9 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -35,11 +35,6 @@ public class HistoricCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { - SteamwarUser steamwarUser = SteamwarUser.get((ProxiedPlayer) sender); - if (steamwarUser.isPunishedWithMessage((ProxiedPlayer) sender, Punishment.PunishmentType.NoFightServer)) { - return; - } - FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> { Subserver arena = new ServerStarter().arena(mode, map).blueLeader(player).start(); Message.broadcast("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER" diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index 1bf3ac0..33bd7bb 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -75,14 +75,6 @@ public class TpCommand extends BasicCommand { //Get target player server ServerInfo server = getTargetPlayer(args[0]); - // Check if player is allowed to join fights - if (Subserver.getSubserver(server).getType() == Servertype.ARENA) { - SteamwarUser steamwarUser = SteamwarUser.get(player); - if (steamwarUser.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer)) { - return true; - } - } - //Get target team event arena if(server == null){ Team team = Team.get(args[0]); @@ -97,6 +89,14 @@ public class TpCommand extends BasicCommand { if(server == null || server == player.getServer().getInfo()) return false; + // Check if player is allowed to join fights + if (Subserver.getSubserver(server).getType() == Servertype.ARENA) { + SteamwarUser steamwarUser = SteamwarUser.get(player); + if (steamwarUser.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer)) { + return true; + } + } + teleport(player, server); return true; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 3a10db5..2b993d6 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -130,35 +130,35 @@ MUTE_UNTIL=§7Du bist §ebis zum {0} §e§lgemuted§8. §7Grund§8: §e{1} UNMUTE_ERROR=§cDer Spieler ist nicht gemuted. UNMUTE=§7Du hast §e{0} §e§lentmuted. -NOSCHEMRECEIVING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicerhalten ausgeschlossen§8. §7Grund§8: §f{4} -NOSCHEMRECEIVING_PERMA=§7Du bist §epermanent §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{0} -NOSCHEMRECEIVING_UNTIL=§7Du bist §ebis zum {0} §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{1} +NOSCHEMRECEIVING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicerhalten§7 ausgeschlossen§8. §7Grund§8: §f{4} +NOSCHEMRECEIVING_PERMA=§7Du bist §epermanent §7vom Erhalten von §e§lSchematics§7 ausgeschlossen§8. §7Grund§8: §e{0} +NOSCHEMRECEIVING_UNTIL=§7Du bist §ebis zum {0} §7vom Erhalten von §e§lSchematics§7 ausgeschlossen§8. §7Grund§8: §e{1} UNNOSCHEMRECEIVING_ERROR=§cDer Spieler ist nicht vom Erhalten von Schematics ausgeschlossen. -UNNOSCHEMRECEIVING=§e{0} §7darf nun wieder §e§lSchematics erhalten§8. +UNNOSCHEMRECEIVING=§e{0} §7darf nun wieder §e§lSchematics§7 erhalten§8. -NOSCHEMSHARING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicverteilen ausgeschlossen§8. §7Grund§8: §f{4} +NOSCHEMSHARING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicverteilen§7 ausgeschlossen§8. §7Grund§8: §f{4} NOSCHEMSHARING_PERMA=§7Du bist §epermanent §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0} NOSCHEMSHARING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1} UNNOSCHEMSHARING_ERROR=§cDer Spieler ist nicht vom Verteilen von Schematics ausgeschlossen. -UNNOSCHEMSHARING=§e{0} §7darf nun wieder §e§lSchematics verteilen§8. +UNNOSCHEMSHARING=§e{0} §7darf nun wieder §e§lSchematics§7 verteilen§8. -NOSCHEMSUBMITTING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematiceinsenden ausgeschlossen§8. §7Grund§8: §f{4} +NOSCHEMSUBMITTING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematiceinsenden§7 ausgeschlossen§8. §7Grund§8: §f{4} NOSCHEMSUBMITTING_PERMA=§7Du bist §epermanent §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0} NOSCHEMSUBMITTING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1} UNNOSCHEMSUBMITTING_ERROR=§cDer Spieler ist nicht vom Einsenden von Schematics ausgeschlossen. -UNNOSCHEMSUBMITTING=§e{0} §7darf nun wieder §e§lSchematis einsenden§8. +UNNOSCHEMSUBMITTING=§e{0} §7darf nun wieder §e§lSchematis§7 einsenden§8. -NODEVSERVER_TEAM={0} §e{1} §7hat §e{2} §7mit Grund §f{4}§7 zu generft und hat daher §e§lDevserververbot §7erhalten§8, §e{3} -NODEVSERVER_PERMA=§7Du bist §epermanent §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{0} -NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{1} +NODEVSERVER_TEAM={0} §e{1} §7hat §e{2} §7mit Grund §f{4}§7 zu generft und hat daher §e§lDevserververbot§7 erhalten§8, §e{3} +NODEVSERVER_PERMA=§7Du bist §epermanent §7vom §e§lDevserver§7 ausgeschlossen§8. §7Grund§8: §e{0} +NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver§7 ausgeschlossen§8. §7Grund§8: §e{1} UNNODEVSERVER_ERROR=§cDer Spieler ist nicht vom Devserver ausgeschlossen. -UNNODEVSERVER=§e{0} §7darf nun wieder dem §e§lDevserver beitreten§8. +UNNODEVSERVER=§e{0} §7darf nun wieder dem §e§lDevserver§7 beitreten§8. -NOFIGHTSERVER_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lKämpfen ausgeschlossen§8. §7Grund§8: §f{4} -NOFIGHTSERVER_PERMA=§7Du bist §epermanent §7vom §e§lKämpfen §7ausgeschlossen§8. §7Grund§8: §e{0} -NOFIGHTSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lKämpfen §7ausgeschlossen§8. §7Grund§8: §e{1} +NOFIGHTSERVER_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lKämpfen§7 ausgeschlossen§8. §7Grund§8: §f{4} +NOFIGHTSERVER_PERMA=§7Du bist §epermanent §7vom §e§lKämpfen§7 ausgeschlossen§8. §7Grund§8: §e{0} +NOFIGHTSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lKämpfen§7 ausgeschlossen§8. §7Grund§8: §e{1} UNNOFIGHTSERVER_ERROR=§cDer Spieler ist nicht vom Kämpfen ausgeschlossen. -UNNOFIGHTSERVER=§e{0} §7darf nun wieder §e§lKämpfen beitreten§8. +UNNOFIGHTSERVER=§e{0} §7darf nun wieder §e§lKämpfen§7 beitreten§8. #BugCommand BUG_MESSAGE=§7Dein Bugreport wurde gespeichert. From d48c81c610a22b483f53f35069ec8f5335d30f37 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 3 Apr 2022 23:25:08 +0200 Subject: [PATCH 13/19] Hotfix stuff --- src/de/steamwar/messages/BungeeCore.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 5d98974..8542153 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -148,7 +148,7 @@ NOSCHEMSUBMITTING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lEinsenden von Sch UNNOSCHEMSUBMITTING_ERROR=§cDer Spieler ist nicht vom Einsenden von Schematics ausgeschlossen. UNNOSCHEMSUBMITTING=§e{0} §7darf nun wieder §e§lSchematis§7 einsenden§8. -NODEVSERVER_TEAM={0} §e{1} §7hat §e{2} §7mit Grund §f{4}§7 zu generft und hat daher §e§lDevserververbot§7 erhalten§8, §e{3} +NODEVSERVER_TEAM={0} §e{1} §7hat §e{2} §7mit Grund §f{4}§7 zu generft und hat daher §e§lDevserververbot§7 erhalten§8, §f{3} NODEVSERVER_PERMA=§7Du bist §epermanent §7vom §e§lDevserver§7 ausgeschlossen§8. §7Grund§8: §e{0} NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver§7 ausgeschlossen§8. §7Grund§8: §e{1} UNNODEVSERVER_ERROR=§cDer Spieler ist nicht vom Devserver ausgeschlossen. From cb52e0bc38cb02996d3f25394fab9add37ecd0b1 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:12:51 +0200 Subject: [PATCH 14/19] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 5 +++++ .../steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java | 1 + 2 files changed, 6 insertions(+) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index 90365cd..1e0b675 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -42,6 +42,8 @@ public class Fabric extends BasicListener { private final Set neededMods = new HashSet<>(); + public static List checkedPlayers = new LinkedList<>(); + { neededMods.add("java"); neededMods.add("minecraft"); @@ -61,6 +63,8 @@ public class Fabric extends BasicListener { ProxiedPlayer player = (ProxiedPlayer) e.getSender(); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + if(checkedPlayers.contains(player)) return; + List mods = new LinkedList<>(); byte[] data = e.getData(); @@ -108,6 +112,7 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { + checkedPlayers.add(player); Storage.fabricPlayers.remove(player); Message.send("MODIFICATION_CHECK_SUCCESS", player); } diff --git a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java index a4d54e6..134c7f8 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java +++ b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java @@ -58,6 +58,7 @@ public class ModLoaderBlocker extends BasicListener { @EventHandler public void onDisconnect(PlayerDisconnectEvent e){ + Fabric.checkedPlayers.remove(e.getPlayer()); Storage.fabricPlayers.remove(e.getPlayer()); } From 9ef4062d4a2a2b0a147de6c11f3be4fa5f5165e9 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:24:23 +0200 Subject: [PATCH 15/19] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index 1e0b675..e9e1f52 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -42,7 +42,7 @@ public class Fabric extends BasicListener { private final Set neededMods = new HashSet<>(); - public static List checkedPlayers = new LinkedList<>(); + public static final Set checkedPlayers = new HashSet<>(); { neededMods.add("java"); @@ -63,8 +63,6 @@ public class Fabric extends BasicListener { ProxiedPlayer player = (ProxiedPlayer) e.getSender(); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); - if(checkedPlayers.contains(player)) return; - List mods = new LinkedList<>(); byte[] data = e.getData(); @@ -112,9 +110,9 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { + if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); checkedPlayers.add(player); Storage.fabricPlayers.remove(player); - Message.send("MODIFICATION_CHECK_SUCCESS", player); } } From 5a9b79e98042646ac7f845038a1265acd200fd99 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:24:41 +0200 Subject: [PATCH 16/19] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index e9e1f52..ae3024a 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -110,8 +110,8 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { - if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); checkedPlayers.add(player); + if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); Storage.fabricPlayers.remove(player); } } From e4268efd8b36c4e3d44fa2266124c0bcd32a999a Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Tue, 5 Apr 2022 18:25:17 +0200 Subject: [PATCH 17/19] Remove Redundant Message when switching Servers --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index ae3024a..eff649e 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -110,8 +110,10 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { - checkedPlayers.add(player); - if(!checkedPlayers.contains(player)) Message.send("MODIFICATION_CHECK_SUCCESS", player); + if(!checkedPlayers.contains(player)) { + Message.send("MODIFICATION_CHECK_SUCCESS", player); + checkedPlayers.add(player); + } Storage.fabricPlayers.remove(player); } } From a8507a1920901d7646a34b4e553c312f8045c219 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 5 Apr 2022 19:02:25 +0200 Subject: [PATCH 18/19] Update some stuff --- .../steamwar/bungeecore/listeners/mods/Fabric.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index eff649e..825d80e 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -42,7 +42,7 @@ public class Fabric extends BasicListener { private final Set neededMods = new HashSet<>(); - public static final Set checkedPlayers = new HashSet<>(); + public static final Map checkedPlayers = new HashMap<>(); { neededMods.add("java"); @@ -110,9 +110,15 @@ public class Fabric extends BasicListener { } if(Utils.handleMods(player,mods)) { - if(!checkedPlayers.contains(player)) { + if (checkedPlayers.containsKey(player)) { + long current = checkedPlayers.get(player); + if (current != dataString.hashCode()) { + banPlayer(user, player); + return; + } + } else { Message.send("MODIFICATION_CHECK_SUCCESS", player); - checkedPlayers.add(player); + checkedPlayers.put(player, dataString.hashCode()); } Storage.fabricPlayers.remove(player); } From c8c4ee0039bef533a80e4b8060940067fe3c8d2c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 5 Apr 2022 19:25:42 +0200 Subject: [PATCH 19/19] Update some stuff --- src/de/steamwar/bungeecore/commands/HistoricCommand.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index 65a42e9..c13c33e 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -19,12 +19,12 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.*; -import de.steamwar.bungeecore.sql.Punishment; -import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.bungeecore.ArenaMode; +import de.steamwar.bungeecore.Message; +import de.steamwar.bungeecore.ServerStarter; +import de.steamwar.bungeecore.Subserver; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.LinkedList;