當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。