From 2f5d577edb003ef372f7defc2a443f5ddf2f89bd Mon Sep 17 00:00:00 2001 From: Travis CI Date: Thu, 13 Jun 2019 15:23:02 +0200 Subject: [PATCH] Fixing Reset & Testblock reset --- .../bausystem/commands/CommandReset.java | 1 + .../bausystem/commands/CommandTestblock.java | 1 + .../bausystem/world/ArenaSection.java | 9 ----- src/de/steamwar/bausystem/world/Region.java | 38 ++++++------------- 4 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/de/steamwar/bausystem/commands/CommandReset.java b/src/de/steamwar/bausystem/commands/CommandReset.java index 0dc1e53..158306a 100644 --- a/src/de/steamwar/bausystem/commands/CommandReset.java +++ b/src/de/steamwar/bausystem/commands/CommandReset.java @@ -25,6 +25,7 @@ public class CommandReset implements CommandExecutor { for(ArenaSection section : BauSystem.getSections()){ if(section.inRegion(player.getLocation())){ section.reset(); + player.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt"); return false; } } diff --git a/src/de/steamwar/bausystem/commands/CommandTestblock.java b/src/de/steamwar/bausystem/commands/CommandTestblock.java index 9549b87..01952f5 100644 --- a/src/de/steamwar/bausystem/commands/CommandTestblock.java +++ b/src/de/steamwar/bausystem/commands/CommandTestblock.java @@ -25,6 +25,7 @@ public class CommandTestblock implements CommandExecutor { for(ArenaSection section : BauSystem.getSections()){ if(section.inRegion(player.getLocation())){ section.getTestblock().reset(); + player.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt"); return false; } } diff --git a/src/de/steamwar/bausystem/world/ArenaSection.java b/src/de/steamwar/bausystem/world/ArenaSection.java index beee7b7..0e47586 100644 --- a/src/de/steamwar/bausystem/world/ArenaSection.java +++ b/src/de/steamwar/bausystem/world/ArenaSection.java @@ -8,7 +8,6 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Map; public class ArenaSection extends Region { @@ -23,14 +22,6 @@ public class ArenaSection extends Region { return testblock; } - @Override - public Map serialize() { - Map section = super.serialize(); - for(Map.Entry subsection : testblock.serialize().entrySet()) - section.put("testblock." + subsection.getKey(), subsection.getValue()); - return section; - } - public static List loadFromFile(File file) throws IOException, InvalidConfigurationException { YamlConfiguration config = new YamlConfiguration(); config.load(file); diff --git a/src/de/steamwar/bausystem/world/Region.java b/src/de/steamwar/bausystem/world/Region.java index e707e29..e81d83c 100644 --- a/src/de/steamwar/bausystem/world/Region.java +++ b/src/de/steamwar/bausystem/world/Region.java @@ -1,6 +1,7 @@ package de.steamwar.bausystem.world; import com.boydti.fawe.FaweAPI; +import com.boydti.fawe.object.schematic.Schematic; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.math.transform.AffineTransform; @@ -9,14 +10,11 @@ import de.steamwar.bausystem.BauSystem; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.serialization.ConfigurationSerializable; import java.io.File; import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -public class Region implements ConfigurationSerializable { +public class Region { private final int sizeX; private final int sizeY; private final int sizeZ; @@ -29,15 +27,14 @@ public class Region implements ConfigurationSerializable { private final boolean rotate; Region(ConfigurationSection config){ - Region rg = config.getSerializable("region", this.getClass()); - sizeX = rg.sizeX; - sizeY = rg.sizeY; - sizeZ = rg.sizeZ; - minX = rg.minX; - minY = rg.minY; - minZ = rg.minZ; - schematic = rg.schematic; - rotate = rg.rotate; + sizeX = config.getInt("sizeX"); + sizeY = config.getInt("sizeY"); + sizeZ = config.getInt("sizeZ"); + minX = config.getInt("minX"); + minY = config.getInt("minY"); + minZ = config.getInt("minZ"); + schematic = config.getString("schematic"); + rotate = config.getBoolean("rotate"); } public boolean inRegion(Location l){ @@ -50,7 +47,7 @@ public class Region implements ConfigurationSerializable { public void reset(){ File file = new File(BauSystem.SECTION_PATH + schematic); - com.boydti.fawe.object.schematic.Schematic schem; + Schematic schem; try { schem = FaweAPI.load(file); }catch(IOException e){ @@ -70,17 +67,4 @@ public class Region implements ConfigurationSerializable { } schem.paste(w, v, false, true, aT).flushQueue(); } - - public Map serialize() { - Map map = new HashMap<>(); - map.put("sizeX", sizeX); - map.put("sizeY", sizeY); - map.put("sizeZ", sizeZ); - map.put("minX", minX); - map.put("minY", minY); - map.put("minZ", minZ); - map.put("schematic", schematic); - map.put("rotate", rotate); - return map; - } }