本文整理汇总了Java中org.spongepowered.api.block.BlockTypes.CHEST属性的典型用法代码示例。如果您正苦于以下问题:Java BlockTypes.CHEST属性的具体用法?Java BlockTypes.CHEST怎么用?Java BlockTypes.CHEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.spongepowered.api.block.BlockTypes
的用法示例。
在下文中一共展示了BlockTypes.CHEST属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerInteractEvent
@Listener(order = Order.FIRST)
public void onPlayerInteractEvent(InteractBlockEvent.Secondary.MainHand event, @Root Player player) {
Optional<TempleOfFateInstance> optInst = manager.getApplicableZone(player);
if (!optInst.isPresent()) {
return;
}
TempleOfFateInstance inst = optInst.get();
Optional<Location<World>> optLoc = event.getTargetBlock().getLocation();
if (!optLoc.isPresent()) {
return;
}
Location<World> targetBlock = optLoc.get();
if (targetBlock.getBlockType() == BlockTypes.CHEST) {
event.setUseItemResult(Tristate.FALSE);
event.setUseBlockResult(Tristate.FALSE);
player.sendMessage(Text.of(TextColors.YELLOW, "You have successfully completed the Temple of Fate!"));
inst.rewardPlayer(player);
}
}
示例2: onPlayerLeftClickNormal
@Listener(beforeModifications = true)
public void onPlayerLeftClickNormal(InteractBlockEvent.Primary.MainHand event, @First Player player)
{
Optional<Location<World>> optLoc = event.getTargetBlock().getLocation();
if (!optLoc.isPresent())
return;
Optional<ItemStack> optItem = player.getItemInHand(HandTypes.MAIN_HAND);
if (optItem.isPresent() && optItem.get().getItem().equals(ItemTypes.REDSTONE)) {
if (optLoc.get().getBlockType() == BlockTypes.CHEST || optLoc.get().getBlockType() == BlockTypes.TRAPPED_CHEST || optLoc.get().getBlockType() == BlockTypes.LEVER) {
event.setCancelled(true);
ShopsData.storeItemLocation(player, optLoc.get());
} else if (optLoc.get().getBlockType() == BlockTypes.STANDING_SIGN || optLoc.get().getBlockType() == BlockTypes.WALL_SIGN) {
event.setCancelled(true);
Shop.build(player, optLoc.get());
}
} else if (ShopsData.hasMultipleCurrencies() && optItem.isPresent() && optItem.get().getItem().equals(ItemTypes.STICK)
&& (optLoc.get().getBlockType() == BlockTypes.STANDING_SIGN || optLoc.get().getBlockType() == BlockTypes.WALL_SIGN)) {
Optional<List<Shop>> optShop = ShopsData.getShops(optLoc.get());
if (optShop.isPresent()) {
event.setCancelled(true);
for (Shop shop : optShop.get()) {
if (shop.canLoopCurrency(player)) {
shop.loopCurrency();
if (shop.hasCurrency())
player.sendMessage(Text.of(TextColors.DARK_GREEN, "Shop currency set to ", TextColors.YELLOW, shop.getCurrency().getDisplayName()));
else
player.sendMessage(Text.of(TextColors.DARK_GREEN, "Shop currency set to match server's config"));
}
}
}
}
}
示例3: blockCanBeCrate
private boolean blockCanBeCrate(BlockType type){
return type==BlockTypes.CHEST ||
type==BlockTypes.TRAPPED_CHEST ||
type==BlockTypes.ENDER_CHEST;
}
示例4: getBlock
@Override
public BlockState getBlock() {
final BlockState block = getLocation().getBlock();
return block.getType() == BlockTypes.CHEST || block.getType() == BlockTypes.TRAPPED_CHEST ? block : BlockTypes.CHEST.getDefaultState();
}