From 4f6ff31a330b391bfcfea86f4b75f931926f770d Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Tue, 4 Jun 2019 17:34:25 +0200 Subject: [PATCH] Remove chunk features --- .../dungeonsxl/sign/ChunkUpdaterSign.java | 67 ------------------- .../dungeonsxl/sign/DSignTypeDefault.java | 1 - .../erethon/dungeonsxl/world/DGameWorld.java | 16 ----- .../dungeonsxl/world/DWorldListener.java | 11 --- 4 files changed, 95 deletions(-) delete mode 100644 core/src/main/java/de/erethon/dungeonsxl/sign/ChunkUpdaterSign.java diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/ChunkUpdaterSign.java b/core/src/main/java/de/erethon/dungeonsxl/sign/ChunkUpdaterSign.java deleted file mode 100644 index 31de91c4..00000000 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/ChunkUpdaterSign.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2012-2019 Frank Baumann - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package de.erethon.dungeonsxl.sign; - -import de.erethon.caliburn.item.VanillaItem; -import de.erethon.commons.misc.NumberUtil; -import de.erethon.dungeonsxl.DungeonsXL; -import de.erethon.dungeonsxl.world.DGameWorld; -import org.bukkit.Chunk; -import org.bukkit.block.Sign; - -/** - * @author Frank Baumann, Daniel Saukel - */ -public class ChunkUpdaterSign extends DSign { - - public ChunkUpdaterSign(DungeonsXL plugin, Sign sign, String[] lines, DGameWorld gameWorld) { - super(plugin, sign, lines, gameWorld); - } - - @Override - public boolean check() { - return true; - } - - @Override - public void onInit() { - Chunk chunk = getGameWorld().getWorld().getChunkAt(getSign().getBlock()); - - if (!lines[1].isEmpty()) { - Integer radius = NumberUtil.parseInt(lines[1]); - for (int x = -radius; x < radius; x++) { - for (int z = -radius; z < radius; z++) { - Chunk chunk1 = getGameWorld().getWorld().getChunkAt(chunk.getX() - x, chunk.getZ() - z); - chunk1.load(); - getGameWorld().getLoadedChunks().add(chunk1); - } - } - - } else { - chunk.load(); - getGameWorld().getLoadedChunks().add(chunk); - } - - getSign().getBlock().setType(VanillaItem.AIR.getMaterial()); - } - - @Override - public DSignType getType() { - return DSignTypeDefault.CHUNK_UPDATER; - } - -} diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/DSignTypeDefault.java b/core/src/main/java/de/erethon/dungeonsxl/sign/DSignTypeDefault.java index 70396bc6..d86f9807 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/DSignTypeDefault.java +++ b/core/src/main/java/de/erethon/dungeonsxl/sign/DSignTypeDefault.java @@ -41,7 +41,6 @@ public enum DSignTypeDefault implements DSignType { CHECKPOINT("Checkpoint", "checkpoint", false, false, CheckpointSign.class), @Deprecated CHEST("Chest", "chest", false, false, RewardChestSign.class), - CHUNK_UPDATER("ChunkUpdater", "chunkupdater", true, false, ChunkUpdaterSign.class), CLASSES("Classes", "classes", true, true, ClassesSign.class), COMMAND("CMD", "cmd", false, false, CommandSign.class), DROP("Drop", "drop", false, false, DropSign.class), diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java index c6819473..e1153108 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java @@ -56,7 +56,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import org.bukkit.Bukkit; -import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.block.Block; @@ -99,7 +98,6 @@ public class DGameWorld extends DInstanceWorld { private Set teamFlags = new HashSet<>(); private List secureObjects = new CopyOnWriteArrayList<>(); - private CopyOnWriteArrayList loadedChunks = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList classesSigns = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList dMobs = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList dSigns = new CopyOnWriteArrayList<>(); @@ -285,20 +283,6 @@ public class DGameWorld extends DInstanceWorld { this.secureObjects = secureObjects; } - /** - * @return the loadedChunks - */ - public CopyOnWriteArrayList getLoadedChunks() { - return loadedChunks; - } - - /** - * @param loadedChunks the loadedChunks to set - */ - public void setLoadedChunks(CopyOnWriteArrayList loadedChunks) { - this.loadedChunks = loadedChunks; - } - /** * @return the classes signs */ diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java b/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java index 724a25a5..57d59c5a 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DWorldListener.java @@ -40,7 +40,6 @@ import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.player.PlayerArmorStandManipulateEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.weather.WeatherChangeEvent; -import org.bukkit.event.world.ChunkUnloadEvent; /** * @author Daniel Saukel, Frank Baumann, Milan Albrecht @@ -109,16 +108,6 @@ public class DWorldListener implements Listener { } } - @EventHandler - public void onChunkUnload(ChunkUnloadEvent event) { - DInstanceWorld instance = dWorlds.getInstanceByWorld(event.getWorld()); - if (instance instanceof DGameWorld) { - if (((DGameWorld) instance).getLoadedChunks().contains(event.getChunk())) { - event.setCancelled(true); - } - } - } - @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onEntityExplode(EntityExplodeEvent event) { DGameWorld gameWorld = DGameWorld.getByWorld(event.getEntity().getWorld());