From 040f0373c863fd9c00d999c0ff2395436b768795 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 26 Jul 2023 13:55:45 +0200 Subject: [PATCH] Implement Punishment Check in ResetCommand --- .../bausystem/features/region/ResetCommand.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java index 670facf5..9fc8490d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java @@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; @@ -28,7 +29,10 @@ import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; +import de.steamwar.sql.Punishment; import de.steamwar.sql.SchematicNode; +import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -38,6 +42,9 @@ import java.util.logging.Level; @Linked public class ResetCommand extends SWCommand { + @LinkedInstance + public BauServer bauServer; + public ResetCommand() { super("reset"); } @@ -59,6 +66,13 @@ public class ResetCommand extends SWCommand { public void schematicResetCommand(@Validator Player p, SchematicNode node) { Region region = regionCheck(p); if (region == null) return; + + if(bauServer.getOwner() != p.getUniqueId()) { + if(Punishment.isPunished(SteamwarUser.get(p.getUniqueId()), Punishment.PunishmentType.NoSchemSharing, punishment -> BauSystem.MESSAGE.parse("REGION_TB_NO_SCHEMSHARING", p, punishment.getEndTime()))) { + return; + } + } + if (node.isDir()) { BauSystem.MESSAGE.send("ONLY_SCHEMS", p); return;