Fix dimensions
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
453dea774e
Commit
5826f7e8b1
@ -109,6 +109,12 @@ public class WorldeditWrapper14 implements WorldeditWrapper.IWorldeditWrapper {
|
||||
e.flushSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions(Clipboard clipboard) {
|
||||
BlockVector3 dims = clipboard.getDimensions();
|
||||
return new Vector(dims.getX(), dims.getY(), dims.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clipboard loadChar(String charName) throws IOException {
|
||||
return new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(FightSystem.getPlugin().getDataFolder(), "text/" + charName + ".schem"))))).read();
|
||||
|
@ -109,6 +109,12 @@ public class WorldeditWrapper8 implements WorldeditWrapper.IWorldeditWrapper {
|
||||
e.flushQueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.util.Vector getDimensions(Clipboard clipboard) {
|
||||
Vector dims = clipboard.getDimensions();
|
||||
return new org.bukkit.util.Vector(dims.getBlockX(), dims.getBlockY(), dims.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clipboard loadChar(String charName) throws IOException {
|
||||
return new SchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(FightSystem.getPlugin().getDataFolder(), "text/" + charName + ".schematic"))))).read(new BukkitWorld(Bukkit.getWorlds().get(0)).getWorldData());
|
||||
|
@ -114,30 +114,30 @@ public class FightSchematic extends StateDependent {
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste);
|
||||
}
|
||||
|
||||
private void replaceTeamColor(Clipboard clipboard) throws WorldEditException {
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(Config.mode) ? ColorConverter.chat2dye(team.getColor()) : DyeColor.PINK);
|
||||
private void replaceTeamColor(Clipboard clipboard) {
|
||||
try {
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(Config.mode) ? ColorConverter.chat2dye(team.getColor()) : DyeColor.PINK);
|
||||
} catch (WorldEditException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not recolor schematic", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void paste(){
|
||||
FreezeWorld freezer = new FreezeWorld();
|
||||
|
||||
try {
|
||||
replaceTeamColor(clipboard);
|
||||
WorldeditWrapper.impl.pasteClipboard(
|
||||
clipboard,
|
||||
new Location(Bukkit.getWorlds().get(0), region.centerX(), region.getMinY(), region.centerZ()),
|
||||
new Vector(
|
||||
-clipboard.getDimensions().getBlockX()/2,
|
||||
Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
||||
-clipboard.getDimensions().getBlockZ()/2
|
||||
),
|
||||
new AffineTransform().rotateY(rotate ? 180 : 0)
|
||||
);
|
||||
} catch (WorldEditException e) {
|
||||
FightSystem.broadcast("§cFehler beim Pasten der Schematic");
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), FightSystem::setPreSchemState);
|
||||
throw new SecurityException("Could not paste schematic", e);
|
||||
}
|
||||
replaceTeamColor(clipboard);
|
||||
|
||||
Vector dims = WorldeditWrapper.impl.getDimensions(clipboard);
|
||||
WorldeditWrapper.impl.pasteClipboard(
|
||||
clipboard,
|
||||
new Location(Bukkit.getWorlds().get(0), region.centerX(), region.getMinY(), region.centerZ()),
|
||||
new Vector(
|
||||
-dims.getBlockX()/2,
|
||||
Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
||||
-dims.getBlockZ()/2
|
||||
),
|
||||
new AffineTransform().rotateY(rotate ? 180 : 0)
|
||||
);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), freezer::disable, 3);
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), team::teleportToSpawn, 40);
|
||||
@ -179,15 +179,11 @@ public class FightSchematic extends StateDependent {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
replaceTeamColor(character);
|
||||
} catch (WorldEditException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not recolor team text", e);
|
||||
}
|
||||
replaceTeamColor(character);
|
||||
|
||||
characters[i] = character;
|
||||
offsets[i] = length;
|
||||
length += character.getDimensions().getBlockX() + 1; // 1 is the distance between characters
|
||||
length += WorldeditWrapper.impl.getDimensions(character).getBlockX() + 1; // 1 is the distance between characters
|
||||
}
|
||||
|
||||
length -= 1;
|
||||
|
@ -39,6 +39,7 @@ public class WorldeditWrapper {
|
||||
void replaceTeamColor(Clipboard clipboard, DyeColor c) throws WorldEditException;
|
||||
int getWaterDepth(Clipboard clipboard);
|
||||
void pasteClipboard(Clipboard clipboard, Location position, Vector offset, AffineTransform aT);
|
||||
Vector getDimensions(Clipboard clipboard);
|
||||
Clipboard loadChar(String charName) throws IOException;
|
||||
void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren