本文整理了Java中org.bukkit.Chunk.load()
方法的一些代码示例,展示了Chunk.load()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Chunk.load()
方法的具体详情如下:
包路径:org.bukkit.Chunk
类名称:Chunk
方法名:load
[英]Loads the chunk.
[中]加载块。
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public void loadChunk(Chunk chunk) {
chunk.load();
}
代码示例来源:origin: GlowstoneMC/Glowstone
for (int x = cx - 8; x <= cx + 8 && !placed; x++) {
for (int z = cz - 8; z <= cz + 8 && !placed; z++) {
if (!world.getChunkAt(x, z).isLoaded() && !world.getChunkAt(x, z).load(true)) {
continue;
代码示例来源:origin: EngineHub/CommandBook
public void teleport(Player player) {
loc.getChunk().load(true);
player.teleport(loc);
}
}
代码示例来源:origin: BigScary/GriefPrevention
private static void GuaranteeChunkLoaded(Location location)
{
Chunk chunk = location.getChunk();
while(!chunk.isLoaded() || !chunk.load(true));
}
代码示例来源:origin: elBukkit/MagicPlugin
private static boolean checkSingleChunk(Chunk chunk, boolean load) {
if (!chunk.isLoaded()) {
if (load) {
chunk.load();
}
return false;
}
return isReady(chunk);
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
public void loadChunks() {
int minX = (int) Math.floor(this.minCorner.getX());
int maxX = (int) Math.ceil(this.maxCorner.getX());
int minZ = (int) Math.floor(this.minCorner.getZ());
int maxZ = (int) Math.ceil(this.maxCorner.getZ());
for (int x = minX; x <= maxX; x += Region.CHUNK_SIZE) {
for (int z = minZ; z <= maxZ; z += Region.CHUNK_SIZE) {
Chunk chunk = this.world.getChunkAt(x, z);
if (!chunk.isLoaded()) {
chunk.load();
}
}
}
}
代码示例来源:origin: BedwarsRel/BedwarsRel
public void loadChunks() {
int minX = (int) Math.floor(this.minCorner.getX());
int maxX = (int) Math.ceil(this.maxCorner.getX());
int minZ = (int) Math.floor(this.minCorner.getZ());
int maxZ = (int) Math.ceil(this.maxCorner.getZ());
for (int x = minX; x <= maxX; x += Region.CHUNK_SIZE) {
for (int z = minZ; z <= maxZ; z += Region.CHUNK_SIZE) {
Chunk chunk = this.world.getChunkAt(x, z);
if (!chunk.isLoaded()) {
chunk.load();
}
}
}
}
代码示例来源:origin: elBukkit/MagicPlugin
@Override
public void prepare() {
if (cloneSource != null && cloneTarget != null) {
Block block = cloneTarget.getBlock();
if (!block.getChunk().isLoaded()) {
block.getChunk().load(true);
}
}
}
代码示例来源:origin: mcmonkeyprojects/Sentinel
@Override
public void run() {
if (!event.getPlayer().getWorld().equals(event.getTo().getWorld())) {
return;
}
event.getFrom().getChunk().load();
event.getTo().getChunk().load();
npc.spawn(event.getTo());
}
}, 1);
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
public Block getHeadTarget() {
if (this.targetHeadBlock == null) {
return null;
}
this.getTargetHeadBlock().getBlock().getChunk().load(true);
return this.getTargetHeadBlock().getBlock();
}
代码示例来源:origin: BedwarsRel/BedwarsRel
public Block getHeadTarget() {
if (this.targetHeadBlock == null) {
return null;
}
this.getTargetHeadBlock().getBlock().getChunk().load(true);
return this.getTargetHeadBlock().getBlock();
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
public Block getFeetTarget() {
if (this.getTargetFeetBlock() == null) {
return null;
}
this.getTargetFeetBlock().getBlock().getChunk().load(true);
return this.getTargetFeetBlock().getBlock();
}
代码示例来源:origin: BedwarsRel/BedwarsRel
public Block getFeetTarget() {
if (this.getTargetFeetBlock() == null) {
return null;
}
this.getTargetFeetBlock().getBlock().getChunk().load(true);
return this.getTargetFeetBlock().getBlock();
}
代码示例来源:origin: DRE2N/DungeonsXL
@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());
}
代码示例来源:origin: BedwarsRel/BedwarsRel
public boolean isDead(Game game) {
Material targetMaterial = game.getTargetMaterial();
this.getTargetHeadBlock().getBlock().getChunk().load(true);
if (this.getTargetFeetBlock() == null) {
return this.getTargetHeadBlock().getBlock().getType() != targetMaterial;
}
this.getTargetFeetBlock().getBlock().getChunk().load(true);
return (this.getTargetHeadBlock().getBlock().getType() != targetMaterial
&& this.getTargetFeetBlock().getBlock().getType() != targetMaterial);
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
public boolean isDead(Game game) {
Material targetMaterial = game.getTargetMaterial();
this.getTargetHeadBlock().getBlock().getChunk().load(true);
if (this.getTargetFeetBlock() == null) {
return this.getTargetHeadBlock().getBlock().getType() != targetMaterial;
}
this.getTargetFeetBlock().getBlock().getChunk().load(true);
return (this.getTargetHeadBlock().getBlock().getType() != targetMaterial
&& this.getTargetFeetBlock().getBlock().getType() != targetMaterial);
}
代码示例来源:origin: eccentricdevotion/TARDIS
public void closeDoors() {
// get door locations
ResultSetDoorBlocks rs = new ResultSetDoorBlocks(plugin, id);
if (rs.resultSet()) {
close(rs.getOuterBlock(), rs.getInnerBlock().getLocation());
// inner
if (!rs.getInnerBlock().getChunk().isLoaded()) {
rs.getInnerBlock().getChunk().load();
}
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> close(rs.getInnerBlock(), null), 5L);
}
}
代码示例来源:origin: eccentricdevotion/TARDIS
public void openDoors() {
// get door locations
// inner
ResultSetDoorBlocks rs = new ResultSetDoorBlocks(plugin, id);
if (rs.resultSet()) {
open(rs.getInnerBlock(), rs.getOuterBlock(), true);
// outer
if (!rs.getOuterBlock().getChunk().isLoaded()) {
rs.getOuterBlock().getChunk().load();
}
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> open(rs.getOuterBlock(), rs.getInnerBlock(), false), 5L);
}
}
代码示例来源:origin: eccentricdevotion/TARDIS
private Location getRelativeLocation(Player p) {
Location playerLoc = p.getLocation();
double x = vortexJunkLoc.getX() + (playerLoc.getX() - junkLoc.getX());
double y = vortexJunkLoc.getY() + (playerLoc.getY() - junkLoc.getY()) + 0.5d;
double z = vortexJunkLoc.getZ() + (playerLoc.getZ() - junkLoc.getZ());
Location l = new Location(vortexJunkLoc.getWorld(), x, y, z, playerLoc.getYaw(), playerLoc.getPitch());
while (!l.getChunk().isLoaded()) {
l.getChunk().load();
}
return l;
}
代码示例来源:origin: eccentricdevotion/TARDIS
private Location getRelativeLocation(Player p) {
Location playerLoc = p.getLocation();
double x = dd.getFromToLocation().getX() + (playerLoc.getX() - dd.getLocation().getX());
double y = dd.getFromToLocation().getY() + (playerLoc.getY() - dd.getLocation().getY()) + 1.1d;
double z = dd.getFromToLocation().getZ() + (playerLoc.getZ() - dd.getLocation().getZ());
Location l = new Location(dd.getFromToLocation().getWorld(), x, y, z, playerLoc.getYaw(), playerLoc.getPitch());
while (!l.getChunk().isLoaded()) {
l.getChunk().load();
}
return l;
}
内容来源于网络,如有侵权,请联系作者删除!