diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandProtect.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandProtect.java index 2de12c4..9329daf 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandProtect.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandProtect.java @@ -21,8 +21,8 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.world.regions.Region; import de.steamwar.bausystem.world.Welt; +import de.steamwar.bausystem.world.regions.Region; import de.steamwar.command.SWCommand; import de.steamwar.sql.Schematic; import org.bukkit.Bukkit; @@ -44,7 +44,7 @@ public class CommandProtect extends SWCommand { } @Register - public void genericTestblockCommand(Player p) { + public void genericProtectCommand(Player p) { if (!permissionCheck(p)) return; Region region = regionCheck(p); if (region == null) return; @@ -58,7 +58,7 @@ public class CommandProtect extends SWCommand { } @Register - public void schematicTestblockCommand(Player p, String s) { + public void schematicProtectCommand(Player p, String s) { if (!permissionCheck(p)) return; Region region = regionCheck(p); if (region == null) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRegion.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRegion.java index 423d41d..75aacc6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRegion.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRegion.java @@ -28,12 +28,15 @@ public class CommandRegion extends SWCommand { @Register(help = true) public void genericHelp(Player player, String... args) { - player.sendMessage(BauSystem.PREFIX + "§8/§7region undo §8- §7Mache die letzten 10 /testblock oder /reset rückgängig"); - player.sendMessage(BauSystem.PREFIX + "§8/§7region redo §8- §7Wiederhohle die letzten 10 §8/§7rg undo"); + player.sendMessage("§8/§eregion undo §8- §7Mache die letzten 20 /testblock oder /reset rückgängig"); + player.sendMessage("§8/§eregion redo §8- §7Wiederhohle die letzten 20 §8/§7rg undo"); + player.sendMessage("§8/§eregion restore §8- §7Setzte die Region zurück, ohne das Gebaute zu löschen"); + player.sendMessage("§8/§ereset select §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus"); + player.sendMessage("§8/§ereset select §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension"); } - @Register - public void undoCommand(Player p, Action action) { + @Register("undo") + public void undoCommand(Player p) { if(!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); if(checkGlobalRegion(region, p)) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandReset.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandReset.java index cc61dd3..fdc540a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandReset.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandReset.java @@ -21,9 +21,9 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.world.Welt; import de.steamwar.bausystem.world.regions.GlobalRegion; import de.steamwar.bausystem.world.regions.Region; -import de.steamwar.bausystem.world.Welt; import de.steamwar.command.SWCommand; import de.steamwar.sql.Schematic; import org.bukkit.Bukkit; @@ -50,7 +50,7 @@ public class CommandReset extends SWCommand { Region region = regionCheck(p); if (region == null) return; try { - region.reset(null); + region.reset(null, false); p.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt"); } catch (IOException e) { p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region"); @@ -69,7 +69,7 @@ public class CommandReset extends SWCommand { return; } try { - region.reset(schem); + region.reset(schem, false); p.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt"); } catch (IOException e) { p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java index 3c34230..455f9de 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java @@ -143,14 +143,14 @@ public class Prototype { } } - public EditSession reset(Region region, Schematic schem) throws IOException, NoClipboardException { + public EditSession reset(Region region, Schematic schem, boolean ignoreAir) throws IOException, NoClipboardException { int x = region.minPoint.getX() + offsetX + sizeX / 2; int y = region.minPoint.getY() + offsetY; int z = region.minPoint.getZ() + offsetZ + sizeZ / 2; if (schem == null) { - return paste(new File(schematic), x, y, z, rotate); + return paste(new File(schematic), x, y, z, rotate, ignoreAir); } else { - return paste(schem.load(), x, y, z, rotate); + return paste(schem.load(), x, y, z, rotate, ignoreAir); } } @@ -163,9 +163,9 @@ public class Prototype { int y = region.minPoint.getY() + testblock.offsetY - 1; int z = region.minPoint.getZ() + offsetZ + sizeZ / 2; if (schem == null) { - return paste(new File(protectSchematic), x, y, z, rotate); + return paste(new File(protectSchematic), x, y, z, rotate, false); } else { - return paste(schem.load(), x, y, z, rotate); + return paste(schem.load(), x, y, z, rotate, false); } } @@ -174,20 +174,20 @@ public class Prototype { } public EditSession resetTestblock(Region region, Schematic schem) throws IOException, NoClipboardException { - return testblock.reset(region, schem); + return testblock.reset(region, schem, false); } private static boolean inRange(double l, int min, int size) { return min <= l && l < min + size; } - private static EditSession paste(File file, int x, int y, int z, boolean rotate) { //Type of protect - return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(file, x, y, z, rotate), 8), - new VersionedCallable(() -> Region_15.paste(file, x, y, z, rotate), 15)); + private static EditSession paste(File file, int x, int y, int z, boolean rotate, boolean ignoreAir) { //Type of protect + return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(file, x, y, z, rotate, ignoreAir), 8), + new VersionedCallable(() -> Region_15.paste(file, x, y, z, rotate, ignoreAir), 15)); } - private static EditSession paste(Clipboard clipboard, int x, int y, int z, boolean rotate) { - return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(clipboard, x, y, z, rotate), 8), - new VersionedCallable(() -> Region_15.paste(clipboard, x, y, z, rotate), 15)); + private static EditSession paste(Clipboard clipboard, int x, int y, int z, boolean rotate, boolean ignoreAir) { + return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(clipboard, x, y, z, rotate, ignoreAir), 8), + new VersionedCallable(() -> Region_15.paste(clipboard, x, y, z, rotate, ignoreAir), 15)); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java index fbd113a..c35be73 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java @@ -195,14 +195,9 @@ public class Region { return prototype.buildArea != null; } - public void reset() throws IOException { + public void reset(Schematic schem, boolean ignoreAir) throws IOException, NoClipboardException { initSessions(); - undosessions.push(prototype.reset(this, null)); - } - - public void reset(Schematic schem) throws IOException, NoClipboardException { - initSessions(); - undosessions.push(prototype.reset(this, schem)); + undosessions.push(prototype.reset(this, schem, ignoreAir)); } public boolean hasTestblock() {