From cff70e70c20ffdbcf7633e06b3bc1f876548f174 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 30 Dec 2021 20:11:17 +0100 Subject: [PATCH 1/2] Is Punished Signed-off-by: Chaoscaot --- SpigotCore_Main/src/de/steamwar/sql/Punishment.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SpigotCore_Main/src/de/steamwar/sql/Punishment.java b/SpigotCore_Main/src/de/steamwar/sql/Punishment.java index 0e2bc5b..45d4577 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Punishment.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Punishment.java @@ -27,6 +27,7 @@ import java.sql.SQLException; import java.sql.Timestamp; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.function.Consumer; public class Punishment { @@ -50,6 +51,16 @@ public class Punishment { }, user); } + public static boolean isPunished(SteamwarUser user, Punishment.PunishmentType type, Consumer callback) { + Punishment punishment = Punishment.getPunishmentOfPlayer(user.getId(), type); + if(punishment == null) { + return false; + } else { + callback.accept(punishment); + return true; + } + } + private final Timestamp startTime; private Timestamp endTime; private final PunishmentType type; -- 2.39.2 From 5fe45ff16143d2ef902a1646d81a7fbcd2c9cca6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 30 Dec 2021 20:13:18 +0100 Subject: [PATCH 2/2] Is Punished Signed-off-by: Chaoscaot --- SpigotCore_Main/src/de/steamwar/sql/Punishment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/Punishment.java b/SpigotCore_Main/src/de/steamwar/sql/Punishment.java index 45d4577..85ec258 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Punishment.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Punishment.java @@ -53,7 +53,7 @@ public class Punishment { public static boolean isPunished(SteamwarUser user, Punishment.PunishmentType type, Consumer callback) { Punishment punishment = Punishment.getPunishmentOfPlayer(user.getId(), type); - if(punishment == null) { + if(punishment == null || punishment.isCurrent()) { return false; } else { callback.accept(punishment); -- 2.39.2