From 4d8771eba18032d238a95b0776ba53b5b41ca8ba Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 1 Jun 2022 23:19:30 +0200 Subject: [PATCH] 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,