本文整理汇总了Java中org.bukkit.DyeColor类的典型用法代码示例。如果您正苦于以下问题:Java DyeColor类的具体用法?Java DyeColor怎么用?Java DyeColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DyeColor类属于org.bukkit包,在下文中一共展示了DyeColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SurvivalTeam
import org.bukkit.DyeColor; //导入依赖的package包/类
/**
* Constructor
*
* @param game Team based game instance
* @param name Team's name
* @param color Team's color
* @param chatColor Team's color in chat
*/
public SurvivalTeam(SurvivalTeamGame game, String name, DyeColor color, ChatColor chatColor)
{
this.game = game;
this.teamName = name;
this.chatColor = chatColor;
this.icon = new ItemStack(Material.WOOL, 1, color.getData());
this.maxSize = game.getPersonsPerTeam();
this.invited = new ArrayList<>();
this.players = new HashMap<>();
SurvivalAPI.get().registerEvent(SurvivalAPI.EventType.WORLDLOADED, () ->
{
Scoreboard board = game.getScoreboard();
this.team = board.registerNewTeam("meow" + chatColor.getChar());
this.team.setDisplayName(name);
this.team.setCanSeeFriendlyInvisibles(true);
this.team.setPrefix(chatColor + "");
this.team.setSuffix(ChatColor.RESET + "");
});
}
示例2: BannerCustomItem
import org.bukkit.DyeColor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public BannerCustomItem(Material material, Config config, PlaceholderRegistry placeholders) {
super(material, config, placeholders);
this.baseColor = config.getDye("baseColor");
Collection<Map<String, Object>> rawPatterns = (Collection<Map<String, Object>>) config.getCollection("patterns");
patterns = new ArrayList<>();
if(rawPatterns != null) {
for (Map<String, Object> p : rawPatterns) {
Config sub = Config.wrap(p);
DyeColor color = sub.getDyeRequired("color");
PatternType type = PatternType.getByIdentifier(sub.getStringRequired("pattern"));
if (type == null) {
Uppercore.logger().severe("Cannot find pattern identifier \"" + p.get("pattern") + "\"");
type = PatternType.BASE;
}
patterns.add(new Pattern(color, type));
}
}
}
示例3: registerInventory
import org.bukkit.DyeColor; //导入依赖的package包/类
private void registerInventory(Inventory inventory) {
if (scannedChests.contains(inventory.getHolder())) {
return;
}
scannedChests.add(inventory.getHolder());
for (ItemStack itemStack : inventory) {
if (itemStack != null && itemStack.getType() != null) {
if (itemStack.getType() == Material.WOOL) {
DyeColor dyeColor = ((Wool) itemStack.getData()).getColor();
woolChests.put(inventory.getHolder(), dyeColor);
fillInventoryWithWool(inventory, dyeColor);
}
}
}
}
示例4: onWoodBreak
import org.bukkit.DyeColor; //导入依赖的package包/类
@EventHandler
public void onWoodBreak(BlockBreakEvent event) {
final Block b = event.getBlock();
if (b != null && (b.getType() == Material.LOG || b.getType() == Material.LOG_2)) {
Material handType = event.getPlayer().getItemInHand().getType();
if (handType == Material.WOOD_AXE || handType == Material.STONE_AXE || handType == Material.IRON_AXE || handType == Material.GOLD_AXE || handType == Material.DIAMOND_AXE) {
dataMap.put(b, b.getData());
b.setType(Material.WOOL);
b.setData(DyeColor.BLACK.getWoolData());
Player p = event.getPlayer();
event.getPlayer().sendMessage("> +1 Woodcutting EXP");
Location loc = b.getLocation();
Vector v = p.getLocation().subtract(loc).toVector().normalize().multiply(0.5);
DropManager.dropItem(new ItemStack(Material.LOG), loc, event.getPlayer().getUniqueId()).setVelocity(v);
RScheduler.schedule(plugin, () -> {
b.setType(Material.LOG);
b.setData(dataMap.getOrDefault(b, (byte) 0));
}, RTicks.seconds(2));
}
}
}
示例5: LobbySelector
import org.bukkit.DyeColor; //导入依赖的package包/类
public LobbySelector(WCLobby instance){
gameSelector = iu.createInventory(9, "&cServidores");
ItemStack glass = ItemUtils.coloredBlock(DyeColor.ORANGE, "&cWorld&8Crafteros", ItemUtils.ColoredBlock.FLAT_GLASS);
//Glass
for (int x = 1; x < 8; x++){
gameSelector = iu.setItem(gameSelector, x + 9, glass);
gameSelector = iu.setItem(gameSelector, x + (9 * 4), glass);
}
gameSelector = iu.setItem(gameSelector, 18, glass);
gameSelector = iu.setItem(gameSelector, 27, glass);
gameSelector = iu.setItem(gameSelector, 26, glass);
gameSelector = iu.setItem(gameSelector, 35, glass);
//
}
示例6: MonumentWoolFactoryImpl
import org.bukkit.DyeColor; //导入依赖的package包/类
public MonumentWoolFactoryImpl(@Nullable Boolean required,
boolean visible,
TeamFactory owner,
ProximityMetric woolProximityMetric,
ProximityMetric monumentProximityMetric,
DyeColor color,
Vector location,
Region placement,
boolean craftable) {
super(MonumentWoolFactory.makeName(color), required, visible, Optional.of(owner), woolProximityMetric, monumentProximityMetric);
this.color = color;
this.location = location;
this.placement = placement;
this.craftable = craftable;
this.visible = visible;
this.componentName = MonumentWoolFactory.makeComponentName(color);
}
示例7: isDestroyableWool
import org.bukkit.DyeColor; //导入依赖的package包/类
/**
* Test if the given ItemStack is strictly an enemy wool i.e. not also
* a wool that the given team can capture.
*/
private boolean isDestroyableWool(ItemStack stack, Competitor team) {
if(stack == null || stack.getType() != Material.WOOL) {
return false;
}
DyeColor color = ((Wool) stack.getData()).getColor();
boolean enemyOwned = false;
for(Goal goal : team.getMatch().needMatchModule(GoalMatchModule.class).getGoals()) {
if(goal instanceof MonumentWool) {
MonumentWool wool = (MonumentWool) goal;
if(wool.isVisible() && !wool.isPlaced() && wool.getDyeColor() == color) {
if(wool.getOwner() == team) {
return false;
} else {
enemyOwned = true;
}
}
}
}
return enemyOwned;
}
示例8: onProjectileHit
import org.bukkit.DyeColor; //导入依赖的package包/类
@EventHandler
public void onProjectileHit(ProjectileHitEvent event)
{
if (event.getEntity().getType() != EntityType.SNOWBALL || !event.getEntity().hasMetadata("paintball-ball") || !event.getEntity().getMetadata("paintball-ball").get(0).asString().equals(this.uuid.toString()))
return;
for (Block block : getNearbyBlocks(event.getEntity().getLocation(), 2))
{
if (block.getType() == Material.AIR || block.getType() == Material.SIGN || block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
continue;
if (this.isBlockGloballyUsed(block.getLocation()))
continue;
SimpleBlock simpleBlock = new SimpleBlock(Material.STAINED_CLAY, DyeColor.values()[new Random().nextInt(DyeColor.values().length)].getWoolData());
this.addBlockToUse(block.getLocation(), simpleBlock);
block.setType(simpleBlock.getType());
block.setData(simpleBlock.getData());
}
event.getEntity().remove();
}
示例9: change
import org.bukkit.DyeColor; //导入依赖的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);
}
}
示例10: change
import org.bukkit.DyeColor; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
ItemStack i = item.getSingle(e);
if (i == null) {
return;
}
if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) {
BannerMeta meta = ((BannerMeta) i.getItemMeta());
switch (mode) {
case SET:
Color c = (Color) delta[0];
meta.setBaseColor(c.getWoolColor());
break;
case RESET:
meta.setBaseColor(DyeColor.WHITE);
break;
}
i.setItemMeta(meta);
}
}
示例11: addItems
import org.bukkit.DyeColor; //导入依赖的package包/类
@Override
public void addItems() {
overlay = true; // We're creating the overlay.
toBottom();
if (playerPage > 1) // Add previous page button.
addItem(Material.EMPTY_MAP, ChatColor.GRAY + "Previous Page",
"Click here to return to the previous page.").anyClick( e -> setPage(playerPage - 1));
fillGlass(DyeColor.GRAY);
if (playerPage < maxPages()) {
// Add "Next Page" Button
skipSlots(-1); // Go back an item.
addItem(Material.EMPTY_MAP, ChatColor.GRAY + "Next Page", "Click here to advance to the next page.")
.anyClick(e -> setPage(playerPage + 1));
}
skipSlots(-8);
addCustomOverlay();
setTitle(this.title + " (" + playerPage + " / " + maxPages() + ")"); // Update the title to show the page.
overlay = false; // We're no longer creating the overlay.
}
示例12: addItems
import org.bukkit.DyeColor; //导入依赖的package包/类
@Override
public void addItems() {
Arrays.stream(Punishments.PunishmentType.values()).forEach(pt ->
addItem(pt.getIcon(), ChatColor.YELLOW + Utils.capitalize(pt.name()),
"Click here to punish this", "player for " + ChatColor.YELLOW + pt.getDisplay() + ChatColor.GRAY + ".").anyClick(e -> {
target.punish(pt, getPlayer());
close();
}));
if (!target.getPunishments().isEmpty()) {
nextRow();
fillGlass(DyeColor.LIME);
target.getPunishments().forEach(p ->
addItem(p.getItem()).anyClick(e ->
Callbacks.promptConfirm(getPlayer(), () -> {
p.setValid(!p.isValid());
getPlayer().sendMessage(ChatColor.GRAY + "Punishment toggled.");
target.writeData();
reconstruct();
}, null)));
}
}
示例13: parseDye
import org.bukkit.DyeColor; //导入依赖的package包/类
public static DyeColor parseDye(String s) {
if (s == null) return DyeColor.BLACK;
try {
return DyeColor.valueOf(s.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e) {
throw new InvalidConfigException("Cannot find dye color: \"" + s + "\"");
}
}
示例14: WoolObjective
import org.bukkit.DyeColor; //导入依赖的package包/类
public WoolObjective(String name, DyeColor color, MatchTeam owner, Region podium) {
this.name = name;
this.color = color.getWoolData();
this.owner = owner;
this.podium = podium;
this.chatColor = ColorConverter.convertDyeColorToChatColor(color);
}
示例15: fillInventoryWithWool
import org.bukkit.DyeColor; //导入依赖的package包/类
private void fillInventoryWithWool(Inventory inventory, DyeColor dyeColor) {
Wool wool = new Wool(dyeColor);
for (int i = 0; i < inventory.getSize(); i++) {
inventory.setItem(i, new ItemStack(wool.getItemType(), 1, (short) 0, wool.getData()));
}
}