當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.LOG_2屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.LOG_2屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.LOG_2屬性的具體用法?Java Material.LOG_2怎麽用?Java Material.LOG_2使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.LOG_2屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTrackedTreeMaterial

public Material getTrackedTreeMaterial(String trackedType) {
	if (Material.CHORUS_PLANT.toString().equals(trackedType))
		return Material.CHORUS_PLANT;
	else {
		for (TreeType treeType : TreeType.values()) {
			if (treeType.toString().equals(trackedType)) {
				if (treeType == TreeType.ACACIA || treeType == TreeType.DARK_OAK)
					return Material.LOG_2;
				else if (treeType == TreeType.BROWN_MUSHROOM)
					return Material.HUGE_MUSHROOM_1;
				else if (treeType == TreeType.RED_MUSHROOM)
					return Material.HUGE_MUSHROOM_2;
				else
					return Material.LOG;
			}
		}
	}
	CropControl.getPlugin().debug("Unable to match tracked tree type material {0}", trackedType);

	return null;
}
 
開發者ID:DevotedMC,項目名稱:CropControl,代碼行數:21,代碼來源:CropControlEventHandler.java

示例2: onWoodBreak

@EventHandler
public void onWoodBreak(BlockBreakEvent event) {
    final Block b = event.getBlock();
    if (b != null && (b.getType() == Material.LOG || b.getType() == Material.LOG_2)) {
        Material handType = event.getPlayer().getItemInHand().getType();
        if (handType == Material.WOOD_AXE || handType == Material.STONE_AXE || handType == Material.IRON_AXE || handType == Material.GOLD_AXE || handType == Material.DIAMOND_AXE) {
            dataMap.put(b, b.getData());
            b.setType(Material.WOOL);
            b.setData(DyeColor.BLACK.getWoolData());
            Player p = event.getPlayer();
            event.getPlayer().sendMessage("> +1 Woodcutting EXP");
            Location loc = b.getLocation();
            Vector v = p.getLocation().subtract(loc).toVector().normalize().multiply(0.5);
            DropManager.dropItem(new ItemStack(Material.LOG), loc, event.getPlayer().getUniqueId()).setVelocity(v);
            RScheduler.schedule(plugin, () -> {
                b.setType(Material.LOG);
                b.setData(dataMap.getOrDefault(b, (byte) 0));
            }, RTicks.seconds(2));
        }
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:21,代碼來源:SkillManager.java

示例3: onTreeGrow

/**
 * Prevents trees from growing outside of the protected area.
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Check world
    if (!Util.inWorld(e.getLocation())) {
        return;
    }
    // Check if this is on an island
    Island island = plugin.getIslands().getIslandAt(e.getLocation());
    if (island == null || island.isSpawn()) {
        return;
    }
    Iterator<BlockState> it = e.getBlocks().iterator();
    while (it.hasNext()) {
        BlockState b = it.next();
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2
                || b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            if (!island.onIsland(b.getLocation())) {
                it.remove();
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:30,代碼來源:IslandGuard.java

示例4: onTreeGrow

/**
 * Converts trees to gravel and glowstone
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());

    if (!Settings.netherTrees) {
        return;
    }
    if (!Settings.netherGenerate || IslandWorld.getNetherWorld() == null) {
        return;
    }
    // Check world
    if (!e.getLocation().getWorld().equals(IslandWorld.getNetherWorld())) {
        return;
    }
    for (BlockState b : e.getBlocks()) {
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
            b.setType(Material.GRAVEL);
        } else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            b.setType(Material.GLOWSTONE);
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:28,代碼來源:NetherEvents.java

示例5: onItemSpawn

/**
 * Delete different type of certains blocks
 *
 * @param event Event
 */
@EventHandler
public void onItemSpawn(ItemSpawnEvent event)
{
    if (event.getEntityType() != EntityType.DROPPED_ITEM)
        return;

    if (event.getEntity().hasMetadata("playerDrop"))
        return;

    Material material = event.getEntity().getItemStack().getType();

    if (material == Material.LOG || material == Material.LOG_2)
        event.getEntity().setItemStack(new ItemStack(Material.LOG, event.getEntity().getItemStack().getAmount()));
    else if (material == Material.COBBLESTONE)
        event.getEntity().setItemStack(new ItemStack(Material.COBBLESTONE, event.getEntity().getItemStack().getAmount()));
    else if (material == Material.STONE)
        event.getEntity().setItemStack(new ItemStack(Material.COBBLESTONE, event.getEntity().getItemStack().getAmount()));
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:23,代碼來源:RapidStackingModule.java

示例6: isNearWood

public boolean isNearWood(Block block, int range)
{
    if(range <= 0)
        return false;

    for(BlockFace face : this.faces)
    {
        Block block1 = block.getRelative(face);

        if(block1.getType() == Material.LOG || block1.getType() == Material.LOG_2)
            return true;
        else if((block1.getType() == Material.LEAVES || block1.getType() == Material.LEAVES_2) && this.isNearWood(block1, range-1))
            return true;
    }

    return false;
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:17,代碼來源:FastTreeModule.java

示例7: getTrackedTypeMaterial

public Material getTrackedTypeMaterial(String trackedType) {
	for (Material material : harvestableCrops.keySet()) {
		if (material.toString().equals(trackedType))
			return material;
	}

	if (Material.MELON_BLOCK.toString().equals(trackedType))
		return Material.MELON_BLOCK;
	else if (Material.PUMPKIN.toString().equals(trackedType))
		return Material.PUMPKIN;

	for (Byte i = 0; i < 6; i++) {
		if (getSaplingType(i).equals(trackedType)) // TODO: odd structure here
			return Material.SAPLING;
	}

	for (TreeType treeType : TreeType.values()) {
		if (treeType.toString().equals(trackedType)) {
			if (treeType == TreeType.ACACIA || treeType == TreeType.DARK_OAK)
				return Material.LOG_2;
			else if (treeType == TreeType.BROWN_MUSHROOM)
				return Material.HUGE_MUSHROOM_1;
			else if (treeType == TreeType.RED_MUSHROOM)
				return Material.HUGE_MUSHROOM_2;
			else
				return Material.LOG;
		}
	}

	if (Material.CHORUS_PLANT.toString().equals(trackedType))
		return Material.CHORUS_PLANT;

	CropControl.getPlugin().debug("Unable to match tracked type material {0}", trackedType);
	return null;
}
 
開發者ID:DevotedMC,項目名稱:CropControl,代碼行數:35,代碼來源:CropControlEventHandler.java

示例8: smeltCheck

public boolean smeltCheck(Inventory inv, ItemStack item)
{
	boolean canSmelt = true;

    if(item == null)
    	canSmelt = false;
    else if(item.getType() == Material.PORK)
		inv.setItem(2, new ItemStack(Material.GRILLED_PORK));
	else if(item.getType() == Material.RAW_BEEF)
		inv.setItem(2, new ItemStack(Material.COOKED_BEEF));
	else if(item.getType() == Material.RAW_CHICKEN)
		inv.setItem(2, new ItemStack(Material.COOKED_CHICKEN));
	else if(item.getType() == Material.RAW_FISH)
		inv.setItem(2, new ItemStack(Material.COOKED_FISH, 1, item.getDurability()));
	else if(item.getType() == Material.POTATO_ITEM)
		inv.setItem(2, new ItemStack(Material.BAKED_POTATO));
	else if(item.getType() == Material.MUTTON)
		inv.setItem(2, new ItemStack(Material.COOKED_MUTTON));
	else if(item.getType() == Material.RABBIT)
		inv.setItem(2, new ItemStack(Material.COOKED_RABBIT));
	else if(item.getType() == Material.SAND)
		inv.setItem(2, new ItemStack(Material.GLASS));
	else if(item.getType() == Material.CLAY_BALL)
		inv.setItem(2, new ItemStack(Material.CLAY_BRICK));
	else if(item.getType() == Material.LOG)
		inv.setItem(2, new ItemStack(Material.COAL, 1, (short)1));
	else if(item.getType() == Material.LOG_2)
		inv.setItem(2, new ItemStack(Material.COAL, 1, (short)1));
	else
		canSmelt = false;
	
	return canSmelt;
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:33,代碼來源:FirestrikerClick.java

示例9: onBlockBreak

/**
 * Breaking all the tree
 *
 * @param event Event
 */
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event)
{
    Material material = event.getBlock().getType();

    if (material == Material.LOG || material == Material.LOG_2)
        Bukkit.getScheduler().runTask(this.plugin, () -> removeTree(event.getBlock(), true, 3));

    event.getPlayer().giveExp(event.getExpToDrop() * 2);
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:15,代碼來源:FastTreeModule.java

示例10: fillFaceable

public static boolean fillFaceable(Block block) {
    Material type = block.getType();
    return type == Material.LOG || type == Material.LOG_2;
}
 
開發者ID:Recraft,項目名稱:Recreator,代碼行數:4,代碼來源:ItemDrawKnife.java


注:本文中的org.bukkit.Material.LOG_2屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。