SteamWar/FightSystem
Archiviert
13
1

Fix try/catch in FightTeam.pasteSchematic

Dieser Commit ist enthalten in:
jojo 2021-01-04 22:26:29 +01:00
Ursprung 623ee6c75a
Commit 042449e591

Datei anzeigen

@ -279,22 +279,30 @@ public class FightTeam implements IFightTeam{
try {
VersionedRunnable.call(new VersionedRunnable(() -> {
EditSession e = FightTeam_8.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
try {
EditSession e = FightTeam_8.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_8.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
throw new SecurityException("Error pasting arena in schematic", ex);
}
}, 8), new VersionedRunnable(() -> {
EditSession e = FightTeam_8.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_12.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
try {
EditSession e = FightTeam_8.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_12.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
throw new SecurityException("Error pasting arena in schematic", ex);
}
}, 12), new VersionedRunnable(() -> {
EditSession e = FightTeam_14.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_14.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
try {
EditSession e = FightTeam_14.pasteSchematic(schem, pasteX, pasteY, pasteZ, rotate);
FightTeam_14.replaceTeamColor(e, c, cornerX, cornerY, cornerZ);
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
throw new SecurityException("Error pasting arena in schematic", ex);
}
}, 14));
} catch (Schematic.WrongVersionException ex) {
broadcast(FightSystem.PREFIX + "§cDie gewählte Schematic kann nicht in dieser Version geladen werden");
HandlerList.unregisterAll(freezer);
return;
} catch (IOException | NoClipboardException ex) {
} catch (SecurityException securityException) {
broadcast(FightSystem.PREFIX + "§cFehler beim Pasten der Schematic");
throw new SecurityException("Error pasting arena in schematic", ex);
throw securityException;
}
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> HandlerList.unregisterAll(freezer), 3);
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), this::teleportToSpawn,40);