Schematic pasting refactoring #286
@ -33,6 +33,7 @@ import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader;
|
|||||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
@ -103,9 +104,9 @@ public class WorldeditWrapper14 implements WorldeditWrapper.IWorldeditWrapper {
|
|||||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(position.getWorld()), -1);
|
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(position.getWorld()), -1);
|
||||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||||
ch.setTransform(aT);
|
ch.setTransform(aT);
|
||||||
Operations.completeBlindly(ch.createPaste(e).to(BukkitAdapter.asBlockVector(position).add(
|
Operations.completeBlindly(ch.createPaste(e).to(BukkitAdapter.asVector(position).add(
|
||||||
aT.apply(BlockVector3.at(offset.getBlockX(), offset.getBlockY(), offset.getBlockZ()).add(clipboard.getOrigin()).subtract(clipboard.getMinimumPoint()).toVector3()).toBlockPoint()
|
aT.apply(Vector3.at(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin().toVector3()).subtract(clipboard.getMinimumPoint().toVector3()))
|
||||||
)).build());
|
).toBlockPoint()).build());
|
||||||
e.flushSession();
|
e.flushSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ public class WorldeditWrapper8 implements WorldeditWrapper.IWorldeditWrapper {
|
|||||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
|
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
|
||||||
ClipboardHolder ch = new ClipboardHolder(clipboard, w.getWorldData());
|
ClipboardHolder ch = new ClipboardHolder(clipboard, w.getWorldData());
|
||||||
ch.setTransform(aT);
|
ch.setTransform(aT);
|
||||||
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(new Vector(position.getBlockX(), position.getBlockY(), position.getBlockZ()).add(
|
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(new Vector(position.getX(), position.getY(), position.getZ()).add(
|
||||||
aT.apply(new Vector(offset.getBlockX(), offset.getBlockY(), offset.getBlockZ()).add(clipboard.getOrigin()).subtract(clipboard.getMinimumPoint())).toBlockPoint()
|
aT.apply(new Vector(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin()).subtract(clipboard.getMinimumPoint()))
|
||||||
)).build());
|
).toBlockPoint()).build());
|
||||||
e.flushQueue();
|
e.flushQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ public class Config {
|
|||||||
public static final Location TeamRedSpawn;
|
public static final Location TeamRedSpawn;
|
||||||
public static final Location SpecSpawn;
|
public static final Location SpecSpawn;
|
||||||
|
|
||||||
private static final int BlueToRedX;
|
public static final int BlueToRedX;
|
||||||
private static final int BlueToRedY;
|
private static final int BlueToRedY;
|
||||||
private static final int BlueToRedZ;
|
public static final int BlueToRedZ;
|
||||||
|
|
||||||
public static final int PreperationArea;
|
public static final int PreperationArea;
|
||||||
public static final int WaterDepth;
|
public static final int WaterDepth;
|
||||||
@ -132,14 +132,15 @@ public class Config {
|
|||||||
public static final int ReplayID;
|
public static final int ReplayID;
|
||||||
|
|
||||||
static{
|
static{
|
||||||
if(!new File(FightSystem.getPlugin().getDataFolder(), System.getProperty("config", "config.yml")).exists()) {
|
String configFile = System.getProperty("config", "config.yml");
|
||||||
|
if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||||
FightSystem.getPlugin().saveDefaultConfig();
|
FightSystem.getPlugin().saveDefaultConfig();
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(FightSystem.getPlugin().getDataFolder(), System.getProperty("config", "config.yml")));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(FightSystem.getPlugin().getDataFolder(), configFile));
|
||||||
|
|
||||||
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), config.getString("Arenaconfig", "config.yml"));
|
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
|
||||||
if(!worldConfigFile.exists()) {
|
if(!worldConfigFile.exists()) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
@ -173,7 +174,7 @@ public class Config {
|
|||||||
GroundWalkable = config.getBoolean("Arena.GroundWalkable");
|
GroundWalkable = config.getBoolean("Arena.GroundWalkable");
|
||||||
|
|
||||||
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
|
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
|
||||||
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.SchematicType")));
|
||||||
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
|
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
|
||||||
boolean rotate = config.getBoolean("Schematic.Rotate");
|
boolean rotate = config.getBoolean("Schematic.Rotate");
|
||||||
PasteAligned = config.getBoolean("Schematic.PasteAligned");
|
PasteAligned = config.getBoolean("Schematic.PasteAligned");
|
||||||
|
@ -132,9 +132,9 @@ public class FightSchematic extends StateDependent {
|
|||||||
clipboard,
|
clipboard,
|
||||||
new Location(Bukkit.getWorlds().get(0), region.centerX(), region.getMinY(), region.centerZ()),
|
new Location(Bukkit.getWorlds().get(0), region.centerX(), region.getMinY(), region.centerZ()),
|
||||||
new Vector(
|
new Vector(
|
||||||
-dims.getBlockX()/2,
|
-(Config.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX() : dims.getBlockX())/2.0,
|
||||||
Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
||||||
-dims.getBlockZ()/2
|
-(Config.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ() : dims.getBlockZ())/2.0
|
||||||
),
|
),
|
||||||
new AffineTransform().rotateY(rotate ? 180 : 0)
|
new AffineTransform().rotateY(rotate ? 180 : 0)
|
||||||
);
|
);
|
||||||
|
@ -71,6 +71,10 @@ public class Region {
|
|||||||
return maxZ;
|
return maxZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSizeX() {
|
||||||
|
return maxX - minX;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSizeZ() {
|
public int getSizeZ() {
|
||||||
return maxZ - minZ;
|
return maxZ - minZ;
|
||||||
}
|
}
|
||||||
@ -120,12 +124,12 @@ public class Region {
|
|||||||
return (maxX - minX) * (maxY - minY) * (maxZ - minZ);
|
return (maxX - minX) * (maxY - minY) * (maxZ - minZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int centerX() {
|
public double centerX() {
|
||||||
return (maxX - minX) / 2 + minX;
|
return (maxX - minX) / 2.0 + minX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int centerZ() {
|
public double centerZ() {
|
||||||
return (maxZ - minZ) / 2 + minZ;
|
return (maxZ - minZ) / 2.0 + minZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean in2dRegion(Location location){
|
public boolean in2dRegion(Location location){
|
||||||
|
@ -23,13 +23,17 @@ public enum Winconditions {
|
|||||||
TIMEOUT,
|
TIMEOUT,
|
||||||
HEART_RATIO_TIMEOUT,
|
HEART_RATIO_TIMEOUT,
|
||||||
PERCENT_TIMEOUT,
|
PERCENT_TIMEOUT,
|
||||||
|
|
||||||
ALL_DEAD,
|
ALL_DEAD,
|
||||||
CAPTAIN_DEAD,
|
CAPTAIN_DEAD,
|
||||||
|
|
||||||
PERCENT_SYSTEM,
|
PERCENT_SYSTEM,
|
||||||
RELATIVE_PERCENT,
|
RELATIVE_PERCENT,
|
||||||
POINTS,
|
POINTS,
|
||||||
|
|
||||||
TIME_TECH_KO,
|
TIME_TECH_KO,
|
||||||
WATER_TECH_KO,
|
WATER_TECH_KO,
|
||||||
PUMPKIN_TECH_KO,
|
PUMPKIN_TECH_KO,
|
||||||
|
|
||||||
HELLS_BELLS
|
HELLS_BELLS
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren