diff --git a/src/config.yml b/src/config.yml index f153571..3f24ed8 100644 --- a/src/config.yml +++ b/src/config.yml @@ -3,31 +3,39 @@ Schematics: Breite: Höhe: Tiefe: - Obsidian: - Bedrock: + TNT: + Schleim: + TNTSchleim: + Dispenser: ForbiddenIds: CheckList: MiniWarGear: Breite: Höhe: Tiefe: - Obsidian: - Bedrock: + TNT: + Schleim: + TNTSchleim: + Dispenser: ForbiddenIds: CheckList: WarShip: Breite: Höhe: Tiefe: - Obsidian: - Bedrock: + TNT: + Schleim: + TNTSchleim: + Dispenser: ForbiddenIds: CheckList: AirShip: Breite: Höhe: Tiefe: - Obsidian: - Bedrock: + TNT: + Schleim: + TNTSchleim: + Dispenser: ForbiddenIds: CheckList: \ No newline at end of file diff --git a/src/de/warking/schematicsystem/check/CheckUtils.java b/src/de/warking/schematicsystem/check/CheckUtils.java index 690998d..324822e 100644 --- a/src/de/warking/schematicsystem/check/CheckUtils.java +++ b/src/de/warking/schematicsystem/check/CheckUtils.java @@ -36,14 +36,14 @@ public class CheckUtils { return true; } - public static Checkresult checkSchematic(Clipboard clipboard, List forbiddenBlocks, boolean obsidianToTnt, boolean slimeToBedrock, String modus) { + public static Checkresult checkSchematic(Clipboard clipboard, List forbiddenBlocks, String modus) { Region region = clipboard.getRegion(); Vector min = region.getMinimumPoint(); Vector max = region.getMaximumPoint(); - int obsidian = 0; - int bedrock = 0; + int tnt = 0; + int slime = 0; int dispenser = 0; for (int x = min.getBlockX(); x <= max.getBlockX(); x++) { @@ -51,31 +51,16 @@ public class CheckUtils { for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) { Vector vector = new Vector(x, y, z); - //obsidian check - if(obsidianToTnt) { - if(clipboard.getBlock(vector).getId() == 46) { - Checkresult checkresult = new Checkresult(false, "TNT verbaut"); - return checkresult; - } - if(clipboard.getBlock(vector).getId() == 49) - obsidian++; - } - //bedrock check + //tnt check + if(clipboard.getBlock(vector).getId() == 46) + tnt++; + + //slime check if(clipboard.getBlock(vector).getId() == 165) { - if(slimeToBedrock) { - Checkresult checkresult = new Checkresult(false, "SCHLEIM verbaut"); - return checkresult; - } + if(!modus.equals("WarGear") && !modus.equals("MiniWarGear")) + slime++; } - if(clipboard.getBlock(vector).getId() == 7) { - if(!modus.equals("WarGear") && !modus.equals("MiniWarGear")) - bedrock++; - else { - Checkresult checkresult = new Checkresult(false, "BEDROCK verbaut"); - return checkresult; - } - } //dispenser check if(clipboard.getBlock(vector).getId() == 23) dispenser++; @@ -89,76 +74,76 @@ public class CheckUtils { } } - int obsidianBedrock = obsidian + bedrock; + int tntSlime = tnt + slime; if(modus.equalsIgnoreCase("WarGear")) { - if(Config.WarGearMaxObsidian < obsidian) { - Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN"); + if(Config.WarGearMaxTNT < tnt) { + Checkresult checkresult = new Checkresult(false, "zu viel TNT"); return checkresult; } - if(Config.WarGearMaxBedrock < bedrock) { - Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK"); + if(Config.WarGearMaxSchleim < slime) { + Checkresult checkresult = new Checkresult(false, "zu viel SCHLEIM"); return checkresult; } if(Config.WarGearMaxDispenser < dispenser) { Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER"); return checkresult; } - if(Config.WarGearObsidianBedrock < obsidianBedrock) { - Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten"); + if(Config.WarGearTNTSchleim < tntSlime) { + Checkresult checkresult = new Checkresult(false, "TNT und SCHLEIM Summe überschritten"); return checkresult; } } if(modus.equalsIgnoreCase("MiniWarGear")) { - if(Config.MiniWarGearMaxObsidian < obsidian) { - Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN"); + if(Config.MiniWarGearMaxTNT < tnt) { + Checkresult checkresult = new Checkresult(false, "zu viel TNT"); return checkresult; } - if(Config.MiniWarGearMaxBedrock < bedrock) { - Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK"); + if(Config.MiniWarGearMaxSchleim < slime) { + Checkresult checkresult = new Checkresult(false, "zu viel SCHLEIM"); return checkresult; } if(Config.MiniWarGearMaxDispenser < dispenser) { Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER"); return checkresult; } - if(Config.MiniWarGearObsidianBedrock < obsidianBedrock) { - Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten"); + if(Config.MiniWarGearTNTSchleim < tntSlime) { + Checkresult checkresult = new Checkresult(false, "TNT und SCHLEIM Summe überschritten"); return checkresult; } } if(modus.equalsIgnoreCase("WarShip")) { - if(Config.WarShipMaxObsidian < obsidian) { - Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN"); + if(Config.WarShipMaxTNT < tnt) { + Checkresult checkresult = new Checkresult(false, "zu viel TNT"); return checkresult; } - if(Config.WarShipMaxBedrock < bedrock) { - Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK"); + if(Config.WarShipMaxSchleim < slime) { + Checkresult checkresult = new Checkresult(false, "zu viel SCHLEIM"); return checkresult; } if(Config.WarShipMaxDispenser < dispenser) { Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER"); return checkresult; } - if(Config.WarShipObsidianBedrock < obsidianBedrock) { - Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten"); + if(Config.WarShipTNTSchleim < tntSlime) { + Checkresult checkresult = new Checkresult(false, "TNT und SCHLEIM Summe überschritten"); return checkresult; } } if(modus.equalsIgnoreCase("AirShip")) { - if(Config.AirShipMaxObsidian < obsidian) { - Checkresult checkresult = new Checkresult(false, "zu viel OBSIDIAN"); + if(Config.AirShipMaxTNT < tnt) { + Checkresult checkresult = new Checkresult(false, "zu viel TNT"); return checkresult; } - if(Config.AirShipMaxBedrock < bedrock) { - Checkresult checkresult = new Checkresult(false, "zu viel BEDROCK"); + if(Config.AirShipMaxSchleim < slime) { + Checkresult checkresult = new Checkresult(false, "zu viel SCHLEIM"); return checkresult; } if(Config.AirShipMaxDispenser < dispenser) { Checkresult checkresult = new Checkresult(false, "zu viele DISPENSER"); return checkresult; } - if(Config.AirShipObsidianBedrock < obsidianBedrock) { - Checkresult checkresult = new Checkresult(false, "OBSIDIAN und TNT Summe überschritten"); + if(Config.AirShipTNTSchleim < tntSlime) { + Checkresult checkresult = new Checkresult(false, "TNT und SCHLEIM Summe überschritten"); return checkresult; } } diff --git a/src/de/warking/schematicsystem/commands/SchematicCommand.java b/src/de/warking/schematicsystem/commands/SchematicCommand.java index 7bc9c5a..4f0b692 100644 --- a/src/de/warking/schematicsystem/commands/SchematicCommand.java +++ b/src/de/warking/schematicsystem/commands/SchematicCommand.java @@ -419,7 +419,7 @@ public class SchematicCommand implements CommandExecutor { if(args[2].equalsIgnoreCase("airship")) { if(dimensions.getBlockX() <= Config.AirShipBreite && dimensions.getBlockY() <= Config.AirShipHöhe && dimensions.getBlockZ() <= Config.AirShipTiefe) { - Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.AirShipForbiddenIds, true, true, "AirShip"); + Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.AirShipForbiddenIds, "AirShip"); if(!checkresult.isCheck()) { player.sendMessage(SchematicSystem.PREFIX + "§cDein AirShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]"); checkresult.remove(); @@ -436,7 +436,7 @@ public class SchematicCommand implements CommandExecutor { if(args[2].equalsIgnoreCase("miniwargear")) { if(dimensions.getBlockX() <= Config.MiniWarGearBreite && dimensions.getBlockY() <= Config.MiniWarGearHöhe && dimensions.getBlockZ() <= Config.MiniWarGearTiefe) { - Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.MiniWarGearForbiddenIds, true, false, "MiniWarGear"); + Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.MiniWarGearForbiddenIds, "MiniWarGear"); if(!checkresult.isCheck()) { player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]"); checkresult.remove(); @@ -453,7 +453,7 @@ public class SchematicCommand implements CommandExecutor { if(args[2].equalsIgnoreCase("wargear")) { if(dimensions.getBlockX() <= Config.WarGearBreite && dimensions.getBlockY() <= Config.WarGearHöhe && dimensions.getBlockZ() <= Config.WarGearTiefe) { - Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarGearForbiddenIds, true, false, "WarGear"); + Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarGearForbiddenIds, "WarGear"); if(!checkresult.isCheck()) { player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]"); checkresult.remove(); @@ -470,7 +470,7 @@ public class SchematicCommand implements CommandExecutor { if(args[2].equalsIgnoreCase("warship")) { if(dimensions.getBlockX() <= Config.WarShipBreite && dimensions.getBlockY() <= Config.WarShipHöhe && dimensions.getBlockZ() <= Config.WarShipTiefe) { - Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarShipForbiddenIds, true, true, "WarShip"); + Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarShipForbiddenIds, "WarShip"); if(!checkresult.isCheck()) { player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]"); checkresult.remove(); diff --git a/src/de/warking/schematicsystem/utils/Config.java b/src/de/warking/schematicsystem/utils/Config.java index a0ce672..5ad6fba 100644 --- a/src/de/warking/schematicsystem/utils/Config.java +++ b/src/de/warking/schematicsystem/utils/Config.java @@ -12,9 +12,9 @@ public class Config { public static double WarGearBreite; public static double WarGearHöhe; public static double WarGearTiefe; - public static int WarGearMaxObsidian; - public static int WarGearMaxBedrock; - public static int WarGearObsidianBedrock; + public static int WarGearMaxTNT; + public static int WarGearMaxSchleim; + public static int WarGearTNTSchleim; public static int WarGearMaxDispenser; public static List WarGearForbiddenIds; public static List WarGearCheckList; @@ -22,9 +22,9 @@ public class Config { public static double MiniWarGearBreite; public static double MiniWarGearHöhe; public static double MiniWarGearTiefe; - public static int MiniWarGearMaxObsidian; - public static int MiniWarGearMaxBedrock; - public static int MiniWarGearObsidianBedrock; + public static int MiniWarGearMaxTNT; + public static int MiniWarGearMaxSchleim; + public static int MiniWarGearTNTSchleim; public static int MiniWarGearMaxDispenser; public static List MiniWarGearForbiddenIds; public static List MiniWarGearCheckList; @@ -32,9 +32,9 @@ public class Config { public static double WarShipBreite; public static double WarShipHöhe; public static double WarShipTiefe; - public static int WarShipMaxObsidian; - public static int WarShipMaxBedrock; - public static int WarShipObsidianBedrock; + public static int WarShipMaxTNT; + public static int WarShipMaxSchleim; + public static int WarShipTNTSchleim; public static int WarShipMaxDispenser; public static List WarShipForbiddenIds; public static List WarShipCheckList; @@ -42,9 +42,9 @@ public class Config { public static double AirShipBreite; public static double AirShipHöhe; public static double AirShipTiefe; - public static int AirShipMaxObsidian; - public static int AirShipMaxBedrock; - public static int AirShipObsidianBedrock; + public static int AirShipMaxTNT; + public static int AirShipMaxSchleim; + public static int AirShipTNTSchleim; public static int AirShipMaxDispenser; public static List AirShipForbiddenIds; public static List AirShipCheckList; @@ -60,9 +60,9 @@ public class Config { WarGearBreite = config.getDouble("Schematics.WarGear.Breite"); WarGearHöhe = config.getDouble("Schematics.WarGear.Höhe"); WarGearTiefe = config.getDouble("Schematics.WarGear.Tiefe"); - WarGearMaxObsidian = config.getInt("Schematics.WarGear.Obsidian"); - WarGearMaxBedrock = config.getInt("Schematics.WarGear.Bedrock"); - WarGearObsidianBedrock = config.getInt("Schematics.WarGear.ObsidianBedrock"); + WarGearMaxTNT = config.getInt("Schematics.WarGear.TNT"); + WarGearMaxSchleim = config.getInt("Schematics.WarGear.Schleim"); + WarGearTNTSchleim = config.getInt("Schematics.WarGear.TNTSchleim"); WarGearMaxDispenser = config.getInt("Schematics.WarGear.Dispenser"); WarGearForbiddenIds = config.getIntegerList("Schematics.WarGear.ForbiddenIds"); WarGearCheckList = config.getStringList("Schematics.WarGear.CheckList"); @@ -70,9 +70,9 @@ public class Config { MiniWarGearBreite = config.getDouble("Schematics.MiniWarGear.Breite"); MiniWarGearHöhe = config.getDouble("Schematics.MiniWarGear.Höhe"); MiniWarGearTiefe = config.getDouble("Schematics.MiniWarGear.Tiefe"); - MiniWarGearMaxObsidian = config.getInt("Schematics.MiniWarGear.Obsidian"); - MiniWarGearMaxBedrock = config.getInt("Schematics.MiniWarGear.Bedrock"); - MiniWarGearObsidianBedrock = config.getInt("Schematics.MiniWarGear.ObsidianBedrock"); + MiniWarGearMaxTNT = config.getInt("Schematics.MiniWarGear.TNT"); + MiniWarGearMaxSchleim = config.getInt("Schematics.MiniWarGear.Schleim"); + MiniWarGearTNTSchleim = config.getInt("Schematics.MiniWarGear.TNTSchleim"); MiniWarGearMaxDispenser = config.getInt("Schematics.MiniWarGear.Dispenser"); MiniWarGearForbiddenIds = config.getIntegerList("Schematics.MiniWarGear.ForbiddenIds"); MiniWarGearCheckList = config.getStringList("Schematics.MiniWarGear.CheckList"); @@ -80,9 +80,9 @@ public class Config { WarShipBreite = config.getDouble("Schematics.WarShip.Breite"); WarShipHöhe = config.getDouble("Schematics.WarShip.Höhe"); WarShipTiefe = config.getDouble("Schematics.WarShip.Tiefe"); - WarShipMaxObsidian = config.getInt("Schematics.WarShip.Obsidian"); - WarShipMaxBedrock = config.getInt("Schematics.WarShip.Bedrock"); - WarShipObsidianBedrock = config.getInt("Schematics.WarShip.ObsidianBedrock"); + WarShipMaxTNT = config.getInt("Schematics.WarShip.TNT"); + WarShipMaxSchleim = config.getInt("Schematics.WarShip.Schleim"); + WarShipTNTSchleim = config.getInt("Schematics.WarShip.TNTSchleim"); WarShipMaxDispenser = config.getInt("Schematics.WarShip.Dispenser"); WarShipForbiddenIds = config.getIntegerList("Schematics.WarShip.ForbiddenIds"); WarShipCheckList = config.getStringList("Schematics.WarShip.CheckList"); @@ -90,9 +90,9 @@ public class Config { AirShipBreite = config.getDouble("Schematics.AirShip.Breite"); AirShipHöhe = config.getDouble("Schematics.AirShip.Höhe"); AirShipTiefe = config.getDouble("Schematics.AirShip.Tiefe"); - AirShipMaxObsidian = config.getInt("Schematics.AirShip.Obsidian"); - AirShipMaxBedrock = config.getInt("Schematics.AirShip.Bedrock"); - AirShipObsidianBedrock = config.getInt("Schematics.AirShip.ObsidianBedrock"); + AirShipMaxTNT = config.getInt("Schematics.AirShip.TNT"); + AirShipMaxSchleim = config.getInt("Schematics.AirShip.Schleim"); + AirShipTNTSchleim = config.getInt("Schematics.AirShip.TNTSchleim"); AirShipMaxDispenser = config.getInt("Schematics.AirShip.Dispenser"); AirShipForbiddenIds = config.getIntegerList("Schematics.AirShip.ForbiddenIds"); AirShipCheckList = config.getStringList("Schematics.AirShip.CheckList");