Implement Punishment Check in ResetCommand
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
zOnlyKroks 2023-07-26 13:55:45 +02:00
Ursprung 361d96ddf3
Commit 040f0373c8

Datei anzeigen

@ -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;