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


Java Banner.update方法代码示例

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


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

示例1: placeStanding

import org.bukkit.block.Banner; //导入方法依赖的package包/类
public static boolean placeStanding(Location location, BannerMeta meta) {
    Block block = location.getBlock();
    block.setType(Material.STANDING_BANNER, false);

    final BlockState state = block.getState();
    if(state instanceof Banner) {
        Banner banner = (Banner) block.getState();
        applyToBlock(banner, meta);

        org.bukkit.material.Banner material = (org.bukkit.material.Banner) banner.getData();
        material.setFacingDirection(BlockFaces.yawToFace(location.getYaw()));
        banner.setData(material);
        banner.update(true);
        return true;
    }
    return false;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:18,代码来源:Banners.java

示例2: change

import org.bukkit.block.Banner; //导入方法依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
	Block b = block.getSingle(e);
	if (b == null) {
		return;
	}
	if (b.getType() == Material.BANNER) {
		Banner banner = (Banner) b.getState();
		Pattern[] patterns = (Pattern[]) delta;
		switch (mode) {
			case ADD:
				Arrays.asList(patterns).forEach(banner::addPattern);
				break;
			case SET:
				banner.setPatterns(Arrays.asList(patterns));
				break;
			case DELETE:
			case RESET:
				for (int i = 1; i <= banner.numberOfPatterns(); i++)
					banner.removePattern(i);
				break;
		}
		banner.update(true, false);
	}
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:26,代码来源:SExprBannerBlockLayers.java

示例3: change

import org.bukkit.block.Banner; //导入方法依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
	Block b = block.getSingle(e);
	if (b == null) {
		return;
	}
	if (b.getType() == Material.BANNER) {
		Banner banner = ((Banner) b.getState());
		switch (mode) {
			case SET:
				Color c = (Color) delta[0];
				banner.setBaseColor(c.getWoolColor());
				break;
			case RESET:
				banner.setBaseColor(DyeColor.WHITE);
				break;
		}
		banner.update(true, false);
	}

}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:22,代码来源:SExprBannerBlockBaseColor.java

示例4: set

import org.bukkit.block.Banner; //导入方法依赖的package包/类
public boolean set(Block block) {
    Banner banner = (Banner) block.getState();
    banner.setBaseColor(bannerBaseColor);
    banner.setPatterns(bannerPattern);
    banner.update();
    return true;
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:8,代码来源:BannerBlock.java

示例5: execute

import org.bukkit.block.Banner; //导入方法依赖的package包/类
@Override
protected void execute(Event e) {
	ItemStack i = item.getSingle(e);
	Block b = block.getSingle(e);
	if (i == null || b == null) {
		return;
	}
	if ((i.getType() == Material.BANNER || i.getType() == Material.SHIELD) && b.getType() == Material.BANNER) {
		BannerMeta itemMeta = ((BannerMeta) i.getItemMeta());
		Banner blockMeta = ((Banner) b.getState());
		blockMeta.setPatterns(itemMeta.getPatterns());
		blockMeta.setBaseColor(itemMeta.getBaseColor());
		blockMeta.update(true, false);
	}
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:16,代码来源:EffApplyBannerItemToBlock.java

示例6: applyMeta

import org.bukkit.block.Banner; //导入方法依赖的package包/类
/**
 * Applies meta to a shield
 *
 * @param itemStack  shield item
 * @param bannerMeta banner meta
 * @return shield item
 */
public static ItemStack applyMeta(ItemStack itemStack, BannerMeta bannerMeta) {
	if(itemStack.getType() != Material.SHIELD && itemStack.getType() != Material.BANNER) {
		throw new IllegalArgumentException("Passed ItemStack is not a shield nor a banner");
	}

	ItemMeta meta = itemStack.getItemMeta();
	BlockStateMeta blockStateMeta = (BlockStateMeta) meta;
	Banner banner = (Banner) blockStateMeta.getBlockState();
	applyMeta(banner, bannerMeta);
	banner.update();
	blockStateMeta.setBlockState(banner);
	itemStack.setItemMeta(blockStateMeta);
	return itemStack;
}
 
开发者ID:MarcinWieczorek,项目名称:NovaGuilds,代码行数:22,代码来源:BannerUtils.java

示例7: set

import org.bukkit.block.Banner; //导入方法依赖的package包/类
public boolean set(Block block) {
    Banner banner = (Banner) block.getState();
    banner.setBaseColor(bannerBaseColor);
    banner.setPatterns(bannerPattern);
    banner.update(true, false);
    return true;
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:8,代码来源:BannerBlock.java

示例8: renderBanner

import org.bukkit.block.Banner; //导入方法依赖的package包/类
public boolean renderBanner(Banner banner, DyeColor color) {
    banner.setBaseColor(color);
    return banner.update(false, false);
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:5,代码来源:PointRegionRender.java

示例9: setBannerFacing

import org.bukkit.block.Banner; //导入方法依赖的package包/类
public static void setBannerFacing(BlockFace face, Banner banner) {
    org.bukkit.material.Banner data = (org.bukkit.material.Banner) banner.getMaterialData();
    data.setFacingDirection(face);
    banner.setMaterialData(data);
    banner.update();
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:7,代码来源:Flags.java

示例10: setBlockBanner

import org.bukkit.block.Banner; //导入方法依赖的package包/类
/**
 * Sets up a {@link BlockState} with the properties of a {@link BannerMeta}. This method finally
 * calls {@link BlockState#update(boolean, boolean)} with the first boolean as {@code true} and
 * the second as {@code false}, causing an update but without any physics checks.
 *
 * @param state block state to modify
 * @param bannerMeta banner metadata to apply to {@code block}
 *
 * @throws IllegalArgumentException if the {@code block} is not {@link Material#STANDING_BANNER}
 * or {@link Material#WALL_BANNER}
 */
public static void setBlockBanner(BlockState state, BannerMeta bannerMeta) {
  Preconditions.checkArgument(state instanceof Banner, "block state is not of Banner.");
  Banner bannerState = (Banner) state;
  bannerState.setBaseColor(bannerMeta.getBaseColor());
  bannerState.setPatterns(bannerMeta.getPatterns());
  bannerState.update(true, false);
}
 
开发者ID:SupaHam,项目名称:SupaCommons,代码行数:19,代码来源:BlockUtils.java


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