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


Java Material.STAINED_GLASS属性代码示例

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


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

示例1: setMaterial

@SuppressWarnings("deprecation")
private void setMaterial(GameStatus gs, Block attachedBlock) {
	String material = SkyWarsReloaded.getCfg().getSignJoinMaterial();
	Material sMat;
	if (material.equalsIgnoreCase("wool")) {
		sMat = Material.WOOL;
	} else if (material.equalsIgnoreCase("clay")) {
		sMat = Material.STAINED_CLAY;
	} else if (material.equalsIgnoreCase("glass")) {
		sMat = Material.STAINED_GLASS;
	} else {
		sMat = null;
	}
	if (sMat != null) {
		if (gs == GameStatus.JOINABLE) {
			attachedBlock.setType(sMat);
			attachedBlock.setData((byte) 5);
		} else if (gs == GameStatus.FULL || gs == GameStatus.INPROGRESS) {
			attachedBlock.setType(sMat);
			attachedBlock.setData((byte) 14);
		} else if (gs == GameStatus.RESTARTING) {
			attachedBlock.setType(sMat);
			attachedBlock.setData((byte) 11);
		}
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:26,代码来源:GameController.java

示例2: getHubItem

@SuppressWarnings("deprecation")
private ItemStack getHubItem(JsonHub hub)
{
    ItemStack glass = new ItemStack(Material.STAINED_GLASS, 1);
    ItemMeta meta = glass.getItemMeta();
    String baseName = "Hub " + hub.getHubNumber() + " (" + hub.getConnectedPlayers() + " joueur" + (hub.getConnectedPlayers() > 1 ? "s" : "") + ")";

    if (hub.getHubNumber() == Integer.parseInt(SamaGamesAPI.get().getServerName().split("_")[1]))
    {
        glass.setDurability(DyeColor.LIGHT_BLUE.getWoolData());
        meta.setDisplayName(ChatColor.AQUA + baseName);
    }
    else if (hub.getConnectedPlayers() <= 40)
    {
        glass.setDurability(DyeColor.GREEN.getWoolData());
        meta.setDisplayName(ChatColor.GREEN + baseName);
    }
    else if (hub.getConnectedPlayers() <= 80)
    {
        glass.setDurability(DyeColor.YELLOW.getWoolData());
        meta.setDisplayName(ChatColor.YELLOW + baseName);
    }
    else if (hub.getConnectedPlayers() < 100)
    {
        glass.setDurability(DyeColor.RED.getWoolData());
        meta.setDisplayName(ChatColor.RED + baseName);
    }
    else
    {
        glass.setDurability(DyeColor.RED.getWoolData());
        meta.setDisplayName(ChatColor.RED + baseName);
    }

    List<String> lore = new ArrayList<>();

    for (String group : hub.getPlayersDetails().keySet())
    {
        int value = hub.getPlayersDetails().get(group);
        String finalGroup = (value <= 1 ? group : group.substring(0, group.length() - 1));

        lore.add(finalGroup.replace("[", "").replace("]", "") + ": " + value);
    }

    lore.add("");
    lore.add(ChatColor.DARK_GRAY + "▶ Cliquez pour être téléporté");

    meta.setLore(lore);
    glass.setItemMeta(meta);

    return glass;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:51,代码来源:GuiSwitchHub.java

示例3: GlassColor

public GlassColor(String color, String name, ItemStack item, int cost) {
      this.item = item;
      this.cost = cost;
      this.color = color;
      this.name = name;
      material = Material.STAINED_GLASS;
      data = 0;
      
      switch (color) {
      case "white": data = (byte) 0;
      break;
      case "orange": data = (byte) 1;
 	break;
      case "magenta": data = (byte) 2;
 	break;
      case "lightblue": data = (byte) 3;
 	break;
      case "yellow": data = (byte) 4;
 	break;
      case "lime": data = (byte) 5;
 	break;
      case "pink": data = (byte) 6;
 	break;
      case "gray": data = (byte) 7;
 	break;
      case "lightgray": data = (byte) 8;
 	break;
      case "cyan": data = (byte) 9;
 	break;
      case "purple": data = (byte) 10;
 	break;
      case "blue": data = (byte) 11;
 	break;
      case "brown": data = (byte) 12;
 	break;
      case "green": data = (byte) 13;
 	break;
      case "red": data = (byte) 14;
 	break;
      case "black": data = (byte) 15;
 	break;
}
  }
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:43,代码来源:GlassColor.java


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