From 0b57e5f2d98430db1414006e06ee5b0da24ade4b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 20 Jun 2022 21:07:01 +0200 Subject: [PATCH 1/2] Fix SimulatorStorage.enable for old simulators --- .../features/simulator/SimulatorStorage.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java index 873af36e..fcceecc6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java @@ -139,8 +139,16 @@ public class SimulatorStorage implements Enable, Disable { } if (file.getName().endsWith(".yapion")) { String name = file.getName().substring(0, file.getName().length() - 7); - SteamwarUser steamwarUser = SteamwarUser.get(Integer.parseInt(name)); - convert(file, steamwarUser); + try { + SteamwarUser steamwarUser = SteamwarUser.get(Integer.parseInt(name)); + convert(file, steamwarUser); + } catch (Exception e) { + try { + file.delete(); + } catch (IOException ex) { + // Ignore + } + } } else { String name = file.getName().substring(0, file.getName().length() - ".simulator".length()); tntSimulators.put(name, new TNTSimulator(yapionObject)); From 7019682c8c0e0f957b32602cd38dac8756451856 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 20 Jun 2022 21:07:58 +0200 Subject: [PATCH 2/2] Fix build --- .../bausystem/features/simulator/SimulatorStorage.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java index fcceecc6..3570a36f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java @@ -143,11 +143,7 @@ public class SimulatorStorage implements Enable, Disable { SteamwarUser steamwarUser = SteamwarUser.get(Integer.parseInt(name)); convert(file, steamwarUser); } catch (Exception e) { - try { - file.delete(); - } catch (IOException ex) { - // Ignore - } + file.delete(); } } else { String name = file.getName().substring(0, file.getName().length() - ".simulator".length());