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


Java BlockFace.equals方法代码示例

本文整理汇总了Java中org.bukkit.block.BlockFace.equals方法的典型用法代码示例。如果您正苦于以下问题:Java BlockFace.equals方法的具体用法?Java BlockFace.equals怎么用?Java BlockFace.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.block.BlockFace的用法示例。


在下文中一共展示了BlockFace.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleAOE

import org.bukkit.block.BlockFace; //导入方法依赖的package包/类
private void handleAOE(BlockBreakEvent event) {
	Player player = event.getPlayer();
	
	BlockFace playerDir = Convert.yawToFace(player.getLocation().getYaw());
	Block block = event.getBlock();
	Block up = block.getRelative(BlockFace.UP);
	Block left = block.getRelative(BlockFace.EAST);
	Block right = block.getRelative(BlockFace.WEST);
			
	if(playerDir.equals(BlockFace.EAST) || playerDir.equals(BlockFace.WEST)) {
		left = block.getRelative(BlockFace.NORTH);
		right = block.getRelative(BlockFace.SOUTH);
	}
	if(canAOEBreak(player, block)) {
		player.getInventory().addItem(new ItemStack(block.getType()));
		block.setType(Material.AIR);
	}
	if(canAOEBreak(player, up)) {
		player.getInventory().addItem(new ItemStack(up.getType()));
		up.setType(Material.AIR);
	}
	if(canAOEBreak(player, left)) {
		player.getInventory().addItem(new ItemStack(left.getType()));
		left.setType(Material.AIR);
	}
	if(canAOEBreak(player, right)) {
		player.getInventory().addItem(new ItemStack(right.getType()));
		right.setType(Material.AIR);
	}
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:31,代码来源:AbilityListener.java

示例2: onBlockBreak

import org.bukkit.block.BlockFace; //导入方法依赖的package包/类
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
	Player player = event.getPlayer();
	if(player.getInventory().getItemInMainHand() == null)
		return;
	if(!player.getInventory().getItemInMainHand().hasItemMeta())
		return;
	if(player.getInventory().getItemInMainHand().getItemMeta().getLore() == null)
		return;
	List<String> lore = player.getInventory().getItemInMainHand().getItemMeta().getLore();
	if(contains(lore,"2x2 Explosion")) {
		if(ConfigFile.isEnchantDisabled(player.getWorld().getName()))
			return;
		BlockFace playerDir = Convert.yawToFace(player.getLocation().getYaw());
		Block block = event.getBlock();
		Block up = block.getRelative(BlockFace.UP);
		Block left = block.getRelative(BlockFace.EAST);
		Block right = block.getRelative(BlockFace.WEST);
		if(playerDir.equals(BlockFace.EAST) || playerDir.equals(BlockFace.WEST)) {
			left = block.getRelative(BlockFace.NORTH);
			right = block.getRelative(BlockFace.SOUTH);
		}
		if(plugin.getWorldGuard().canBuild(player, block)) {
			player.getInventory().addItem(new ItemStack(block.getType()));
			block.setType(Material.AIR);
		}
		if(plugin.getWorldGuard().canBuild(player, up)) {
			player.getInventory().addItem(new ItemStack(up.getType()));
			up.setType(Material.AIR);
		}
		if(plugin.getWorldGuard().canBuild(player, left)) {
			player.getInventory().addItem(new ItemStack(left.getType()));
			left.setType(Material.AIR);
		}
		if(plugin.getWorldGuard().canBuild(player, right)) {
			player.getInventory().addItem(new ItemStack(right.getType()));
			right.setType(Material.AIR);
		}
	}
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:41,代码来源:CustomEnchantsListener.java


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