mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Remove chunk features
This commit is contained in:
parent
acedb05f55
commit
4f6ff31a33
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -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),
|
||||
|
@ -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<TeamFlag> teamFlags = new HashSet<>();
|
||||
|
||||
private List<ItemStack> secureObjects = new CopyOnWriteArrayList<>();
|
||||
private CopyOnWriteArrayList<Chunk> loadedChunks = new CopyOnWriteArrayList<>();
|
||||
private CopyOnWriteArrayList<Sign> classesSigns = new CopyOnWriteArrayList<>();
|
||||
private CopyOnWriteArrayList<DMob> dMobs = new CopyOnWriteArrayList<>();
|
||||
private CopyOnWriteArrayList<DSign> dSigns = new CopyOnWriteArrayList<>();
|
||||
@ -285,20 +283,6 @@ public class DGameWorld extends DInstanceWorld {
|
||||
this.secureObjects = secureObjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the loadedChunks
|
||||
*/
|
||||
public CopyOnWriteArrayList<Chunk> getLoadedChunks() {
|
||||
return loadedChunks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loadedChunks the loadedChunks to set
|
||||
*/
|
||||
public void setLoadedChunks(CopyOnWriteArrayList<Chunk> loadedChunks) {
|
||||
this.loadedChunks = loadedChunks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the classes signs
|
||||
*/
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user