@Override public String toString() { return getColor() + " " + super.toString(); }
@Override public Wool read(Material material, BlockStateData data) throws InvalidBlockStateException { Wool wool = new Wool(); if (data.contains("color")) { DyeColor color = StateSerialization.getColor(data.get("color")); if (color == null) { throw new InvalidBlockStateException(material, data); } wool.setColor(color); } else { wool.setColor(DyeColor.WHITE); } return wool; }
/** * Gets the current color of this dye * * @return DyeColor of this dye */ public DyeColor getColor() { return DyeColor.getByWoolData(getData()); }
@Override public boolean matches(BlockStateData state, Wool data) throws InvalidBlockStateException { if (state.contains("color")) { DyeColor color = StateSerialization.getColor(state.get("color")); if (color == null) { throw new InvalidBlockStateException(data.getItemType(), state); } return data.getColor() == color; } return true; } }
public Wool(DyeColor color) { this(); setColor(color); }
continue; Wool wool = new Wool(team.getColor().getDyeColor()); ItemStack is = wool.toItemStack(1); ItemMeta im = is.getItemMeta();
/** * Sets the color of this dye * * @param color New color of this dye */ public void setColor(DyeColor color) { setData(color.getWoolData()); }
public Wool(DyeColor color) { this(); setColor(color); }
continue; Wool wool = new Wool(team.getColor().getDyeColor()); ItemStack is = wool.toItemStack(1); ItemMeta im = is.getItemMeta();
/** * Sets the color of this dye * * @param color New color of this dye */ public void setColor(DyeColor color) { setData(color.getWoolData()); }
@Override public String toString() { return getColor() + " " + super.toString(); }
if (color == null) return def; wdat.setColor(color); } else if (dat instanceof Tree) { Tree tdat = (Tree) dat;
/** * Gets the current color of this dye * * @return DyeColor of this dye */ public DyeColor getColor() { return DyeColor.getByWoolData(getData()); }
DGroup dGroup = getDGroupByButton(button); DGroup pGroup = DGroup.getByPlayer(player); DColor color = DColor.getByDyeColor(((Wool) button.getData()).getColor());
private void onLobbyInventoryClick(InventoryClickEvent ice, Player player, Game game) { Inventory inv = ice.getInventory(); ItemStack clickedStack = ice.getCurrentItem(); if (!inv.getTitle().equals(BedwarsRel._l(player, "lobby.chooseteam"))) { ice.setCancelled(true); return; } if (clickedStack == null) { ice.setCancelled(true); return; } if (clickedStack.getType() != Material.WOOL) { ice.setCancelled(true); return; } ice.setCancelled(true); Wool wool = (Wool) clickedStack.getData(); Team team = game.getTeamByDyeColor(wool.getColor()); if (team == null) { return; } game.playerJoinTeam(player, team); player.closeInventory(); }
private void onLobbyInventoryClick(InventoryClickEvent ice, Player player, Game game) { Inventory inv = ice.getInventory(); ItemStack clickedStack = ice.getCurrentItem(); if (!inv.getTitle().equals(BedwarsRel._l(player, "lobby.chooseteam"))) { ice.setCancelled(true); return; } if (clickedStack == null) { ice.setCancelled(true); return; } if (clickedStack.getType() != Material.WOOL) { ice.setCancelled(true); return; } ice.setCancelled(true); Wool wool = (Wool) clickedStack.getData(); Team team = game.getTeamByDyeColor(wool.getColor()); if (team == null) { return; } game.playerJoinTeam(player, team); player.closeInventory(); }