Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
SPIGOT-3747: Add API for force loaded chunks
Dieser Commit ist enthalten in:
Ursprung
a408f3751e
Commit
2bc7d1df25
@ -147,6 +147,16 @@ public class CraftChunk implements Chunk {
|
||||
return getWorld().unloadChunk(getX(), getZ(), save, safe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForceLoaded() {
|
||||
return getWorld().isChunkForceLoaded(getX(), getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForceLoaded(boolean forced) {
|
||||
getWorld().setChunkForceLoaded(getX(), getZ(), forced);
|
||||
}
|
||||
|
||||
public ChunkSnapshot getChunkSnapshot() {
|
||||
return getChunkSnapshot(true, false, false);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package org.bukkit.craftbukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -278,6 +279,27 @@ public class CraftWorld implements World {
|
||||
((CraftChunk) getChunkAt(chunk.getX(), chunk.getZ())).getHandle().bukkitChunk = chunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChunkForceLoaded(int x, int z) {
|
||||
return getHandle().isForceLoaded(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChunkForceLoaded(int x, int z, boolean forced) {
|
||||
getHandle().setForceLoaded(x, z, forced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Chunk> getForceLoadedChunks() {
|
||||
Set<Chunk> chunks = new HashSet<>();
|
||||
|
||||
for (long coord : getHandle().ag()) { // PAIL
|
||||
chunks.add(getChunkAt(ChunkCoordIntPair.a(coord), ChunkCoordIntPair.b(coord)));
|
||||
}
|
||||
|
||||
return Collections.unmodifiableCollection(chunks);
|
||||
}
|
||||
|
||||
public WorldServer getHandle() {
|
||||
return world;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren