本文整理汇总了Java中org.bukkit.Material.STONE_PLATE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.STONE_PLATE属性的具体用法?Java Material.STONE_PLATE怎么用?Java Material.STONE_PLATE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.STONE_PLATE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockPlace
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockPlaceEvent event) {
Gamer g = Gamer.get(event.getPlayer());
Block b = event.getBlockPlaced();
if (event.getBlockPlaced().getType() != Material.STONE_PLATE)
return;
event.setCancelled(false);
Mine mine = new Mine(g, b);
b.setMetadata("Mine", new FixedMetadataValue(Nexus.getPlugin(), Mine.getList().indexOf(mine)));
}
示例2: onStep
@GameEvent
public void onStep(@Nonnull PlayerInteractEvent event) {
if (event.getAction() == Action.PHYSICAL) {
if (event.getClickedBlock().getType() != Material.WOOD_PLATE && event.getClickedBlock().getType() != Material.STONE_PLATE) {
return;
}
if (event.isCancelled()) {
return;
}
double strength = 1.5;
double up = 1;
if (event.getClickedBlock().getRelative(BlockFace.DOWN, 2).getState() instanceof Sign) {
Sign sign = (Sign) event.getClickedBlock().getRelative(BlockFace.DOWN, 2).getState();
if (sign.getLine(0).contains("[Boom]")) {
try {
strength = Double.parseDouble(sign.getLine(1));
up = Double.parseDouble(sign.getLine(2));
} catch (final Exception ex) {
log.warning("Invalid boom sign at " + sign.getLocation());
}
}
}
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_ENDERDRAGON_SHOOT, 10.0F, 1.0F);
event.getPlayer().playEffect(event.getPlayer().getLocation(), Effect.SMOKE, 10);
Vector v = event.getPlayer().getLocation().getDirection().multiply(strength / 2).setY(up / 2);
event.getPlayer().setVelocity(v);
event.setCancelled(true);
}
}