本文整理汇总了Java中org.bukkit.Location.getChunk方法的典型用法代码示例。如果您正苦于以下问题:Java Location.getChunk方法的具体用法?Java Location.getChunk怎么用?Java Location.getChunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Location
的用法示例。
在下文中一共展示了Location.getChunk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshCache
import org.bukkit.Location; //导入方法依赖的package包/类
private static void refreshCache(BlockStorage storage, Location l, String key, String value, boolean updateTicker) {
Config cfg = storage.cache_blocks.containsKey(key) ? storage.cache_blocks.get(key): new Config(path_blocks + l.getWorld().getName() + "/" + key + ".sfb");
cfg.setValue(serializeLocation(l), value);
storage.cache_blocks.put(key, cfg);
if (updateTicker) {
SlimefunItem item = SlimefunItem.getByID(key);
if (item != null && item.isTicking()) {
Chunk chunk = l.getChunk();
if (value != null) {
Set<Block> blocks = ticking_chunks.containsKey(chunk.toString()) ? ticking_chunks.get(chunk.toString()): new HashSet<Block>();
blocks.add(l.getBlock());
ticking_chunks.put(chunk.toString(), blocks);
if (!loaded_tickers.contains(chunk.toString())) loaded_tickers.add(chunk.toString());
}
}
}
}
示例2: onChunkChange
import org.bukkit.Location; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onChunkChange(PlayerMoveEvent event) {
Location to = event.getTo();
Location from = event.getFrom();
if (to.getBlockX() == from.getBlockX() && to.getBlockZ() == from.getBlockZ()) {
return;
}
Chunk toChunk = to.getChunk();
Chunk fromChunk = from.getChunk();
if (toChunk.getX() == fromChunk.getX() && toChunk.getZ() == fromChunk.getZ()) {
return;
}
PlayerModule.getInstance().getPlayer(event.getPlayer()).handleViewDistance();
}
示例3: MobSpawn
import org.bukkit.Location; //导入方法依赖的package包/类
public MobSpawn(MobType[] types, Location loc, int radius, int respawnDelay, int leash) {
this.types = types;
this.loc = loc;
this.leash = leash;
this.radius = radius;
this.chunk = loc.getChunk();
this.respawnDelay = respawnDelay;
}
示例4: onExpire
import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onExpire(UUID userUUID) {
Player player = Bukkit.getPlayer(userUUID);
if (player == null)
return;
Location destination = this.destinationMap.remove(userUUID);
if (destination != null) {
destination.getChunk(); // pre-load the chunk before teleport.
player.teleport(destination, PlayerTeleportEvent.TeleportCause.COMMAND);
}
}