SteamWar/FightSystem
Archiviert
13
1

Hotfix more robust schem handling

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-08-27 23:06:26 +02:00
Ursprung 0604d4b725
Commit f8c96b196d

Datei anzeigen

@ -246,26 +246,23 @@ public interface Recorder {
} }
default void blueSchem(int schemId) { default void blueSchem(int schemId) {
try { schem(0xb3, 0xb0, schemId);
if(schemId == 0)
throw new IOException();
write(0xb3, schemId, Schematic.getSchemFromDB(schemId).schemData());
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e);
write(0xb0, schemId);
}
} }
default void redSchem(int schemId) { default void redSchem(int schemId) {
schem(0xb4, 0xb1, schemId);
}
default void schem(int embedId, int noEmbedId, int schemId){
try { try {
if(schemId == 0) if(schemId == 0)
throw new IOException(); throw new IOException();
write(0xb4, schemId, Schematic.getSchemFromDB(schemId).schemData()); write(embedId, schemId, Schematic.getSchemFromDB(schemId).schemData());
} catch (IOException e) { } catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e); if(schemId != 0)
write(0xb1, schemId); Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e);
write(noEmbedId, schemId);
} }
} }
@ -308,11 +305,7 @@ public interface Recorder {
stream.flush(); stream.flush();
} catch (IOException e) { } catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not write", e); Bukkit.getLogger().log(Level.SEVERE, "Could not write", e);
try { disable();
stream.close();
} catch (IOException ioException) {
Bukkit.getLogger().log(Level.SEVERE, "Could not close", e);
}
} }
} }