From 534f352c370143207b4438985e10f71398b9dacc Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 4 Dec 2021 22:09:24 +0100 Subject: [PATCH] Fix Lixfels Problems --- BauSystem_Main/src/BauSystem.properties | 1 + .../features/region/items/ResetBauGuiItem.java | 16 +++++++--------- .../region/items/TestblockBauGuiItem.java | 10 +++++++--- .../features/team/LockSchemCommand.java | 14 +++++++++----- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 8356d29b..7fc13eb9 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -883,6 +883,7 @@ REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört # Team LOCK_SCHEM_NO_USER=§7Dieser Spieler existiert nicht! LOCK_SCHEM_NO_SCHEM=§7Dieser Spieler besitzt keine Schematic mit diesem Namen! +LOCK_SCHEM_DIR=§7Die angegebene Schematic ist ein Ordner LOCK_SCHEM_LOCKED=§e{0} §7von §e{1} §7wurde von §e{2} §7auf §eNORMAL §7zurück gesetz. §f§lGrund: §f{3} LOCK_SCHEM_HELP=§8/§eschemlock §8[§7Owner§8] [§7Schematic§8] [§7Grund§8] - §7Sperre eine Schematic AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 5 Minuten nichts passiert. diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java index e49b0584..336843fb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java @@ -21,26 +21,24 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.features.region.ResetCommand; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; -import de.steamwar.inventory.SWListInv; import de.steamwar.inventory.SchematicSelector; -import de.steamwar.sql.SchematicNode; -import de.steamwar.sql.SteamwarUser; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - @Linked(LinkageType.BAU_GUI_ITEM) public class ResetBauGuiItem extends BauGuiItem { + @LinkedInstance + private ResetCommand resetCommand; + public ResetBauGuiItem() { super(6); } @@ -54,11 +52,11 @@ public class ResetBauGuiItem extends BauGuiItem { public boolean click(ClickType click, Player p) { if (click == ClickType.LEFT) { p.closeInventory(); - p.performCommand("reset"); + resetCommand.genericResetCommand(p); } else { SchematicSelector selector = new SchematicSelector(p, SchematicSelector.selectSchematic(), node -> { p.closeInventory(); - p.performCommand("reset " + node.generateBreadcrumbs(SteamwarUser.get(p.getUniqueId()))); + resetCommand.schematicResetCommand(p, node); }); selector.open(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java index ead46636..f789ea78 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java @@ -21,12 +21,13 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.features.region.TestblockCommand; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SchematicSelector; -import de.steamwar.sql.SteamwarUser; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -35,6 +36,9 @@ import org.bukkit.inventory.ItemStack; @Linked(LinkageType.BAU_GUI_ITEM) public class TestblockBauGuiItem extends BauGuiItem { + @LinkedInstance + private TestblockCommand testblockCommand; + public TestblockBauGuiItem() { super(5); } @@ -48,11 +52,11 @@ public class TestblockBauGuiItem extends BauGuiItem { public boolean click(ClickType click, Player p) { if (click == ClickType.LEFT) { p.closeInventory(); - p.performCommand("testblock"); + testblockCommand.genericTestblockCommand(p); } else { SchematicSelector selector = new SchematicSelector(p, SchematicSelector.selectSchematic(), node -> { p.closeInventory(); - p.performCommand("testblock " + node.generateBreadcrumbs(SteamwarUser.get(p.getUniqueId()))); + testblockCommand.schematicTestblockCommand(p, node); }); selector.open(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java index 62a7d3a9..a06aef53 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java @@ -68,9 +68,13 @@ public class LockSchemCommand extends SWCommand { BauSystem.MESSAGE.send("LOCK_SCHEM_NO_USER", p); return; } - Schematic schematic = Schematic.getSchemFromDB(schematicName, schemOwner.getUUID()); + SchematicNode schematic = SchematicNode.getNodeFromPath(schemOwner, schematicName); if (schematic == null) { - BauSystem.MESSAGE.send("LOCK_SCHEM_NO_SCHEM", p); + BauSystem.MESSAGE.send("LOCK_SCHEM_DIR", p); + return; + } + + if(schematic.isDir()) { return; } @@ -79,9 +83,9 @@ public class LockSchemCommand extends SWCommand { builder.append(s).append(" "); } - BauSystem.MESSAGE.send("LOCK_SCHEM_LOCKED", p, schematic.getSchemName(), schemOwner.getUserName(), schematic.getSchemType().name(), builder.toString()); - schematic.setSchemType(SchematicType.Normal); - new CheckedSchematic(schematic.getSchemName(), schematic.getSchemOwner(), steamwarUser.getId(), Timestamp.from(Instant.now()), Timestamp.from(Instant.now()), builder.toString()); + BauSystem.MESSAGE.send("LOCK_SCHEM_LOCKED", p, schematic.getName(), schemOwner.getUserName(), schematic.getSchemtype().name(), builder.toString()); + schematic.setSchemtype(SchematicType.Normal); + new CheckedSchematic(schematic.getName(), schematic.getOwner(), steamwarUser.getId(), Timestamp.from(Instant.now()), Timestamp.from(Instant.now()), builder.toString()); } private void sendHelp(Player player) {