From 6699e3843fb187d0916ecf18a964c38f055925b4 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 21 Feb 2023 13:31:03 +0100 Subject: [PATCH 01/26] Seperate SchematicData --- .../bungeecore/sql/SchematicNode.java | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/SchematicNode.java b/src/de/steamwar/bungeecore/sql/SchematicNode.java index 66a9183..02b3974 100644 --- a/src/de/steamwar/bungeecore/sql/SchematicNode.java +++ b/src/de/steamwar/bungeecore/sql/SchematicNode.java @@ -32,30 +32,30 @@ import java.util.function.Predicate; public class SchematicNode { private static final Statement createNode = new Statement("INSERT INTO SchematicNode (NodeName, NodeOwner, ParentNode, NodeType, NodeItem) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE NodeName = VALUES(NodeName), ParentNode = VALUES(ParentNode), NodeItem = VALUES(NodeItem), NodeType = VALUES(NodeType), NodeItem = VALUES(NodeItem)"); - private static final Statement getSchematicNode_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode is NULL"); - private static final Statement getSchematicNode = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode = ?"); - private static final Statement getSchematicsInNode_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE ParentNode is NULL"); - private static final Statement getSchematicsInNode = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE ParentNode = ?"); - private static final Statement getDirsInNode_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE ParentNode is NULL AND NodeType is NULL"); - private static final Statement getDirsInNode = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE ParentNode = ? AND NodeType is NULL"); - private static final Statement getSchematicDirectory_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode is NULL"); - private static final Statement getSchematicDirectory = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode = ?"); - private static final Statement getSchematicNodeO_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode is NULL"); - private static final Statement getSchematicNodeO = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode = ?"); - private static final Statement getSchematicNodeId = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeId = ?"); - private static final Statement getAllSchemsOfTypeOwner = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeType = ?"); - private static final Statement getAllSchemsOfType = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeType = ?"); - private static final Statement getAccessibleByUser = new Statement("SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.NodeFormat, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) AND ((s.NodeOwner = ? AND s.ParentNode IS NULL) OR NOT s.NodeOwner = ?) GROUP BY s.NodeId ORDER BY s.NodeName"); - private static final Statement getAccessibleByUserByTypeInNode = new Statement("WITH RECURSIVE RSNB AS (WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.NodeFormat, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN WHERE NodeType = ? union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode AS SN, RSNB WHERE SN.NodeId = RSNB.ParentNode)SELECT * FROM RSNB WHERE ParentNode = ?"); - private static final Statement getAccessibleByUserByTypeInNode_Null = new Statement("WITH RECURSIVE RSNB AS (WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.NodeFormat, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN WHERE NodeType = ? union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode AS SN, RSNB WHERE SN.NodeId = RSNB.ParentNode)SELECT * FROM RSNB WHERE ParentNode is null"); - private static final Statement getAccessibleByUserByType = new Statement("WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.NodeFormat, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN WHERE NodeType = ?"); - private static final Statement getAllSchematicsAccessibleByUser = new Statement("WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.NodeFormat, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN"); - private static final Statement isSchematicAccessibleForUser = new Statement("WITH RECURSIVE RSN AS (SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeId = ? union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.ParentNode, SN.NodeType, SN.NodeItem, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode SN, RSN WHERE RSN.ParentNode = SN.NodeId) SELECT COUNT(RSN.NodeId) AS `Accessible` FROM RSN LEFT Join NodeMember NM On NM.NodeId = RSN.NodeId WHERE NodeOwner = ? OR UserId = ? LIMIT 1"); - private static final Statement getAllParentsOfNode = new Statement("WITH RECURSIVE RSN AS (SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeId = ? UNION SELECT SN.NodeId, SN.NodeName, SN.NodeOwner, SN.ParentNode, SN.NodeType, SN.NodeItem, SN.NodeRank, SN.NodeFormat, SN.LastUpdate FROM SchematicNode SN, RSN WHERE RSN.ParentNode = SN.NodeId) SELECT * FROM RSN"); + private static final Statement getSchematicNode_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode is NULL"); + private static final Statement getSchematicNode = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode = ?"); + private static final Statement getSchematicsInNode_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE ParentNode is NULL"); + private static final Statement getSchematicsInNode = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE ParentNode = ?"); + private static final Statement getDirsInNode_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE ParentNode is NULL AND NodeType is NULL"); + private static final Statement getDirsInNode = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE ParentNode = ? AND NodeType is NULL"); + private static final Statement getSchematicDirectory_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode is NULL"); + private static final Statement getSchematicDirectory = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode = ?"); + private static final Statement getSchematicNodeO_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode is NULL"); + private static final Statement getSchematicNodeO = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeName = ? AND ParentNode = ?"); + private static final Statement getSchematicNodeId = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeId = ?"); + private static final Statement getAllSchemsOfTypeOwner = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeType = ?"); + private static final Statement getAllSchemsOfType = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeType = ?"); + private static final Statement getAccessibleByUser = new Statement("SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) AND ((s.NodeOwner = ? AND s.ParentNode IS NULL) OR NOT s.NodeOwner = ?) GROUP BY s.NodeId ORDER BY s.NodeName"); + private static final Statement getAccessibleByUserByTypeInNode = new Statement("WITH RECURSIVE RSNB AS (WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN WHERE NodeType = ? union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.LastUpdate FROM SchematicNode AS SN, RSNB WHERE SN.NodeId = RSNB.ParentNode)SELECT * FROM RSNB WHERE ParentNode = ?"); + private static final Statement getAccessibleByUserByTypeInNode_Null = new Statement("WITH RECURSIVE RSNB AS (WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN WHERE NodeType = ? union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.LastUpdate FROM SchematicNode AS SN, RSNB WHERE SN.NodeId = RSNB.ParentNode)SELECT * FROM RSNB WHERE ParentNode is null"); + private static final Statement getAccessibleByUserByType = new Statement("WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN WHERE NodeType = ?"); + private static final Statement getAllSchematicsAccessibleByUser = new Statement("WITH RECURSIVE RSN as (SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode, s.NodeRank, s.LastUpdate FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) GROUP BY s.NodeId union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.NodeItem, SN.NodeType, SN.ParentNode, SN.NodeRank, SN.LastUpdate FROM SchematicNode AS SN, RSN WHERE SN.ParentNode = RSN.NodeId) SELECT * FROM RSN"); + private static final Statement isSchematicAccessibleForUser = new Statement("WITH RECURSIVE RSN AS (SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeId = ? union select SN.NodeId, SN.NodeName, SN.NodeOwner, SN.ParentNode, SN.NodeType, SN.NodeItem, SN.NodeRank, SN.LastUpdate FROM SchematicNode SN, RSN WHERE RSN.ParentNode = SN.NodeId) SELECT COUNT(RSN.NodeId) AS `Accessible` FROM RSN LEFT Join NodeMember NM On NM.NodeId = RSN.NodeId WHERE NodeOwner = ? OR UserId = ? LIMIT 1"); + private static final Statement getAllParentsOfNode = new Statement("WITH RECURSIVE RSN AS (SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, LastUpdate FROM SchematicNode WHERE NodeId = ? UNION SELECT SN.NodeId, SN.NodeName, SN.NodeOwner, SN.ParentNode, SN.NodeType, SN.NodeItem, SN.NodeRank, SN.LastUpdate FROM SchematicNode SN, RSN WHERE RSN.ParentNode = SN.NodeId) SELECT * FROM RSN"); private static final Statement countNodes = new Statement("SELECT COUNT(NodeId) AS 'count' FROM SchematicNode"); private static final Statement updateDB = new Statement("UPDATE SchematicNode SET NodeName = ?, NodeOwner = ?, ParentNode = ?, NodeItem = ?, NodeType = ?, NodeRank = ? WHERE NodeId = ?"); - private static final Statement updateDatabase = new Statement("UPDATE SchematicNode SET NodeData = ?, NodeFormat = ? WHERE NodeId = ?"); - private static final Statement selSchemData = new Statement("SELECT NodeData FROM SchematicNode WHERE NodeId = ?"); + private static final Statement updateDatabase = new Statement("UPDATE NodeData SET SchemData = ?, NodeFormat = ? WHERE NodeId = ?"); + private static final Statement selSchemData = new Statement("SELECT SchemData FROM NodeData WHERE NodeId = ?"); private static final Statement deleteNode = new Statement("DELETE FROM SchematicNode WHERE NodeId = ?"); public static SchematicNode createSchematic(int owner, String name, Integer parent) { @@ -93,7 +93,6 @@ public class SchematicNode { if (type != null) { isDir = false; rank = set.getInt("NodeRank"); - schemFormat = set.getBoolean("NodeFormat"); } else { isDir = true; } @@ -305,7 +304,6 @@ public class SchematicNode { private Integer parent; private String item; private String type; - private boolean schemFormat; private int rank; private final boolean isDir; private Map brCache = new HashMap<>(); @@ -385,10 +383,11 @@ public class SchematicNode { return isDir; } + @Deprecated public boolean getSchemFormat() { if(isDir) throw new SecurityException("Node is Directory"); - return schemFormat; + return true; } public int getRank() { @@ -475,7 +474,6 @@ public class SchematicNode { private void updateDatabase(InputStream blob, boolean newFormat) { updateDatabase.update(blob, newFormat, id); - schemFormat = newFormat; } private static final List FORBIDDEN_NAMES = Collections.unmodifiableList(Arrays.asList("public")); From 4441e9fa0c98678121a943d242d6f334cfff5306 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 23 Feb 2023 14:04:05 +0100 Subject: [PATCH 02/26] Update CommonCore: Team Lookup fix Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index b2b96cf..95b46f3 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit b2b96cff0477dc3078c1abfd8f8b047e3a6d903d +Subproject commit 95b46f3a9a83eb63f5770552134967a1921ae159 From 724246e48e0dcff7a363e3e5b9bfb1bb91d2213b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 23 Feb 2023 17:33:30 +0100 Subject: [PATCH 03/26] Update to CommonDB --- CommonCore | 2 +- .../bot/listeners/PrivateMessageListener.java | 4 +- src/de/steamwar/sql/SchematicData.java | 47 ------------------- 3 files changed, 3 insertions(+), 50 deletions(-) delete mode 100644 src/de/steamwar/sql/SchematicData.java diff --git a/CommonCore b/CommonCore index 95b46f3..d22bb36 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 95b46f3a9a83eb63f5770552134967a1921ae159 +Subproject commit d22bb36fc348fae373713b83235cef67010cf020 diff --git a/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java b/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java index d6ef0d4..08726e4 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; @@ -67,7 +67,7 @@ public class PrivateMessageListener extends BasicDiscordListener { 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/sql/SchematicData.java b/src/de/steamwar/sql/SchematicData.java deleted file mode 100644 index 6152ad9..0000000 --- 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 From 37dc1df094e0387792a258d75cfde0829e88c6e7 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 23 Feb 2023 18:20:04 +0100 Subject: [PATCH 04/26] Add License Header --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index d22bb36..9c6a7cf 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit d22bb36fc348fae373713b83235cef67010cf020 +Subproject commit 9c6a7cf07dd25d1a4f12c4451373927d413dd9f4 From 7750398466805785a8417968792b063eb003d5ce Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 24 Feb 2023 09:31:35 +0100 Subject: [PATCH 05/26] Fix Queries --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index 9c6a7cf..178c96e 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 9c6a7cf07dd25d1a4f12c4451373927d413dd9f4 +Subproject commit 178c96e7c6e4fe7e7833194c976d2289340c31f3 From 2a69cadda82202e66ea8e66107b1db6b74ffd2cc Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 24 Feb 2023 10:15:45 +0100 Subject: [PATCH 06/26] Fix Schematic Upload --- .../bungeecore/bot/listeners/PrivateMessageListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java b/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java index 08726e4..58800d0 100644 --- a/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java +++ b/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java @@ -60,7 +60,7 @@ 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); } From 2f7f561c1684cf0b2c04f911bfe5c4a638df3e36 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 24 Feb 2023 10:25:03 +0100 Subject: [PATCH 07/26] Add BIS --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index 178c96e..aa91584 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 178c96e7c6e4fe7e7833194c976d2289340c31f3 +Subproject commit aa91584a1e361f5b466f4e359462051d5e065da3 From c096c5cbdfb165275668cd6db8be3eb7b6835636 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 24 Feb 2023 10:39:54 +0100 Subject: [PATCH 08/26] Update CommonCore Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index aa91584..fe09afd 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit aa91584a1e361f5b466f4e359462051d5e065da3 +Subproject commit fe09afdb34242696944ffd214322151ec19c76dd From a681edd57eaab229d9db7a5956cb13b88f11a202 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 24 Feb 2023 13:36:26 +0100 Subject: [PATCH 09/26] Hotfix NPE Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index fe09afd..38457db 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit fe09afdb34242696944ffd214322151ec19c76dd +Subproject commit 38457db0141d34e6f9f133e70bc3061b8a3d3e5a From 6e52fd7ded2dc5d15b036d7090387cfe392e348a Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 24 Feb 2023 17:08:26 +0100 Subject: [PATCH 10/26] Hotfix NPE Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index 38457db..ec9d56d 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 38457db0141d34e6f9f133e70bc3061b8a3d3e5a +Subproject commit ec9d56dab9091ddf514b5d8066c8313f5ad18c75 From 758365bc7630aa909d1de914e368485e62a21240 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 24 Feb 2023 20:21:21 +0100 Subject: [PATCH 11/26] Hotfix TeamCommand --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index ab010db..3efca89 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -363,7 +363,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){ From 891f39b28e846f493485e17a7675af3d21c3fa94 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 24 Feb 2023 20:21:57 +0100 Subject: [PATCH 12/26] Fix formatting Signed-off-by: Lixfel --- src/de/steamwar/sql/SQLWrapperImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/sql/SQLWrapperImpl.java b/src/de/steamwar/sql/SQLWrapperImpl.java index 176dfd4..3c24da8 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(") "); } } } From 0db89d14249d443947a55f21d195b75f3b94295c Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 25 Feb 2023 07:35:48 +0100 Subject: [PATCH 13/26] Update BannedUserIPs Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index ec9d56d..3a8df67 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit ec9d56dab9091ddf514b5d8066c8313f5ad18c75 +Subproject commit 3a8df67f197748e24921f69a1c1c77ac6528ce05 From 5c6390f1f1aea9c3fcd5316b59691e5fa3ba2dc3 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 26 Feb 2023 15:50:34 +0100 Subject: [PATCH 14/26] Fix MemberCache invalidation Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index 3a8df67..e36022e 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 3a8df67f197748e24921f69a1c1c77ac6528ce05 +Subproject commit e36022e64fdb6d3ec58d85ae734766a141674c0a From ed3f8d836251a42df5dadc433643b10198822406 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 3 Mar 2023 16:14:34 +0100 Subject: [PATCH 15/26] Change to 1.19.3 Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ServerStarter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/ServerStarter.java b/src/de/steamwar/bungeecore/ServerStarter.java index 48aa65a..b71fd86 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; From 603f3a09bff3e00b72dc29c1c2dc541621859e08 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 3 Mar 2023 18:00:59 +0100 Subject: [PATCH 16/26] Fix zero broadcast messages Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/Broadcaster.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/Broadcaster.java b/src/de/steamwar/bungeecore/Broadcaster.java index 925625c..3020d01 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){ From 2f2584a6aea93414f7af4efe6d9f153125062a10 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 4 Mar 2023 11:55:58 +0100 Subject: [PATCH 17/26] No Discord on EventBungee Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/BungeeCore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 4070bd7..ec81983 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -340,7 +340,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) { From 1a6fbb5a191d619b2803d831f87ce431ff655fe0 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 4 Mar 2023 12:12:24 +0100 Subject: [PATCH 18/26] Update CommonCore Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index e36022e..36bb4db 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit e36022e64fdb6d3ec58d85ae734766a141674c0a +Subproject commit 36bb4db5152940eb9b190552607c23079f6abee6 From 09c600ebed8054d98087a1ef029b8cd4e05d937a Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 4 Mar 2023 12:13:20 +0100 Subject: [PATCH 19/26] Update CommonCore Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index 36bb4db..32de0b9 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 36bb4db5152940eb9b190552607c23079f6abee6 +Subproject commit 32de0b912d823d90de274885ab2beaa6aa6d190a From b5ca36c0d1f3d69374c5a28f31dc519aba26e094 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 4 Mar 2023 12:36:53 +0100 Subject: [PATCH 20/26] Update CommonCore --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index ec9d56d..92cddba 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit ec9d56dab9091ddf514b5d8066c8313f5ad18c75 +Subproject commit 92cddbada179e32061b6497e7bdc81b7e0efa8b5 From a0f21a95da4f087224a02f6aac9bc9f5b708f62b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 5 Mar 2023 15:39:38 +0100 Subject: [PATCH 21/26] Fix Reasonless Punishments --- src/de/steamwar/bungeecore/commands/PunishmentCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PunishmentCommand.java b/src/de/steamwar/bungeecore/commands/PunishmentCommand.java index 23ba5f2..3a96b49 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; From b6612fcf379a93d4851aa5ec8962f58779a8725f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 5 Mar 2023 21:55:10 +0100 Subject: [PATCH 22/26] Update CommonCore --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index 92cddba..6f78469 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 92cddbada179e32061b6497e7bdc81b7e0efa8b5 +Subproject commit 6f7846956e41e1528e5e0d092db3affdb94a6a0c From 24d4c9b213b599a0571d8dddfb03923c6176255e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 5 Mar 2023 21:59:30 +0100 Subject: [PATCH 23/26] Update CommonCore --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index 6f78469..7474478 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 6f7846956e41e1528e5e0d092db3affdb94a6a0c +Subproject commit 7474478489da42735a32e84b3f91144c64847e30 From 1f83004d64465b5de706864a54f9ebd13030ac81 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 10 Mar 2023 11:50:47 +0100 Subject: [PATCH 24/26] Fix tutorial rate misusers Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/TutorialCommand.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TutorialCommand.java b/src/de/steamwar/bungeecore/commands/TutorialCommand.java index 9fdc967..aa27b76 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; } From 92da1d8bc2fc930bb0cb63d1d08c7fb163de922d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Mar 2023 21:35:28 +0100 Subject: [PATCH 25/26] Fix Tab Team Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/tablist/Tablist.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index b34fbad..299bff2 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<>(); From 341cff0507921933dc5b614f569b2884e7d123de Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 13 Mar 2023 16:31:11 +0100 Subject: [PATCH 26/26] Fix NoFight punishment for EventCommand --- .../steamwar/bungeecore/commands/EventCommand.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 9ea7c9b..fe197e7 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)