From 3713f828b26f15353372fa0159dd7fe005bb15d9 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 30 May 2022 12:16:07 +0200 Subject: [PATCH 1/8] Add schem deadline message to /event --- .../bungeecore/commands/EventCommand.java | 9 ++-- .../bungeecore/sql/SchematicType.java | 41 +++++++++++++++++-- .../steamwar/messages/BungeeCore.properties | 1 + .../messages/BungeeCore_de.properties | 1 + 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index c6ed448..3719ed2 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -20,10 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; -import de.steamwar.bungeecore.sql.Event; -import de.steamwar.bungeecore.sql.EventFight; -import de.steamwar.bungeecore.sql.Team; -import de.steamwar.bungeecore.sql.TeamTeilnahme; +import de.steamwar.bungeecore.sql.*; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -84,6 +81,10 @@ public class EventCommand extends BasicCommand { if(now.isBefore(e.getDeadline().toInstant())) { Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); } + SchematicType schematicType = SchematicType.get(e); + if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { + Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline()); + } if(!teams.isEmpty()){ StringBuilder tline = new StringBuilder(); for(Team t : teams){ diff --git a/src/de/steamwar/bungeecore/sql/SchematicType.java b/src/de/steamwar/bungeecore/sql/SchematicType.java index 978ab94..1ccb33c 100644 --- a/src/de/steamwar/bungeecore/sql/SchematicType.java +++ b/src/de/steamwar/bungeecore/sql/SchematicType.java @@ -27,14 +27,17 @@ import net.md_5.bungee.config.YamlConfiguration; import java.io.File; import java.io.IOException; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; public class SchematicType { - public static final SchematicType Normal = new SchematicType("Normal", "", null, Type.NORMAL, null); //Has to stay publicly availible + public static final SchematicType Normal = new SchematicType("Normal", "", null, Type.NORMAL, null, null); //Has to stay publicly availible private static final Map fromDB; private static final Map fightType; private static final List types; + private static final Map eventSchematicTypes; static { File folder = new File(ProxyServer.getInstance().getPluginsFolder(), "FightSystem"); @@ -42,6 +45,7 @@ public class SchematicType { List tmpTypes = new LinkedList<>(); Map tmpFromDB = new HashMap<>(); Map tmpFightType = new HashMap<>(); + Map tmpEventType = new HashMap<>(); tmpTypes.add(Normal); tmpFromDB.put(Normal.name().toLowerCase(), Normal); @@ -68,22 +72,41 @@ public class SchematicType { SchematicType checktype = null; if(!config.getStringList("CheckQuestions").isEmpty()) { - checktype = new SchematicType("C" + type, "C" + shortcut, material, Type.CHECK_TYPE, null); + checktype = new SchematicType("C" + type, "C" + shortcut, material, Type.CHECK_TYPE, null, null); tmpTypes.add(checktype); tmpFromDB.put(checktype.toDB(), checktype); CheckCommand.setCheckQuestions(checktype, config); } - SchematicType current = new SchematicType(type, shortcut, material, config.getKeys().contains("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype); + Date deadline; + String deadlineString = config.getString("deadline", null); + if (deadlineString != null) { + try { + SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); + deadline = dateFormat.parse(deadlineString); + } catch (ParseException e) { + throw new SecurityException(e.getMessage(), e); + } + } else { + deadline = null; + } + + SchematicType current = new SchematicType(type, shortcut, material, config.getKeys().contains("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype, deadline); if(checktype != null) tmpFightType.put(checktype, current); tmpFromDB.put(type.toLowerCase(), current); + + Integer eventID = config.get("eventID", null); + if (eventID != null) { + tmpEventType.put(eventID, current); + } } } fromDB = Collections.unmodifiableMap(tmpFromDB); fightType = Collections.unmodifiableMap(tmpFightType); types = Collections.unmodifiableList(tmpTypes); + eventSchematicTypes = Collections.unmodifiableMap(tmpEventType); } private final String name; @@ -91,13 +114,15 @@ public class SchematicType { private final String material; private final Type type; private final SchematicType checkType; + private final Date deadline; - private SchematicType(String name, String kuerzel, String material, Type type, SchematicType checkType){ + private SchematicType(String name, String kuerzel, String material, Type type, SchematicType checkType, Date deadline){ this.name = name; this.kuerzel = kuerzel; this.material = material != null && !"".equals(material) ? material : "STONE_BUTTON"; this.type = type; this.checkType = checkType; + this.deadline = deadline; } public boolean isAssignable(){ @@ -140,6 +165,10 @@ public class SchematicType { return name.toLowerCase(); } + public Date deadline() { + return deadline; + } + public static SchematicType fromDB(String input){ return fromDB.getOrDefault(input.toLowerCase(), null); } @@ -148,6 +177,10 @@ public class SchematicType { return types; } + public static SchematicType get(Event event) { + return eventSchematicTypes.get(event.getEventID()); + } + enum Type{ NORMAL, CHECK_TYPE, diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index a71a2b9..f3e707a 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -233,6 +233,7 @@ EVENT_NO_CURRENT=§cThere is no event taking place currently EVENT_COMING=§eUpcoming events§8: EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} EVENT_COMING_DEADLINE=§7 Registration deadline§8: §7{0} +EVENT_COMING_SCHEM_DEADLINE=§7 Schematic deadline§8: §7{0} EVENT_COMING_TEAMS=§7 With§8:{0} EVENT_COMING_TEAM= §{0}{1} EVENT_CURRENT_EVENT=§e§l{0} diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 830ae45..42bf143 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -218,6 +218,7 @@ EVENT_NO_CURRENT=§cDerzeit findet kein Event statt EVENT_COMING=§eKommende Events§8: EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} EVENT_COMING_DEADLINE=§7 Anmeldeschluss§8: §7{0} +EVENT_COMING_SCHEM_DEADLINE=§7 Einsendeschluss§8: §7{0} EVENT_COMING_TEAMS=§7 Mit§8:{0} EVENT_COMING_TEAM= §{0}{1} EVENT_CURRENT_EVENT=§e§l{0} -- 2.39.2 From e3783c4bfe00308a08c642eb2adc6df676e6280b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 30 May 2022 15:34:58 +0200 Subject: [PATCH 2/8] Fix ErrorLogger --- src/de/steamwar/bungeecore/ErrorLogger.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/bungeecore/ErrorLogger.java b/src/de/steamwar/bungeecore/ErrorLogger.java index cbf1cc5..c60d7aa 100644 --- a/src/de/steamwar/bungeecore/ErrorLogger.java +++ b/src/de/steamwar/bungeecore/ErrorLogger.java @@ -89,6 +89,7 @@ public class ErrorLogger extends Handler { contains.add("Connection reset by peer"); contains.add("No client connected for pending server"); contains.add("Error occurred processing connection for"); + contains.add("Server is online mode!"); ignoreContains = Collections.unmodifiableList(contains); } } -- 2.39.2 From e61a98c2a3407951248758d25716329b3a0dae44 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 1 Jun 2022 23:19:30 +0200 Subject: [PATCH 3/8] Update some stuff --- CommonCore | 2 +- src/de/steamwar/bungeecore/commands/EventCommand.java | 9 ++++++--- src/de/steamwar/bungeecore/sql/Event.java | 5 +++++ src/de/steamwar/bungeecore/sql/SchematicType.java | 6 ------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CommonCore b/CommonCore index 0f03b57..919c4d5 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 0f03b57e437c1d843816b7202d95b79ff0a8d2df +Subproject commit 919c4d525ea39756b24bd961bb72d8d58bdd5bd4 diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 3719ed2..fc49281 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -81,9 +81,12 @@ public class EventCommand extends BasicCommand { if(now.isBefore(e.getDeadline().toInstant())) { Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); } - SchematicType schematicType = SchematicType.get(e); - if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { - Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline()); + String checkType = e.getCheckType(); + if (checkType != null) { + SchematicType schematicType = SchematicType.fromDB(checkType); + if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { + Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline()); + } } if(!teams.isEmpty()){ StringBuilder tline = new StringBuilder(); diff --git a/src/de/steamwar/bungeecore/sql/Event.java b/src/de/steamwar/bungeecore/sql/Event.java index 93fd211..41a5b03 100644 --- a/src/de/steamwar/bungeecore/sql/Event.java +++ b/src/de/steamwar/bungeecore/sql/Event.java @@ -41,6 +41,7 @@ public class Event { private final boolean publicSchemsOnly; private final boolean spectateSystem; private final Timestamp deadline; + private final String checkType; private static Event current = null; @@ -53,6 +54,7 @@ public class Event { this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly"); this.spectateSystem = rs.getBoolean("SpectateSystem"); this.deadline = rs.getTimestamp("Deadline"); + this.checkType = rs.getString("CheckType"); } public static Event get(){ @@ -123,4 +125,7 @@ public class Event { public Timestamp getDeadline() { return deadline; } + public String getCheckType() { + return checkType; + } } diff --git a/src/de/steamwar/bungeecore/sql/SchematicType.java b/src/de/steamwar/bungeecore/sql/SchematicType.java index 1ccb33c..f63633e 100644 --- a/src/de/steamwar/bungeecore/sql/SchematicType.java +++ b/src/de/steamwar/bungeecore/sql/SchematicType.java @@ -37,7 +37,6 @@ public class SchematicType { private static final Map fromDB; private static final Map fightType; private static final List types; - private static final Map eventSchematicTypes; static { File folder = new File(ProxyServer.getInstance().getPluginsFolder(), "FightSystem"); @@ -106,7 +105,6 @@ public class SchematicType { fromDB = Collections.unmodifiableMap(tmpFromDB); fightType = Collections.unmodifiableMap(tmpFightType); types = Collections.unmodifiableList(tmpTypes); - eventSchematicTypes = Collections.unmodifiableMap(tmpEventType); } private final String name; @@ -177,10 +175,6 @@ public class SchematicType { return types; } - public static SchematicType get(Event event) { - return eventSchematicTypes.get(event.getEventID()); - } - enum Type{ NORMAL, CHECK_TYPE, -- 2.39.2 From 082656e3ee637a244a53bf67e1dcf557d98a136d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 15 Jun 2022 17:38:30 +0200 Subject: [PATCH 4/8] Update deadline --- CommonCore | 2 +- src/de/steamwar/bungeecore/commands/EventCommand.java | 2 +- src/de/steamwar/bungeecore/sql/Event.java | 8 ++++---- src/de/steamwar/messages/BungeeCore.properties | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CommonCore b/CommonCore index c96efa9..492894c 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit c96efa9a50ae8c030f4543768239613d5e72be79 +Subproject commit 492894ca8d41ee0bde4dcb9d520db5f7478c50c7 diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index fc49281..6e2c66c 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -81,7 +81,7 @@ public class EventCommand extends BasicCommand { if(now.isBefore(e.getDeadline().toInstant())) { Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); } - String checkType = e.getCheckType(); + String checkType = e.getSchemType(); if (checkType != null) { SchematicType schematicType = SchematicType.fromDB(checkType); if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { diff --git a/src/de/steamwar/bungeecore/sql/Event.java b/src/de/steamwar/bungeecore/sql/Event.java index 41a5b03..ab4cede 100644 --- a/src/de/steamwar/bungeecore/sql/Event.java +++ b/src/de/steamwar/bungeecore/sql/Event.java @@ -41,7 +41,7 @@ public class Event { private final boolean publicSchemsOnly; private final boolean spectateSystem; private final Timestamp deadline; - private final String checkType; + private final String schemType; private static Event current = null; @@ -54,7 +54,7 @@ public class Event { this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly"); this.spectateSystem = rs.getBoolean("SpectateSystem"); this.deadline = rs.getTimestamp("Deadline"); - this.checkType = rs.getString("CheckType"); + this.schemType = rs.getString("SchemType"); } public static Event get(){ @@ -125,7 +125,7 @@ public class Event { public Timestamp getDeadline() { return deadline; } - public String getCheckType() { - return checkType; + public String getSchemType() { + return schemType; } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 962d3b5..38110be 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -238,7 +238,7 @@ EVENT_NO_CURRENT=§cThere is no event taking place currently EVENT_COMING=§eUpcoming events§8: EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} EVENT_COMING_DEADLINE=§7 Registration deadline§8: §7{0} -EVENT_COMING_SCHEM_DEADLINE=§7 Schematic deadline§8: §7{0} +EVENT_COMING_SCHEM_DEADLINE=§7 Submission deadline§8: §7{0} EVENT_COMING_TEAMS=§7 With§8:{0} EVENT_COMING_TEAM= §{0}{1} EVENT_CURRENT_EVENT=§e§l{0} -- 2.39.2 From e7b7cc01bc2fe720b898910c20fbcc0ed00d7b50 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 30 May 2022 12:16:07 +0200 Subject: [PATCH 5/8] Add schem deadline message to /event --- .../bungeecore/commands/EventCommand.java | 9 ++-- .../bungeecore/sql/SchematicType.java | 41 +++++++++++++++++-- .../steamwar/messages/BungeeCore.properties | 1 + .../messages/BungeeCore_de.properties | 1 + 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index c6ed448..3719ed2 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -20,10 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; -import de.steamwar.bungeecore.sql.Event; -import de.steamwar.bungeecore.sql.EventFight; -import de.steamwar.bungeecore.sql.Team; -import de.steamwar.bungeecore.sql.TeamTeilnahme; +import de.steamwar.bungeecore.sql.*; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -84,6 +81,10 @@ public class EventCommand extends BasicCommand { if(now.isBefore(e.getDeadline().toInstant())) { Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); } + SchematicType schematicType = SchematicType.get(e); + if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { + Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline()); + } if(!teams.isEmpty()){ StringBuilder tline = new StringBuilder(); for(Team t : teams){ diff --git a/src/de/steamwar/bungeecore/sql/SchematicType.java b/src/de/steamwar/bungeecore/sql/SchematicType.java index 978ab94..1ccb33c 100644 --- a/src/de/steamwar/bungeecore/sql/SchematicType.java +++ b/src/de/steamwar/bungeecore/sql/SchematicType.java @@ -27,14 +27,17 @@ import net.md_5.bungee.config.YamlConfiguration; import java.io.File; import java.io.IOException; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; public class SchematicType { - public static final SchematicType Normal = new SchematicType("Normal", "", null, Type.NORMAL, null); //Has to stay publicly availible + public static final SchematicType Normal = new SchematicType("Normal", "", null, Type.NORMAL, null, null); //Has to stay publicly availible private static final Map fromDB; private static final Map fightType; private static final List types; + private static final Map eventSchematicTypes; static { File folder = new File(ProxyServer.getInstance().getPluginsFolder(), "FightSystem"); @@ -42,6 +45,7 @@ public class SchematicType { List tmpTypes = new LinkedList<>(); Map tmpFromDB = new HashMap<>(); Map tmpFightType = new HashMap<>(); + Map tmpEventType = new HashMap<>(); tmpTypes.add(Normal); tmpFromDB.put(Normal.name().toLowerCase(), Normal); @@ -68,22 +72,41 @@ public class SchematicType { SchematicType checktype = null; if(!config.getStringList("CheckQuestions").isEmpty()) { - checktype = new SchematicType("C" + type, "C" + shortcut, material, Type.CHECK_TYPE, null); + checktype = new SchematicType("C" + type, "C" + shortcut, material, Type.CHECK_TYPE, null, null); tmpTypes.add(checktype); tmpFromDB.put(checktype.toDB(), checktype); CheckCommand.setCheckQuestions(checktype, config); } - SchematicType current = new SchematicType(type, shortcut, material, config.getKeys().contains("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype); + Date deadline; + String deadlineString = config.getString("deadline", null); + if (deadlineString != null) { + try { + SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); + deadline = dateFormat.parse(deadlineString); + } catch (ParseException e) { + throw new SecurityException(e.getMessage(), e); + } + } else { + deadline = null; + } + + SchematicType current = new SchematicType(type, shortcut, material, config.getKeys().contains("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype, deadline); if(checktype != null) tmpFightType.put(checktype, current); tmpFromDB.put(type.toLowerCase(), current); + + Integer eventID = config.get("eventID", null); + if (eventID != null) { + tmpEventType.put(eventID, current); + } } } fromDB = Collections.unmodifiableMap(tmpFromDB); fightType = Collections.unmodifiableMap(tmpFightType); types = Collections.unmodifiableList(tmpTypes); + eventSchematicTypes = Collections.unmodifiableMap(tmpEventType); } private final String name; @@ -91,13 +114,15 @@ public class SchematicType { private final String material; private final Type type; private final SchematicType checkType; + private final Date deadline; - private SchematicType(String name, String kuerzel, String material, Type type, SchematicType checkType){ + private SchematicType(String name, String kuerzel, String material, Type type, SchematicType checkType, Date deadline){ this.name = name; this.kuerzel = kuerzel; this.material = material != null && !"".equals(material) ? material : "STONE_BUTTON"; this.type = type; this.checkType = checkType; + this.deadline = deadline; } public boolean isAssignable(){ @@ -140,6 +165,10 @@ public class SchematicType { return name.toLowerCase(); } + public Date deadline() { + return deadline; + } + public static SchematicType fromDB(String input){ return fromDB.getOrDefault(input.toLowerCase(), null); } @@ -148,6 +177,10 @@ public class SchematicType { return types; } + public static SchematicType get(Event event) { + return eventSchematicTypes.get(event.getEventID()); + } + enum Type{ NORMAL, CHECK_TYPE, diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index e18f608..6f187dd 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -238,6 +238,7 @@ EVENT_NO_CURRENT=§cThere is no event taking place currently EVENT_COMING=§eUpcoming events§8: EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} EVENT_COMING_DEADLINE=§7 Registration deadline§8: §7{0} +EVENT_COMING_SCHEM_DEADLINE=§7 Schematic deadline§8: §7{0} EVENT_COMING_TEAMS=§7 With§8:{0} EVENT_COMING_TEAM= §{0}{1} EVENT_CURRENT_EVENT=§e§l{0} diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index d3f7d22..6fc780b 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -222,6 +222,7 @@ EVENT_NO_CURRENT=§cDerzeit findet kein Event statt EVENT_COMING=§eKommende Events§8: EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} EVENT_COMING_DEADLINE=§7 Anmeldeschluss§8: §7{0} +EVENT_COMING_SCHEM_DEADLINE=§7 Einsendeschluss§8: §7{0} EVENT_COMING_TEAMS=§7 Mit§8:{0} EVENT_COMING_TEAM= §{0}{1} EVENT_CURRENT_EVENT=§e§l{0} -- 2.39.2 From 4d8771eba18032d238a95b0776ba53b5b41ca8ba Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 1 Jun 2022 23:19:30 +0200 Subject: [PATCH 6/8] Rebase onto master --- src/de/steamwar/bungeecore/commands/EventCommand.java | 9 ++++++--- src/de/steamwar/bungeecore/sql/Event.java | 5 +++++ src/de/steamwar/bungeecore/sql/SchematicType.java | 6 ------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 3719ed2..fc49281 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -81,9 +81,12 @@ public class EventCommand extends BasicCommand { if(now.isBefore(e.getDeadline().toInstant())) { Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); } - SchematicType schematicType = SchematicType.get(e); - if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { - Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline()); + String checkType = e.getCheckType(); + if (checkType != null) { + SchematicType schematicType = SchematicType.fromDB(checkType); + if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { + Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline()); + } } if(!teams.isEmpty()){ StringBuilder tline = new StringBuilder(); diff --git a/src/de/steamwar/bungeecore/sql/Event.java b/src/de/steamwar/bungeecore/sql/Event.java index 93fd211..41a5b03 100644 --- a/src/de/steamwar/bungeecore/sql/Event.java +++ b/src/de/steamwar/bungeecore/sql/Event.java @@ -41,6 +41,7 @@ public class Event { private final boolean publicSchemsOnly; private final boolean spectateSystem; private final Timestamp deadline; + private final String checkType; private static Event current = null; @@ -53,6 +54,7 @@ public class Event { this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly"); this.spectateSystem = rs.getBoolean("SpectateSystem"); this.deadline = rs.getTimestamp("Deadline"); + this.checkType = rs.getString("CheckType"); } public static Event get(){ @@ -123,4 +125,7 @@ public class Event { public Timestamp getDeadline() { return deadline; } + public String getCheckType() { + return checkType; + } } diff --git a/src/de/steamwar/bungeecore/sql/SchematicType.java b/src/de/steamwar/bungeecore/sql/SchematicType.java index 1ccb33c..f63633e 100644 --- a/src/de/steamwar/bungeecore/sql/SchematicType.java +++ b/src/de/steamwar/bungeecore/sql/SchematicType.java @@ -37,7 +37,6 @@ public class SchematicType { private static final Map fromDB; private static final Map fightType; private static final List types; - private static final Map eventSchematicTypes; static { File folder = new File(ProxyServer.getInstance().getPluginsFolder(), "FightSystem"); @@ -106,7 +105,6 @@ public class SchematicType { fromDB = Collections.unmodifiableMap(tmpFromDB); fightType = Collections.unmodifiableMap(tmpFightType); types = Collections.unmodifiableList(tmpTypes); - eventSchematicTypes = Collections.unmodifiableMap(tmpEventType); } private final String name; @@ -177,10 +175,6 @@ public class SchematicType { return types; } - public static SchematicType get(Event event) { - return eventSchematicTypes.get(event.getEventID()); - } - enum Type{ NORMAL, CHECK_TYPE, -- 2.39.2 From 7302dd715c95c09723cbf42761ca7755bd01d43f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 15 Jun 2022 17:38:30 +0200 Subject: [PATCH 7/8] Update deadline --- src/de/steamwar/bungeecore/commands/EventCommand.java | 2 +- src/de/steamwar/bungeecore/sql/Event.java | 8 ++++---- src/de/steamwar/messages/BungeeCore.properties | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index fc49281..6e2c66c 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -81,7 +81,7 @@ public class EventCommand extends BasicCommand { if(now.isBefore(e.getDeadline().toInstant())) { Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); } - String checkType = e.getCheckType(); + String checkType = e.getSchemType(); if (checkType != null) { SchematicType schematicType = SchematicType.fromDB(checkType); if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { diff --git a/src/de/steamwar/bungeecore/sql/Event.java b/src/de/steamwar/bungeecore/sql/Event.java index 41a5b03..ab4cede 100644 --- a/src/de/steamwar/bungeecore/sql/Event.java +++ b/src/de/steamwar/bungeecore/sql/Event.java @@ -41,7 +41,7 @@ public class Event { private final boolean publicSchemsOnly; private final boolean spectateSystem; private final Timestamp deadline; - private final String checkType; + private final String schemType; private static Event current = null; @@ -54,7 +54,7 @@ public class Event { this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly"); this.spectateSystem = rs.getBoolean("SpectateSystem"); this.deadline = rs.getTimestamp("Deadline"); - this.checkType = rs.getString("CheckType"); + this.schemType = rs.getString("SchemType"); } public static Event get(){ @@ -125,7 +125,7 @@ public class Event { public Timestamp getDeadline() { return deadline; } - public String getCheckType() { - return checkType; + public String getSchemType() { + return schemType; } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6f187dd..7dfaa7c 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -238,7 +238,7 @@ EVENT_NO_CURRENT=§cThere is no event taking place currently EVENT_COMING=§eUpcoming events§8: EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} EVENT_COMING_DEADLINE=§7 Registration deadline§8: §7{0} -EVENT_COMING_SCHEM_DEADLINE=§7 Schematic deadline§8: §7{0} +EVENT_COMING_SCHEM_DEADLINE=§7 Submission deadline§8: §7{0} EVENT_COMING_TEAMS=§7 With§8:{0} EVENT_COMING_TEAM= §{0}{1} EVENT_CURRENT_EVENT=§e§l{0} -- 2.39.2 From e327c939f7c22ab50a2b466f045967d860773e58 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 23 Jun 2022 10:00:26 +0200 Subject: [PATCH 8/8] Cleanup branch Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/EventCommand.java | 6 +++--- src/de/steamwar/bungeecore/sql/SchematicType.java | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 6e2c66c..75f718f 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -81,9 +81,9 @@ public class EventCommand extends BasicCommand { if(now.isBefore(e.getDeadline().toInstant())) { Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); } - String checkType = e.getSchemType(); - if (checkType != null) { - SchematicType schematicType = SchematicType.fromDB(checkType); + String schemType = e.getSchemType(); + if (schemType != null) { + SchematicType schematicType = SchematicType.fromDB(schemType); if (schematicType != null && schematicType.deadline() != null && now.isBefore(schematicType.deadline().toInstant())) { Message.send("EVENT_COMING_SCHEM_DEADLINE", player, e.getDeadline()); } diff --git a/src/de/steamwar/bungeecore/sql/SchematicType.java b/src/de/steamwar/bungeecore/sql/SchematicType.java index f63633e..9592070 100644 --- a/src/de/steamwar/bungeecore/sql/SchematicType.java +++ b/src/de/steamwar/bungeecore/sql/SchematicType.java @@ -44,7 +44,6 @@ public class SchematicType { List tmpTypes = new LinkedList<>(); Map tmpFromDB = new HashMap<>(); Map tmpFightType = new HashMap<>(); - Map tmpEventType = new HashMap<>(); tmpTypes.add(Normal); tmpFromDB.put(Normal.name().toLowerCase(), Normal); @@ -94,11 +93,6 @@ public class SchematicType { if(checktype != null) tmpFightType.put(checktype, current); tmpFromDB.put(type.toLowerCase(), current); - - Integer eventID = config.get("eventID", null); - if (eventID != null) { - tmpEventType.put(eventID, current); - } } } -- 2.39.2