当前位置: 首页>>代码示例>>Java>>正文


Java BlockTypes.CHEST属性代码示例

本文整理汇总了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);
  }
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:24,代码来源:TempleOfFateListener.java

示例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"));							
				}
			}
		}
	}
}
 
开发者ID:TheoKah,项目名称:CarrotShop,代码行数:33,代码来源:PlayerClickListener.java

示例3: blockCanBeCrate

private boolean blockCanBeCrate(BlockType type){
    return type==BlockTypes.CHEST ||
            type==BlockTypes.TRAPPED_CHEST ||
            type==BlockTypes.ENDER_CHEST;
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:5,代码来源:HuskyCrates.java

示例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();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternChest.java


注:本文中的org.spongepowered.api.block.BlockTypes.CHEST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。