Change Schematic Reader and Writer to FaWe #242
@ -19,8 +19,10 @@
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -29,14 +31,12 @@ import java.io.InputStream;
|
||||
public class WorldEditWrapper18 extends WorldEditWrapper14 {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
|
||||
//Use FAWE reader due to FAWE capability of reading corrupt FAWE schems
|
||||
NBTInputStream nbtStream = new NBTInputStream(is);
|
||||
try {
|
||||
if(schemFormat){
|
||||
return BuiltInClipboardFormat.FAST.load(is);
|
||||
}else{
|
||||
return BuiltInClipboardFormat.MCEDIT_SCHEMATIC.load(is);
|
||||
}
|
||||
return (schemFormat ? new FastSchematicReader(nbtStream) : new MCEditSchematicReader(nbtStream)).read();
|
||||
} catch (NullPointerException e) {
|
||||
throw new NoClipboardException();
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren