Add Plugin Chunk Ticket API
Allows plugins to force certain chunks to be kept loaded for as long as they are enabled. By: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit;
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.server.BiomeBase;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.Blocks;
|
||||
@@ -27,6 +28,7 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class CraftChunk implements Chunk {
|
||||
private WeakReference<net.minecraft.server.Chunk> weakChunk;
|
||||
@@ -182,6 +184,21 @@ public class CraftChunk implements Chunk {
|
||||
getWorld().setChunkForceLoaded(getX(), getZ(), forced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPluginChunkTicket(Plugin plugin) {
|
||||
return getWorld().addPluginChunkTicket(getX(), getZ(), plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removePluginChunkTicket(Plugin plugin) {
|
||||
return getWorld().removePluginChunkTicket(getX(), getZ(), plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Plugin> getPluginChunkTickets() {
|
||||
return getWorld().getPluginChunkTickets(getX(), getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkSnapshot getChunkSnapshot() {
|
||||
return getChunkSnapshot(true, false, false);
|
||||
|
||||
Reference in New Issue
Block a user