diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/record/Recorder.java b/FightSystem_Main/src/de/steamwar/fightsystem/record/Recorder.java index d61df19..d9f2f40 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/record/Recorder.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/record/Recorder.java @@ -246,26 +246,23 @@ public interface Recorder { } default void blueSchem(int schemId) { - try { - 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); - } + schem(0xb3, 0xb0, schemId); } default void redSchem(int schemId) { + schem(0xb4, 0xb1, schemId); + } + + default void schem(int embedId, int noEmbedId, int schemId){ try { if(schemId == 0) throw new IOException(); - write(0xb4, schemId, Schematic.getSchemFromDB(schemId).schemData()); + write(embedId, schemId, Schematic.getSchemFromDB(schemId).schemData()); } catch (IOException e) { - Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e); - write(0xb1, schemId); + if(schemId != 0) + Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e); + write(noEmbedId, schemId); } } @@ -308,11 +305,7 @@ public interface Recorder { stream.flush(); } catch (IOException e) { Bukkit.getLogger().log(Level.SEVERE, "Could not write", e); - try { - stream.close(); - } catch (IOException ioException) { - Bukkit.getLogger().log(Level.SEVERE, "Could not close", e); - } + disable(); } }