本文整理匯總了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);
}
}