diff --git a/CommonCore b/CommonCore index b2b96cff..74744784 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit b2b96cff0477dc3078c1abfd8f8b047e3a6d903d +Subproject commit 7474478489da42735a32e84b3f91144c64847e30 diff --git a/src/de/steamwar/bungeecore/Broadcaster.java b/src/de/steamwar/bungeecore/Broadcaster.java index 925625c6..3020d013 100644 --- a/src/de/steamwar/bungeecore/Broadcaster.java +++ b/src/de/steamwar/bungeecore/Broadcaster.java @@ -30,7 +30,7 @@ class Broadcaster { Broadcaster(){ ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { - if(!ProxyServer.getInstance().getPlayers().isEmpty()) + if(!ProxyServer.getInstance().getPlayers().isEmpty() && broadCastMsgs.length > 0) BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + broadCastMsgs[lastBroadCast]); lastBroadCast++; if(lastBroadCast == broadCastMsgs.length){ diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 8312327e..33a904f4 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -345,7 +345,7 @@ public class BungeeCore extends Plugin { } File discordFile = new File(System.getProperty("user.home"), "discord.yml"); - if(discordFile.exists()) { + if(discordFile.exists() && !EVENT_MODE) { try { SteamwarDiscordBotConfig.loadConfig(ConfigurationProvider.getProvider(YamlConfiguration.class).load(discordFile)); } catch (IOException e) { diff --git a/src/de/steamwar/bungeecore/ServerStarter.java b/src/de/steamwar/bungeecore/ServerStarter.java index 48aa65a2..b71fd864 100644 --- a/src/de/steamwar/bungeecore/ServerStarter.java +++ b/src/de/steamwar/bungeecore/ServerStarter.java @@ -116,7 +116,7 @@ public class ServerStarter { public ServerStarter build19(UUID owner) { directory = new File(SERVER_PATH, "Bau19"); - serverJar = "paper-1.19.2.jar"; + serverJar = "paper-1.19.3.jar"; worldDir = WORLDS19_PATH; worldName = String.valueOf(SteamwarUser.get(owner).getId()); buildWithWorld(owner, new File(directory, "Bauwelt").getPath()); @@ -337,7 +337,7 @@ public class ServerStarter { public enum Version { SPIGOT_12("spigot-1.12.2.jar", 12), SPIGOT_15("spigot-1.15.2.jar", 15), - PAPER_19("paper-1.19.2.jar", 19); + PAPER_19("paper-1.19.3.jar", 19); private final String serverJar; private final int versionSuffix; diff --git a/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java b/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java index 6a9b1ca5..3411d634 100644 --- a/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java +++ b/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java @@ -19,8 +19,8 @@ package de.steamwar.bungeecore.bot.listeners; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.sql.NodeData; import de.steamwar.sql.Punishment; -import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; import net.dv8tion.jda.api.entities.Message; @@ -66,14 +66,14 @@ public class PrivateMessageListener extends BasicDiscordListener { continue; } - SchematicNode node = SchematicNode.getSchematicNode(user.getId(), name, 0); + SchematicNode node = SchematicNode.getSchematicNode(user.getId(), name, (Integer) null); if(node == null) { node = SchematicNode.createSchematic(user.getId(), name, null); } try { InputStream in = attachment.retrieveInputStream().get(); - new SchematicData(node).saveFromStream(in, newFormat); + NodeData.get(node).saveFromStream(in, newFormat); in.close(); event.getMessage().reply("`" + name + "` wurde erfolgreich hochgeladen").queue(); } catch (Exception e) { diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 9ea7c9b6..fe197e72 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -20,11 +20,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; -import de.steamwar.sql.EventFight; -import de.steamwar.sql.SchematicType; -import de.steamwar.sql.Team; -import de.steamwar.sql.TeamTeilnahme; -import de.steamwar.sql.Event; +import de.steamwar.messages.ChatSender; +import de.steamwar.sql.*; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; @@ -121,7 +118,10 @@ public class EventCommand extends SWCommand { Message.send("EVENT_NO_FIGHT_TEAM", player); return; } - SubserverSystem.sendPlayer(eventArena, player); + ChatSender sender = ChatSender.of(player); + if (!PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer)) { + SubserverSystem.sendPlayer(eventArena, player); + } } @ClassMapper(Team.class) diff --git a/src/de/steamwar/bungeecore/commands/PunishmentCommand.java b/src/de/steamwar/bungeecore/commands/PunishmentCommand.java index 23ba5f24..3a96b490 100644 --- a/src/de/steamwar/bungeecore/commands/PunishmentCommand.java +++ b/src/de/steamwar/bungeecore/commands/PunishmentCommand.java @@ -115,7 +115,7 @@ public class PunishmentCommand { public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) { new SWCommand(command, "bungeecore.ban") { @Register(description = "PUNISHMENT_USAGE") - public void genericCommand(ProxiedPlayer player, String toPunish, String date, String... message) { + public void genericCommand(ProxiedPlayer player, String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE") String... message) { SteamwarUser punisher = SteamwarUser.get(player.getUniqueId()); if (punishmentType.isNeedsAdmin() && !punisher.getUserGroup().isAdminGroup()) { return; diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 95d308ee..adbab809 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -367,7 +367,7 @@ public class TeamCommand extends SWCommand { public void info(ProxiedPlayer player, String... args){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(args.length == 1 && user.getTeam() == 0){ + if(args.length == 0 && user.getTeam() == 0){ Message.send("TEAM_INFO_USAGE", player); return; }else if(user.getTeam() == 0 || args.length == 1){ diff --git a/src/de/steamwar/bungeecore/commands/TutorialCommand.java b/src/de/steamwar/bungeecore/commands/TutorialCommand.java index 9fdc9677..aa27b768 100644 --- a/src/de/steamwar/bungeecore/commands/TutorialCommand.java +++ b/src/de/steamwar/bungeecore/commands/TutorialCommand.java @@ -24,11 +24,11 @@ import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.inventory.SWStreamInv; -import de.steamwar.sql.SteamwarUser; -import de.steamwar.sql.Tutorial; import de.steamwar.bungeecore.util.Chat19; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.Tutorial; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -37,7 +37,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; import java.util.stream.Collectors; public class TutorialCommand extends SWCommand { @@ -60,7 +59,7 @@ public class TutorialCommand extends SWCommand { public void rate(ProxiedPlayer player, int id) { Tutorial tutorial = Tutorial.get(id); if(tutorial == null) { - BungeeCore.get().getLogger().log(Level.SEVERE, "rate executed with nonexistent id: " + id); + Chat19.chat(player, "/tutorial rate"); // Catch players manually entering numbers return; } diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index b34fbad8..299bff2a 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -47,7 +47,7 @@ public class Tablist extends MessageToMessageDecoder { private static final UUID[] uuids = IntStream.range(0, 80).mapToObj(i -> UUID.randomUUID()).toArray(UUID[]::new); private static final String[] names = IntStream.range(0, 80).mapToObj(i -> " »SW« " + String.format("%02d", i)).toArray(String[]::new); private static final String TAB_TEAM = "»SW-Tab"; - private static final Team teamPacket = new Team(TAB_TEAM, (byte) 0, ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), "always", "always", 21, (byte)0x00, names); + private static final Team teamPacket = new Team(TAB_TEAM, (byte) 0, ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), "never", "always", 21, (byte)0x00, names); private final Map directTabItems; private final Set npcs = new HashSet<>(); diff --git a/src/de/steamwar/sql/SQLWrapperImpl.java b/src/de/steamwar/sql/SQLWrapperImpl.java index 176dfd4d..3c24da83 100644 --- a/src/de/steamwar/sql/SQLWrapperImpl.java +++ b/src/de/steamwar/sql/SQLWrapperImpl.java @@ -100,7 +100,7 @@ public class SQLWrapperImpl implements SQLWrapper { for(ProxiedPlayer player : server.getValue().getPlayers()) { builder.append(player.getName()).append(" "); } - builder.append(")"); + builder.append(") "); } } } diff --git a/src/de/steamwar/sql/SchematicData.java b/src/de/steamwar/sql/SchematicData.java deleted file mode 100644 index 6152ad93..00000000 --- a/src/de/steamwar/sql/SchematicData.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2023 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.sql; - -import de.steamwar.sql.internal.SqlTypeMapper; -import de.steamwar.sql.internal.Statement; - -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.sql.PreparedStatement; - -public class SchematicData { - - static { - new SqlTypeMapper<>(BufferedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("PipedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream); - } - - private static final Statement updateDatabase = new Statement("UPDATE SchematicNode SET NodeData = ?, NodeFormat = ? WHERE NodeId = ?"); - - private final SchematicNode node; - - public SchematicData(SchematicNode node) { - this.node = node; - } - - public void saveFromStream(InputStream blob, boolean newFormat) { - updateDatabase.update(new BufferedInputStream(blob), newFormat, node.getId()); - node.setNodeFormat(newFormat); - } -} \ No newline at end of file