SteamWar/BauSystem2.0
Archiviert
12
0

NoSchemSharing bug fix #193

Zusammengeführt
YoyoNow hat 11 Commits von NoSchemSharingWithTestBlock nach master 2023-07-26 20:44:35 +02:00 zusammengeführt
Nur Änderungen aus Commit 040f0373c8 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.region;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils; 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.SWCommand;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -38,6 +42,9 @@ import java.util.logging.Level;
@Linked @Linked
public class ResetCommand extends SWCommand { public class ResetCommand extends SWCommand {
@LinkedInstance
public BauServer bauServer;
public ResetCommand() { public ResetCommand() {
super("reset"); super("reset");
} }
@ -59,6 +66,13 @@ public class ResetCommand extends SWCommand {
public void schematicResetCommand(@Validator Player p, SchematicNode node) { public void schematicResetCommand(@Validator Player p, SchematicNode node) {
Region region = regionCheck(p); Region region = regionCheck(p);
if (region == null) return; 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()) { if (node.isDir()) {
BauSystem.MESSAGE.send("ONLY_SCHEMS", p); BauSystem.MESSAGE.send("ONLY_SCHEMS", p);
return; return;