SteamWar/SpigotCore
Archiviert
13
0

Trying fixing failing schem saving

Dieser Commit ist enthalten in:
Lixfel 2020-01-12 18:52:51 +01:00
Ursprung be592388fe
Commit c8b49ae7ef
2 geänderte Dateien mit 3 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -45,11 +45,5 @@
<version>2.0</version> <version>2.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SpigotCore_12</artifactId>
<version>2.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

Datei anzeigen

@ -4,8 +4,8 @@ import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
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.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -17,8 +17,8 @@ import java.io.InputStream;
class Schematic_14 { class Schematic_14 {
private Schematic_14(){} private Schematic_14(){}
private static final ClipboardFormat SCHEMATIC = ClipboardFormats.findByAlias("schematic"); private static final ClipboardFormat SCHEMATIC = BuiltInClipboardFormat.MCEDIT_SCHEMATIC;
private static final ClipboardFormat SCHEM = ClipboardFormats.findByAlias("schem"); private static final ClipboardFormat SCHEM = BuiltInClipboardFormat.SPONGE_SCHEMATIC;
static byte[] getPlayerClipboard(Player player, boolean schemFormat) throws IOException, NoClipboardException { static byte[] getPlayerClipboard(Player player, boolean schemFormat) throws IOException, NoClipboardException {
ClipboardHolder clipboardHolder; ClipboardHolder clipboardHolder;
@ -35,10 +35,8 @@ class Schematic_14 {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try{ try{
if(schemFormat){ if(schemFormat){
assert SCHEM != null;
SCHEM.getWriter(outputStream).write(clipboard); SCHEM.getWriter(outputStream).write(clipboard);
}else{ }else{
assert SCHEMATIC != null;
SCHEMATIC.getWriter(outputStream).write(clipboard); SCHEMATIC.getWriter(outputStream).write(clipboard);
} }
}catch(NullPointerException e){ }catch(NullPointerException e){
@ -60,10 +58,8 @@ class Schematic_14 {
static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException, NoClipboardException { static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException, NoClipboardException {
try { try {
if(schemFormat){ if(schemFormat){
assert SCHEM != null;
return SCHEM.getReader(is).read(); return SCHEM.getReader(is).read();
}else{ }else{
assert SCHEMATIC != null;
return SCHEMATIC.getReader(is).read(); return SCHEMATIC.getReader(is).read();
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {