Merge pull request 'Change Schematic Reader and Writer to FaWe' (#242) from fawe_reader into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #242 Reviewed-by: YoyoNow <jwsteam@nidido.de> Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
4020b69860
@ -13,10 +13,7 @@ import com.sk89q.worldedit.extension.platform.Capability;
|
|||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.*;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.NBTSchematicReader;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.*;
|
import com.sk89q.worldedit.extent.clipboard.io.legacycompat.*;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
@ -38,8 +35,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
|
|
||||||
public class WorldEditWrapper14 implements WorldEditWrapper.IWorldEditWrapper {
|
public class WorldEditWrapper14 implements WorldEditWrapper.IWorldEditWrapper {
|
||||||
|
|
||||||
private static final ClipboardFormat SCHEMATIC = BuiltInClipboardFormat.MCEDIT_SCHEMATIC;
|
private static final ClipboardFormat SCHEMATIC = ClipboardFormats.findByAlias("schematic");
|
||||||
private static final ClipboardFormat SCHEM = BuiltInClipboardFormat.SPONGE_SCHEMATIC;
|
private static final ClipboardFormat SCHEM = ClipboardFormats.findByAlias("schem");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getPlayerClipboard(Player player, boolean schemFormat) {
|
public InputStream getPlayerClipboard(Player player, boolean schemFormat) {
|
||||||
|
@ -47,7 +47,7 @@ dependencies {
|
|||||||
compileOnly project(":SpigotCore_14")
|
compileOnly project(":SpigotCore_14")
|
||||||
compileOnly project(':CommonCore')
|
compileOnly project(':CommonCore')
|
||||||
|
|
||||||
compileOnly swdep("WorldEdit-1.15")
|
compileOnly swdep("FastAsyncWorldEdit-1.18")
|
||||||
|
|
||||||
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
|
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
|
||||||
compileOnly 'com.mojang:datafixerupper:4.0.26'
|
compileOnly 'com.mojang:datafixerupper:4.0.26'
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader;
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader;
|
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -31,14 +31,12 @@ import java.io.InputStream;
|
|||||||
public class WorldEditWrapper18 extends WorldEditWrapper14 {
|
public class WorldEditWrapper18 extends WorldEditWrapper14 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("removal")
|
||||||
public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
|
public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
|
||||||
//Use FAWE reader due to FAWE capability of reading corrupt FAWE schems
|
//Use FAWE reader due to FAWE capability of reading corrupt FAWE schems
|
||||||
|
NBTInputStream nbtStream = new NBTInputStream(is);
|
||||||
try {
|
try {
|
||||||
if(schemFormat){
|
return (schemFormat ? new FastSchematicReader(nbtStream) : new MCEditSchematicReader(nbtStream)).read();
|
||||||
return new SpongeSchematicReader(new NBTInputStream(is)).read();
|
|
||||||
}else{
|
|
||||||
return new MCEditSchematicReader(new NBTInputStream(is)).read();
|
|
||||||
}
|
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new NoClipboardException();
|
throw new NoClipboardException();
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren