diff --git a/src/de/steamwar/spectatesystem/PacketProcessor.java b/src/de/steamwar/spectatesystem/PacketProcessor.java
index 7ebc5fd..8ed1e49 100644
--- a/src/de/steamwar/spectatesystem/PacketProcessor.java
+++ b/src/de/steamwar/spectatesystem/PacketProcessor.java
@@ -21,6 +21,8 @@ package de.steamwar.spectatesystem;
import com.sk89q.worldedit.EditSession;
import de.steamwar.spectatesystem.elements.*;
+import de.steamwar.spectatesystem.util.ColorConverter;
+import de.steamwar.spectatesystem.util.WorldLoader;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
diff --git a/src/de/steamwar/spectatesystem/listener/ArenaListener.java b/src/de/steamwar/spectatesystem/listener/ArenaListener.java
index 39b3240..f2c112c 100644
--- a/src/de/steamwar/spectatesystem/listener/ArenaListener.java
+++ b/src/de/steamwar/spectatesystem/listener/ArenaListener.java
@@ -20,8 +20,9 @@
package de.steamwar.spectatesystem.listener;
import de.steamwar.spectatesystem.Config;
-import de.steamwar.spectatesystem.Region;
+import de.steamwar.spectatesystem.util.Region;
import de.steamwar.spectatesystem.SpectateSystem;
+import de.steamwar.spectatesystem.util.WorldLoader;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
@@ -30,6 +31,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
@@ -92,4 +94,9 @@ public class ArenaListener extends BasicListener {
public void onBlockExplosion(BlockExplodeEvent e){
e.setCancelled(true);
}
+
+ @EventHandler
+ public void onChat(AsyncPlayerChatEvent e){
+ WorldLoader.reloadWorld();
+ }
}
diff --git a/src/de/steamwar/spectatesystem/ColorConverter.java b/src/de/steamwar/spectatesystem/util/ColorConverter.java
similarity index 98%
rename from src/de/steamwar/spectatesystem/ColorConverter.java
rename to src/de/steamwar/spectatesystem/util/ColorConverter.java
index 0405973..40e5729 100644
--- a/src/de/steamwar/spectatesystem/ColorConverter.java
+++ b/src/de/steamwar/spectatesystem/util/ColorConverter.java
@@ -17,7 +17,7 @@
along with this program. If not, see .
*/
-package de.steamwar.spectatesystem;
+package de.steamwar.spectatesystem.util;
import de.steamwar.core.Core;
import org.bukkit.ChatColor;
diff --git a/src/de/steamwar/spectatesystem/Region.java b/src/de/steamwar/spectatesystem/util/Region.java
similarity index 98%
rename from src/de/steamwar/spectatesystem/Region.java
rename to src/de/steamwar/spectatesystem/util/Region.java
index 8d8c3a0..4ad1bcd 100644
--- a/src/de/steamwar/spectatesystem/Region.java
+++ b/src/de/steamwar/spectatesystem/util/Region.java
@@ -17,7 +17,7 @@
along with this program. If not, see .
*/
-package de.steamwar.spectatesystem;
+package de.steamwar.spectatesystem.util;
import org.bukkit.Location;
diff --git a/src/de/steamwar/spectatesystem/WorldLoader.java b/src/de/steamwar/spectatesystem/util/WorldLoader.java
similarity index 72%
rename from src/de/steamwar/spectatesystem/WorldLoader.java
rename to src/de/steamwar/spectatesystem/util/WorldLoader.java
index b3fdea5..b1a74fa 100644
--- a/src/de/steamwar/spectatesystem/WorldLoader.java
+++ b/src/de/steamwar/spectatesystem/util/WorldLoader.java
@@ -17,11 +17,15 @@
along with this program. If not, see .
*/
-package de.steamwar.spectatesystem;
+package de.steamwar.spectatesystem.util;
+import de.steamwar.spectatesystem.Config;
+import de.steamwar.spectatesystem.SpectateSystem;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
+import org.bukkit.Material;
import org.bukkit.World;
+import org.bukkit.craftbukkit.v1_15_R1.CraftChunk;
public class WorldLoader {
private WorldLoader(){}
@@ -31,9 +35,12 @@ public class WorldLoader {
public static void reloadWorld(){
Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> {
for(Chunk chunk: world.getLoadedChunks()){
+ System.out.println(((CraftChunk)chunk).getHandle().mustNotSave);
+ ((CraftChunk)chunk).getHandle().mustNotSave = true;
world.unloadChunk(chunk.getX(), chunk.getZ(), false);
world.getChunkAt(chunk.getX(), chunk.getZ());
}
});
+ Bukkit.getScheduler().runTaskLater(SpectateSystem.get(), () -> world.getBlockAt(Config.SpecSpawn).setType(Material.STONE), 100);
}
}