Hotfixing schematic pasting
Dieser Commit ist enthalten in:
Ursprung
2ed8959f5d
Commit
86c57225f7
@ -1,9 +1,13 @@
|
|||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
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;
|
||||||
@ -67,19 +71,18 @@ class FightTeam_8 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static EditSession pasteSchematic(Schematic schematic, int pasteX, int pasteY, int pasteZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
static EditSession pasteSchematic(Schematic schematic, int pasteX, int pasteY, int pasteZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||||
Vector paste = new Vector(pasteX, pasteY, pasteZ);
|
|
||||||
Clipboard clipboard = schematic.load();
|
Clipboard clipboard = schematic.load();
|
||||||
|
|
||||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
Vector dimensions = clipboard.getDimensions();
|
Vector dimensions = clipboard.getDimensions();
|
||||||
Vector v;
|
Vector v = new Vector(pasteX, pasteY, pasteZ);
|
||||||
Vector offset = new Vector(clipboard.getOrigin());
|
Vector offset = clipboard.getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
AffineTransform aT = new AffineTransform();
|
AffineTransform aT = new AffineTransform();
|
||||||
if(rotate){
|
if(rotate){
|
||||||
aT.rotateY(180);
|
aT = aT.rotateY(180);
|
||||||
v = paste.add(dimensions.getX()/2 + dimensions.getX()%2, 0, dimensions.getZ()/2 + dimensions.getZ()%2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
v = v.add(dimensions.getX()/2 + dimensions.getX()%2, 0, dimensions.getZ()/2 + dimensions.getZ()%2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
||||||
}else{
|
}else{
|
||||||
v = paste.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
|
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.AlignWater){
|
if(Config.AlignWater){
|
||||||
@ -97,7 +100,7 @@ class FightTeam_8 {
|
|||||||
Bukkit.getPluginManager().registerEvents(freezer, IFightSystem.getPlugin());
|
Bukkit.getPluginManager().registerEvents(freezer, IFightSystem.getPlugin());
|
||||||
ClipboardHolder ch = new ClipboardHolder(clipboard, w.getWorldData());
|
ClipboardHolder ch = new ClipboardHolder(clipboard, w.getWorldData());
|
||||||
ch.setTransform(aT);
|
ch.setTransform(aT);
|
||||||
ch.createPaste(e, w.getWorldData()).to(v).build();
|
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(v).build());
|
||||||
e.flushQueue();
|
e.flushQueue();
|
||||||
HandlerList.unregisterAll(freezer);
|
HandlerList.unregisterAll(freezer);
|
||||||
return e;
|
return e;
|
||||||
|
@ -59,7 +59,6 @@ public class Config {
|
|||||||
|
|
||||||
//schematic parameter
|
//schematic parameter
|
||||||
public static final boolean OnlyPublicSchematics;
|
public static final boolean OnlyPublicSchematics;
|
||||||
public static final String SchematicDirectory;
|
|
||||||
public static final de.steamwar.sql.SchematicType SchematicType;
|
public static final de.steamwar.sql.SchematicType SchematicType;
|
||||||
public static final boolean TeamRedRotate;
|
public static final boolean TeamRedRotate;
|
||||||
public static final boolean TeamBlueRotate;
|
public static final boolean TeamBlueRotate;
|
||||||
@ -140,7 +139,6 @@ public class Config {
|
|||||||
AlignWater = worldconfig.getBoolean("Arena.AlignWater");
|
AlignWater = worldconfig.getBoolean("Arena.AlignWater");
|
||||||
WaterDepth = worldconfig.getInt("Arena.WaterDepth");
|
WaterDepth = worldconfig.getInt("Arena.WaterDepth");
|
||||||
|
|
||||||
SchematicDirectory = config.getString("Schematic.Directory");
|
|
||||||
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
||||||
boolean rotate = config.getBoolean("Schematic.Rotate");
|
boolean rotate = config.getBoolean("Schematic.Rotate");
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren