本文整理汇总了Java中org.bukkit.Material.WOOD_BUTTON属性的典型用法代码示例。如果您正苦于以下问题:Java Material.WOOD_BUTTON属性的具体用法?Java Material.WOOD_BUTTON怎么用?Java Material.WOOD_BUTTON使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.WOOD_BUTTON属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bPress
@PuzzleTrigger
public void bPress(CommandBlock cmd) {
buttons--;
// Play sound.
cmd.getBlock().getWorld().playSound(cmd.getBlock().getLocation(), Sound.BLOCK_NOTE_PLING, 1F, 2F);
// Get rid of button
for (BlockFace face : Utils.CUBE_FACES) {
Block bk = cmd.getBlock().getRelative(face, 2);
if (bk.getType() == Material.WOOD_BUTTON)
bk.setType(Material.AIR);
}
if (buttons == 0) {// If there are no buttons left, activate the gold torch.
GenericItem iw = new GenericItem(ItemManager.createItem(Material.RED_ROSE, ChatColor.RED + "Red Key"));
iw.setTagString("id", "d1_red");
Utils.giveItem(Utils.getNearestPlayer(cmd.getLocation(), 15), iw.generateItem());
cmd.getBlock().getWorld().playSound(cmd.getBlock().getLocation(), Sound.BLOCK_NOTE_PLING, 1F, 0.5F);
}
}
示例2: onLeverOrButton
@EventHandler
public void onLeverOrButton(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
Player player = event.getPlayer();
if (clickedBlock == null)
return;
String chunk = clickedBlock.getLocation().getChunk().getX() + ";"
+ clickedBlock.getLocation().getChunk().getZ();
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (!powerable.containsKey(clickedBlock.getWorld().getName()))
return;
if (powerable.get(clickedBlock.getWorld().getName()).getList(chunk).contains(clickedBlock.getLocation()))
return;
// We cancel; send smoke particles for button, and we just turn off the
// lever (if it was, for some reason, on).
if (clickedBlock.getType() == Material.STONE_BUTTON || clickedBlock.getType() == Material.WOOD_BUTTON) {
clickedBlock.getWorld().spawnParticle(Particle.SMOKE_NORMAL, clickedBlock.getLocation().add(0.5, 1, 0.5), 7,
0, 0.2, 0, 0.03);
player.sendMessage(MortuusTerraCore.NOTI_PREFIX + ChatColor.RED + " There is no generator in range!");
} else if (clickedBlock.getType() == Material.LEVER) {
BlockState state = clickedBlock.getState();
Lever lever = (Lever) state.getData();
lever.setPowered(false);
state.setData(lever);
state.update();
clickedBlock.getWorld().spawnParticle(Particle.SMOKE_NORMAL, clickedBlock.getLocation().add(0.5, 1, 0.5), 7,
0, 0.2, 0, 0.03);
player.sendMessage(MortuusTerraCore.NOTI_PREFIX + ChatColor.RED + " There is no generator in range!");
}
}
示例3: onInteract
@EventHandler
public void onInteract(PlayerInteractEvent e) {
final TOAUser u = TOA.getPlayer(e.getPlayer());
if (e.getItem() != null) {
Material m = e.getItem().getType();
if (m == Material.WRITTEN_BOOK || m == Material.BOW || m == Material.SHEARS || m == Material.DIAMOND_SWORD) return;
Ability.useAbility(u, e.getItem().getType());
e.setCancelled(true);
}
if (!u.isOnRank(PACmd.Grupo.Builder)) {
if (e.getClickedBlock() != null) {
if (e.getClickedBlock().getType().equals(Material.TRAP_DOOR) || e.getClickedBlock().getType().equals(Material.IRON_TRAPDOOR)
|| e.getClickedBlock().getType().equals(Material.FENCE_GATE) || e.getClickedBlock().getType().equals(Material.FIRE)
|| e.getClickedBlock().getType().equals(Material.CAULDRON) || e.getClickedBlock().getRelative(BlockFace.UP).getType().equals(Material.FIRE)
|| e.getClickedBlock().getType() == Material.CHEST || e.getClickedBlock().getType() == Material.TRAPPED_CHEST
|| e.getClickedBlock().getType() == Material.DROPPER || e.getClickedBlock().getType() == Material.DISPENSER
|| e.getClickedBlock().getType() == Material.BED_BLOCK || e.getClickedBlock().getType() == Material.BED
|| e.getClickedBlock().getType() == Material.WORKBENCH || e.getClickedBlock().getType() == Material.BREWING_STAND
|| e.getClickedBlock().getType() == Material.ANVIL || e.getClickedBlock().getType() == Material.DARK_OAK_FENCE_GATE
|| e.getClickedBlock().getType() == Material.SPRUCE_FENCE_GATE || e.getClickedBlock().getType() == Material.FURNACE
|| e.getClickedBlock().getType() == Material.BURNING_FURNACE || e.getClickedBlock().getType() == Material.HOPPER
|| e.getClickedBlock().getType() == Material.STONE_BUTTON || e.getClickedBlock().getType() == Material.WOOD_BUTTON) {
e.setCancelled(true);
}
}
}
}
示例4: onInteract
@EventHandler
public void onInteract(PlayerInteractEvent e) {
PAUser u = PAServer.getUser(e.getPlayer());
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (e.getItem() == null) return;
e.setCancelled(true);
if (Cosmetic.useCosmetic(u, e.getItem().getType())) return;
switch (e.getItem().getType()) {
case NETHER_STAR:
e.setCancelled(true);
LobbyMenu.openMenu(u, LobbyMenu.MenuType.SERVERS);
break;
case REDSTONE:
e.setCancelled(true);
u.sendMessage(PAData.LOBBY.getPrefix() + "&cNo estamos listos aún");
//LobbyMenu.openMenu(u, LobbyMenu.MenuType.COSMETICOS);
break;
case WOOD_AXE:
e.setCancelled(true);
u.sendToServer("cons");
break;
}
if (e.getClickedBlock() == null) return;
if (e.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE) {
e.setCancelled(true);
u.sendMessage(PAData.LOBBY.getPrefix() + "&cActualmente estamos trabajando en esto, disculpen las molestias");
}
}
if (!u.isOnRank(PACmd.Grupo.Builder)) {
if (e.getClickedBlock() != null) {
if (e.getClickedBlock().getType().equals(Material.TRAP_DOOR) || e.getClickedBlock().getType().equals(Material.IRON_TRAPDOOR)
|| e.getClickedBlock().getType().equals(Material.FENCE_GATE) || e.getClickedBlock().getType().equals(Material.FIRE)
|| e.getClickedBlock().getType().equals(Material.CAULDRON) || e.getClickedBlock().getRelative(BlockFace.UP).getType().equals(Material.FIRE)
|| e.getClickedBlock().getType() == Material.CHEST || e.getClickedBlock().getType() == Material.TRAPPED_CHEST
|| e.getClickedBlock().getType() == Material.DROPPER || e.getClickedBlock().getType() == Material.DISPENSER
|| e.getClickedBlock().getType() == Material.BED_BLOCK || e.getClickedBlock().getType() == Material.BED
|| e.getClickedBlock().getType() == Material.WORKBENCH || e.getClickedBlock().getType() == Material.BREWING_STAND
|| e.getClickedBlock().getType() == Material.ANVIL || e.getClickedBlock().getType() == Material.DARK_OAK_FENCE_GATE
|| e.getClickedBlock().getType() == Material.SPRUCE_FENCE_GATE || e.getClickedBlock().getType() == Material.FURNACE
|| e.getClickedBlock().getType() == Material.BURNING_FURNACE || e.getClickedBlock().getType() == Material.HOPPER
|| e.getClickedBlock().getType() == Material.STONE_BUTTON || e.getClickedBlock().getType() == Material.WOOD_BUTTON) {
e.setCancelled(true);
}
}
}
}