Adding debug code for WorldReloading
Dieser Commit ist enthalten in:
Ursprung
17a1bda409
Commit
2b291afb73
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.spectatesystem;
|
||||
package de.steamwar.spectatesystem.util;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import org.bukkit.ChatColor;
|
@ -17,7 +17,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.spectatesystem;
|
||||
package de.steamwar.spectatesystem.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -17,11 +17,15 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren