本文整理汇总了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;
}
示例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));
}
}
}
示例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();
}
}
}
}
示例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);
}
}
}
示例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()));
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例10: fillFaceable
public static boolean fillFaceable(Block block) {
Material type = block.getType();
return type == Material.LOG || type == Material.LOG_2;
}