From 014cee20a8e69970cc11d618d85194ee7ad5a09b Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 1 Nov 2020 16:17:00 +0100 Subject: [PATCH] Temporary only record if recording Signed-off-by: Lixfel --- FightSystem_API/src/de/steamwar/fightsystem/Config.java | 2 +- .../steamwar/fightsystem/listener/EventRecordListener.java | 2 +- .../src/de/steamwar/fightsystem/record/FileRecorder.java | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/FightSystem_API/src/de/steamwar/fightsystem/Config.java b/FightSystem_API/src/de/steamwar/fightsystem/Config.java index 524da67..1469700 100644 --- a/FightSystem_API/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_API/src/de/steamwar/fightsystem/Config.java @@ -413,6 +413,6 @@ public class Config { return CheckSchemID != 0; } public static boolean recording(){ - return event(); + return event() && SpectateSystem; } } diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java index 5539cb6..8dcc023 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java @@ -52,7 +52,7 @@ public class EventRecordListener extends BasicListener { private static final Random random = new Random(); public EventRecordListener() { - super(Config.event() ? EnumSet.allOf(FightState.class) : EnumSet.noneOf(FightState.class)); + super(Config.recording() ? EnumSet.allOf(FightState.class) : EnumSet.noneOf(FightState.class)); } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/record/FileRecorder.java b/FightSystem_Main/src/de/steamwar/fightsystem/record/FileRecorder.java index 92d19a9..3a0c616 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/record/FileRecorder.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/record/FileRecorder.java @@ -19,8 +19,8 @@ package de.steamwar.fightsystem.record; -import de.steamwar.fightsystem.FightSystem; import org.bukkit.Bukkit; +import org.bukkit.World; import java.io.DataOutputStream; import java.io.File; @@ -35,7 +35,8 @@ public class FileRecorder extends Recorder { public FileRecorder(){ super(); - File file = new File(FightSystem.getPlugin().getDataFolder(), "recording.recording"); + World world = Bukkit.getWorlds().get(0); + File file = new File(world.getWorldFolder(), world.getName() + ".recording"); try{ file.createNewFile(); outputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file), 4096));