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
4 geänderte Dateien mit 35 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -847,6 +847,8 @@ REGION_TB_DONE=§7Dummy reset
REGION_TB_ERROR=§cError resetting the dummy
REGION_TB_NO_PERMS=§cYou are not allowed to reset the dummy here
REGION_TB_NO_REGION=§cYou are currently not in any region
REGION_TB_NO_SCHEMSHARING=§cYou currently cannot share schematics until {0}.
REGION_TB_NO_SCHEMRECEIVING=§cThe Owner of this build server cannot receive any schematics until {0}.
REGION_TNT_HELP=§8/§etnt §8- §7Change the TNT behaviour
REGION_TNT_HELP_MODE=§8/§etnt §8[§7Mode§8] §8- §7Set TNT behaviour to a given mode
REGION_TNT_ON=§aTNT-Damage activated

Datei anzeigen

@ -810,6 +810,8 @@ REGION_TB_DONE=§7Testblock zurückgesetzt
REGION_TB_ERROR=§cFehler beim Zurücksetzen des Testblocks
REGION_TB_NO_PERMS=§cDu darfst hier nicht den Testblock zurücksetzen
REGION_TB_NO_REGION=§cDu befindest dich derzeit in keiner Region
REGION_TB_NO_SCHEMSHARING=§cDu kannst aktuell keine Schematics teilen bis {0}.
REGION_TB_NO_SCHEMRECEIVING=§cDer Besitzer dieses Bauservers kann keine Schematics erhalten bis {0}.
REGION_TNT_HELP=§8/§etnt §8- §7Ändere das TNT verhalten
REGION_TNT_HELP_MODE=§8/§etnt §8[§7Mode§8] §8- §7Setzte das TNT verhalten auf einen Modus
REGION_TNT_ON=§aTNT-Schaden aktiviert

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,15 @@ 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;
}
} else if (Punishment.isPunished(SteamwarUser.get(bauServer.getOwner()), Punishment.PunishmentType.NoSchemReceiving, punishment -> BauSystem.MESSAGE.parse("REGION_TB_NO_SCHEMRECEIVING", p, punishment.getEndTime()))) {
return;
}
if (node.isDir()) {
BauSystem.MESSAGE.send("ONLY_SCHEMS", p);
return;

Datei anzeigen

@ -21,12 +21,16 @@ 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.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.command.*;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.command.PreviousArguments;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
@ -43,6 +47,9 @@ import java.util.logging.Level;
@Linked
public class TestblockCommand extends SWCommand {
@LinkedInstance
public BauServer bauServer;
public TestblockCommand() {
super("testblock", "tb", "dummy");
}
@ -85,6 +92,14 @@ public class TestblockCommand extends SWCommand {
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;
}
} else if (Punishment.isPunished(SteamwarUser.get(bauServer.getOwner()), Punishment.PunishmentType.NoSchemReceiving, punishment -> BauSystem.MESSAGE.parse("REGION_TB_NO_SCHEMRECEIVING", p, punishment.getEndTime()))) {
return;
}
try {
region.reset(node, RegionType.TESTBLOCK, regionExtensionType);
RegionUtils.message(region, "REGION_TB_DONE");