Fixing Reset & Testblock reset
Dieser Commit ist enthalten in:
Ursprung
59ab68ad6b
Commit
2f5d577edb
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<String, Object> serialize() {
|
||||
Map<String, Object> section = super.serialize();
|
||||
for(Map.Entry<String, Object> subsection : testblock.serialize().entrySet())
|
||||
section.put("testblock." + subsection.getKey(), subsection.getValue());
|
||||
return section;
|
||||
}
|
||||
|
||||
public static List<ArenaSection> loadFromFile(File file) throws IOException, InvalidConfigurationException {
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.load(file);
|
||||
|
@ -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<String, Object> serialize() {
|
||||
Map<String, Object> 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;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren