diff --git a/src/de/steamwar/spectatesystem/Config.java b/src/de/steamwar/spectatesystem/Config.java index fe53d46..733426a 100644 --- a/src/de/steamwar/spectatesystem/Config.java +++ b/src/de/steamwar/spectatesystem/Config.java @@ -90,6 +90,8 @@ public class Config { public static final int BorderMaxY; public static final int BorderMaxZ; + public static final int AdditionalSpectatorArea; + static{ World world = Bukkit.getWorlds().get(0); File worldConfigFile = new File(world.getWorldFolder(), "config.yml"); @@ -180,6 +182,8 @@ public class Config { BorderMaxY = spectateconfig.getInt("Border.MaxY"); BorderMaxZ = spectateconfig.getInt("Border.MaxZ"); + AdditionalSpectatorArea = spectateconfig.getInt("AdditionalSpectatorArea"); + boolean teamRedRotate; boolean teamBlueRotate; if(TeamBluetoReddistanceX > 0){ diff --git a/src/de/steamwar/spectatesystem/PlayerSetup.java b/src/de/steamwar/spectatesystem/PlayerSetup.java index 255e6b5..8036bd1 100644 --- a/src/de/steamwar/spectatesystem/PlayerSetup.java +++ b/src/de/steamwar/spectatesystem/PlayerSetup.java @@ -53,8 +53,8 @@ public class PlayerSetup { } private static boolean locInArena(Location loc){ - return Config.ArenaMinX <= loc.getX() && Config.ArenaMaxX >= loc.getX() && - Config.ArenaMinZ <= loc.getZ() && Config.ArenaMaxZ >= loc.getZ(); + return Config.ArenaMinX - Config.AdditionalSpectatorArea <= loc.getX() && Config.ArenaMaxX + Config.AdditionalSpectatorArea >= loc.getX() && + Config.ArenaMinZ - Config.AdditionalSpectatorArea <= loc.getZ() && Config.ArenaMaxZ + Config.AdditionalSpectatorArea >= loc.getZ(); } private static void playerJoinsLobby(Player player){ diff --git a/src/de/steamwar/spectatesystem/SpectateSystem.java b/src/de/steamwar/spectatesystem/SpectateSystem.java index 91331db..76bc293 100644 --- a/src/de/steamwar/spectatesystem/SpectateSystem.java +++ b/src/de/steamwar/spectatesystem/SpectateSystem.java @@ -25,6 +25,7 @@ import de.steamwar.spectatesystem.listener.PlayerListener; import de.steamwar.spectatesystem.listener.CancelListener; import de.steamwar.spectatesystem.listener.JoinListener; import de.steamwar.spectatesystem.listener.PlayerSeatListener; +import de.steamwar.spectatesystem.util.WorldLoader; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -52,6 +53,7 @@ public class SpectateSystem extends JavaPlugin { } Bukkit.getPluginCommand("replay").setExecutor(new ReplayCommand()); + WorldLoader.configureForceLoad(); } @Override diff --git a/src/de/steamwar/spectatesystem/commands/ReplayCommand.java b/src/de/steamwar/spectatesystem/commands/ReplayCommand.java index fafc2fc..5be2027 100644 --- a/src/de/steamwar/spectatesystem/commands/ReplayCommand.java +++ b/src/de/steamwar/spectatesystem/commands/ReplayCommand.java @@ -36,7 +36,7 @@ public class ReplayCommand implements CommandExecutor { } try { - new FightfileConnection(new File(args[0])); + new FightfileConnection(new File(args[0] + ".recording")); } catch (IOException e) { Bukkit.getLogger().log(Level.WARNING, "Could not start reading file", e); sender.sendMessage("§eSteam§8War» §cReplay konnte nicht gestartet werden."); diff --git a/src/de/steamwar/spectatesystem/elements/REntity.java b/src/de/steamwar/spectatesystem/elements/REntity.java index 8dd5e23..dcfab37 100644 --- a/src/de/steamwar/spectatesystem/elements/REntity.java +++ b/src/de/steamwar/spectatesystem/elements/REntity.java @@ -68,11 +68,13 @@ public abstract class REntity { } public static void removeAll(){ + int entity_counter = 0; while(!entities.isEmpty()){ + entity_counter++; REntity entity = entities.values().iterator().next(); - System.out.println("Has to remove manually entity " + entity.internalId); entity.remove(); } + System.out.println("Has to remove manually " + entity_counter + " entities!"); } public void move(double x, double y, double z, float yaw, float pitch, byte headYaw){ diff --git a/src/de/steamwar/spectatesystem/util/BlockTextCreator.java b/src/de/steamwar/spectatesystem/util/BlockTextCreator.java index 31118bf..9f3c9ee 100644 --- a/src/de/steamwar/spectatesystem/util/BlockTextCreator.java +++ b/src/de/steamwar/spectatesystem/util/BlockTextCreator.java @@ -39,10 +39,13 @@ public class BlockTextCreator { List result = new ArrayList<>(); for(char c : text.toUpperCase().toCharArray()){ try { - result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + c + ".schem"))))).read()); - } catch (FileNotFoundException e) { - Bukkit.getLogger().log(Level.WARNING, "Could not display character " + c + " due to missing file!"); - } catch (IOException e) { + try{ + result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + c + ".schem"))))).read()); + } catch (FileNotFoundException e) { + Bukkit.getLogger().log(Level.WARNING, "Could not display character " + c + " due to missing file!"); + result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/?.schem"))))).read()); + } + }catch (IOException e) { throw new SecurityException("Could not load text", e); } } diff --git a/src/de/steamwar/spectatesystem/util/WorldLoader.java b/src/de/steamwar/spectatesystem/util/WorldLoader.java index f504b51..88a3352 100644 --- a/src/de/steamwar/spectatesystem/util/WorldLoader.java +++ b/src/de/steamwar/spectatesystem/util/WorldLoader.java @@ -36,6 +36,14 @@ public class WorldLoader { private static final World world = Bukkit.getWorlds().get(0); + public static void configureForceLoad(){ + for(int cX = Config.ArenaMinX / 16; cX <= Config.ArenaMaxX / 16; cX++){ + for(int cZ = Config.ArenaMinZ / 16; cZ <= Config.ArenaMaxZ / 16; cZ++){ + world.setChunkForceLoaded(cX, cZ, true); + } + } + } + public static void reloadWorld(){ Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> { REntity.removeAll();