當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。