Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Inventory create9LevelInv(final int min_lvl, final int has_lvl, final int xp){
- // min_lvl: das niedrigste level, das angezeigt werden soll
- // has_lvl: aktuelles level
- // xp: aktuelle xp
- final int max_lvl = min_lvl + 8;
- Inventory inv = Bukkit.createInventory(null, 45,"§1Levelübersicht§g");
- ItemStack has_item = new ItemStack(Material.LIME_STAINED_GLASS_PANE);
- ItemStack is_item = new ItemStack(Material.YELLOW_STAINED_GLASS_PANE);
- ItemStack not_item = new ItemStack(Material.RED_STAINED_GLASS_PANE);
- List<String> has_lore = new ArrayList<>();
- has_lore.add("§r");
- has_lore.add("§7Du hast dieses Level bereits erreicht.");
- has_lore.add("§r");
- has_lore.add("§7Fortschritt: §a::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::");
- List<String> not_lore = new ArrayList<>();
- not_lore.add("§r");
- not_lore.add("§7Du hast dieses Level §cnoch nicht§7 erreicht.");
- not_lore.add("§r");
- not_lore.add("§7Fortschritt: §c::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::");
- List<String> is_lore = new ArrayList<>();
- is_lore.add("§r");
- is_lore.add("§7Du hast dieses Level §cnoch nicht§7 erreicht.");
- is_lore.add("§r");
- ItemStack creds = new ItemStack(CreditManager.creditMaterial);
- ItemStack coins = new ItemStack(CoinManager.coinMaterial);
- ItemStack noth = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
- ItemStack five = new ItemStack(Material.LIGHT_GRAY_STAINED_GLASS_PANE);
- ItemStack ten = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
- ItemMeta empt = noth.getItemMeta();
- empt.setDisplayName("§r");
- noth.setItemMeta(empt);
- five.setItemMeta(empt);
- ten.setItemMeta(empt);
- for (int lvl = min_lvl; lvl <= max_lvl ; lvl++){
- if (lvl <= has_lvl){
- ItemMeta meta = has_item.getItemMeta();
- meta.setDisplayName("§aLevel §l§a§s" + lvl);
- meta.setLore(has_lore);
- has_item.setItemMeta(meta);
- // 2. Reihe = lvl - min_lvl + 9
- inv.setItem(lvl-min_lvl+9, has_item);
- }else if ((has_lvl + 1) == lvl){
- ItemMeta meta = is_item.getItemMeta();
- meta.setDisplayName("§eLevel §l§e§s" + lvl);
- String fort = "§7Fortschritt: §a";
- int prog = (int) ((float) xp / getXPNeededForLevel(has_lvl) *60);
- for (int i = 1 ; i <= 60; i++){
- if (prog >= i){
- fort += ":";
- }else{
- fort += "§c:";
- }
- }
- is_lore.add(fort);
- meta.setLore(is_lore);
- is_item.setItemMeta(meta);
- inv.setItem(lvl-min_lvl+9,is_item);
- }else{
- ItemMeta meta = not_item.getItemMeta();
- meta.setDisplayName("§4Level §l§4§s" + lvl);
- meta.setLore(not_lore);
- not_item.setItemMeta(meta);
- // 2. Reihe = lvl - min_lvl + 9
- inv.setItem(lvl-min_lvl+9, not_item);
- }
- if (lvl != 0){
- if (lvl % 10 == 0){
- int z = lvl / 10;
- int cre = z *10;
- ItemMeta meta = creds.getItemMeta();
- meta.setDisplayName(CreditManager.creditColorCode + cre + " Credits");
- if (lvl <= has_lvl){
- meta.setLore(has_lore);
- }else if ((has_lvl+1) == lvl){
- meta.setLore(is_lore);
- }else {
- meta.setLore(not_lore);
- }
- creds.setItemMeta(meta);
- inv.setItem(lvl-min_lvl,ten);
- inv.setItem(lvl-min_lvl+18,creds);
- inv.setItem(lvl-min_lvl+27,ten);
- }else if (lvl % 5 == 0){
- // TODO: Lootkisten impl
- inv.setItem(lvl-min_lvl,five);
- //lootkiste
- inv.setItem(lvl-min_lvl+27,five);
- }else{
- final int basis = 7; // TODO: Feintuning
- int coi = basis * lvl;
- ItemMeta meta = coins.getItemMeta();
- meta.setDisplayName(CoinManager.coinColorCode + coi + " Coins");
- if (lvl <= has_lvl){
- meta.setLore(has_lore);
- }else if ((has_lvl+1) == lvl){
- meta.setLore(is_lore);
- }else {
- meta.setLore(not_lore);
- }
- coins.setItemMeta(meta);
- inv.setItem(lvl-min_lvl,noth);
- inv.setItem(lvl-min_lvl+18,coins);
- inv.setItem(lvl-min_lvl+27,noth);
- }
- }else{
- ItemStack no = new ItemStack(Material.BARRIER);
- ItemMeta nmeta = no.getItemMeta();
- nmeta.setDisplayName("§4Keine Belohnung für diese Stufe");
- nmeta.setLore(has_lore);
- no.setItemMeta(nmeta);
- inv.setItem(lvl-min_lvl+18,no);
- }
- }
- ItemStack prev = new ItemStack(Material.LIME_WOOL);
- ItemMeta prev_meta = prev.getItemMeta();
- prev_meta.setDisplayName("§a←");
- prev.setItemMeta(prev_meta);
- ItemStack next = new ItemStack(Material.RED_WOOL);
- ItemMeta next_meta = prev.getItemMeta();
- next_meta.setDisplayName("§4→");
- next.setItemMeta(next_meta);
- ItemStack n = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
- n.setItemMeta(empt);
- if (min_lvl > 0){
- for (int i = 36 ; i <= 39 ; i++){
- inv.setItem(i, prev);
- }
- }else{
- for (int i = 36 ; i <= 40 ; i++){
- inv.setItem(i, n);
- }
- }
- for (int i = 41 ; i <= 44 ; i++){
- inv.setItem(i, next);
- }
- return inv;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement