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


Java Sign.getBlock方法代码示例

本文整理汇总了Java中org.bukkit.block.Sign.getBlock方法的典型用法代码示例。如果您正苦于以下问题:Java Sign.getBlock方法的具体用法?Java Sign.getBlock怎么用?Java Sign.getBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.block.Sign的用法示例。


在下文中一共展示了Sign.getBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: chestBlock

import org.bukkit.block.Sign; //导入方法依赖的package包/类
/**
 * Find a valid container block for a given sign, if it exists.
 * @param sign sign to check
 * @return container for the sign if available, null otherwise.
 */
public static Block chestBlock(Sign sign) {
    // is sign attached to a valid vault container?
    Block signBlock = sign.getBlock();
    org.bukkit.material.Sign signData = (org.bukkit.material.Sign)signBlock.getState().getData();
    BlockFace attached = signData.getAttachedFace();

    // allow either the block sign is attached to or the block below the sign as chest block. Prefer attached block.
    Block blockAttached = signBlock.getRelative(attached);
    Block blockBelow = signBlock.getRelative(BlockFace.DOWN);
    if (validContainer(blockAttached.getType()))
        return blockAttached;
    if (validContainer(blockBelow.getType()))
        return blockBelow;

    return null; // no valid container
}
 
开发者ID:sakunc,项目名称:Gringotts-,代码行数:22,代码来源:Util.java

示例2: validatedCommit

import org.bukkit.block.Sign; //导入方法依赖的package包/类
default void validatedCommit(Player player, Sign sign) {
    // Simulates blanking the sign to check if editing this sign is allowed
    SignChangeEvent event = new SignChangeEvent(sign.getBlock(), player, new String[]{"", "", "", ""});
    getServer().getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        player.sendMessage(CHAT_PREFIX + "§cSign edit forbidden by policy or other plugin");
        return;
    }
    commit(player, sign);
}
 
开发者ID:Deltik,项目名称:SignEdit,代码行数:11,代码来源:SignEditCommit.java


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