当前位置: 首页>>代码示例>>Java>>正文


Java Location.getChunk方法代码示例

本文整理汇总了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());
			}
		}
	}
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:19,代码来源:BlockStorage.java

示例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(); 
		}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:17,代码来源:ChunkChangeEvent.java

示例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;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:9,代码来源:MobSpawn.java

示例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);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:13,代码来源:TeleportTimer.java


注:本文中的org.bukkit.Location.getChunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。