From 50d4e7ef2fdd1db3725cb6a6087727f616deabee Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Wed, 18 Jan 2023 16:35:33 +0100 Subject: [PATCH] NoSchemSharing with Testblock Fix. --- BauSystem_Main/src/BauSystem.properties | 1 + BauSystem_Main/src/BauSystem_de.properties | 1 + .../bausystem/features/region/TestblockCommand.java | 13 +++++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 690fcb6d..c84e9d27 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -1053,6 +1053,7 @@ 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 have an active NoSchemSharing ban 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 diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 7320b18d..a239a281 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -1022,6 +1022,7 @@ 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 hast einen aktiven NoSchemSharing ban 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 diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java index a677e4df..7f31f971 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java @@ -27,6 +27,7 @@ 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.sql.Punishment; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; @@ -85,6 +86,14 @@ public class TestblockCommand extends SWCommand { return; } + if(Punishment.isPunished(SteamwarUser.get(p.getUniqueId()), Punishment.PunishmentType.NoSchemSharing, punishment -> { + + BauSystem.MESSAGE.parse("REGION_TB_NO_SCHEMSHARING", p, punishment.getEndTime()); + + })) { + return; + } + try { region.reset(node, RegionType.TESTBLOCK, regionExtensionType); RegionUtils.message(region, "REGION_TB_DONE"); @@ -126,14 +135,14 @@ public class TestblockCommand extends SWCommand { public TypeMapper nodeWithPublic() { return new TypeMapper() { @Override - public List tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) { + public List tabCompletes(CommandSender commandSender, String[] previousArguments, String s) { List stringList = new ArrayList<>(SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s)); stringList.addAll(SchematicNode.getNodeTabcomplete(SteamwarUser.get(0), s)); return stringList; } @Override - public SchematicNode map(CommandSender commandSender, PreviousArguments previousArguments, String s) { + public SchematicNode map(CommandSender commandSender, String[] previousArguments, String s) { SchematicNode node = SchematicNode.getNodeFromPath(SteamwarUser.get(((Player) commandSender).getUniqueId()), s); if(node == null) { node = SchematicNode.getNodeFromPath(SteamwarUser.get(0), s);