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


Java Material.CACTUS属性代码示例

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


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

示例1: PlaceCheckDoor

@EventHandler
 public void PlaceCheckDoor(BlockPlaceEvent e) {
     if(ConfigPatch.AntiInfSuagrenable){
if(e.isCancelled()){
	Player p = e.getPlayer();
             List<Entity> entities = p.getNearbyEntities(2, 2, 2);
             for(int i=0;i<entities.size();i++){
                 Entity ent = entities.get(i);
                 if(ent.getType() == EntityType.DROPPED_ITEM){
                     Item item = (Item)ent;
                     if(item.getItemStack().getType() == Material.SUGAR_CANE||item.getItemStack().getType() == Material.CACTUS){
                         ent.remove();
                     }
                 }
             }
}
     }
 }
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:18,代码来源:AntiInfSuagr.java

示例2: onPlace

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlace(BlockPlaceEvent e) {
	if (!cm.isAntiPlaceDoorDupe) {
		return;
	}
	// 判断手里的物品是否为门
	if (e.getItemInHand().getType() == Material.WOOD_DOOR || e.getItemInHand().getType() == Material.IRON_DOOR) {
		// 清理所在区块的甘蔗掉落物
		for (Entity entity : e.getPlayer().getLocation().getChunk().getEntities()) {
			if (entity instanceof Item) {
				Material itemType = ((Item) entity).getItemStack().getType();
				if (itemType == Material.SUGAR_CANE || itemType == Material.CACTUS) {
					entity.remove();
				}
			}
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:18,代码来源:AntiPlaceDoorDupe.java

示例3: breakBlock

@Override
public void breakBlock( FlexPlayer player, FlexWorld world, Vector3i position ) {
    position = position.add(0, 1, 0 );
    if( position.getY() < 255 ) {
        BlockState state;
        do {
           state = world.getBlockAt( position );
           if( state.getType() == Material.CACTUS ) {
               world.setBlock( position, new BlockState( Material.AIR ) );
               world.dropItem( position.toLocation( world ), new ItemStack( Material.CACTUS ) );
               position = position.add( 0, 1, 0 );
           }
        } while ( state.getType() == Material.CACTUS && position.getY() < 255 );

    }
    super.breakBlock( player, world, position );
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:17,代码来源:BlockCactus.java

示例4: onPickup

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPickup(PlayerPickupItemEvent e) {
	if (!cm.isAntiPlaceDoorDupe) {
		return;
	}
	if (e.getPlayer().getItemInHand().getType() == Material.WOOD_DOOR || e.getPlayer().getItemInHand().getType() == Material.IRON_DOOR) {
		if (e.getItem().getItemStack().getType() == Material.SUGAR_CANE || e.getItem().getItemStack().getType() == Material.CACTUS) {
			e.setCancelled(true);
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:11,代码来源:AntiPlaceDoorDupe.java

示例5: isSafe

public static boolean isSafe(Material material) {
    return !(material == Material.CACTUS || material.isTransparent()) && material.isSolid();
}
 
开发者ID:Project-Coalesce,项目名称:UHC,代码行数:3,代码来源:Blocks.java

示例6: BlockCactus

public BlockCactus() {
    super( Material.CACTUS );
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:3,代码来源:BlockCactus.java


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