public static ItemStack createPotion(
      PotionType type, int level, boolean splash, boolean extended, int amount) {
    Potion pot = new Potion(type, level);
    pot.setSplash(splash);
    if (extended) pot.setHasExtendedDuration(true);

    return pot.toItemStack(amount);
  }
Esempio n. 2
0
  private ItemStack[] getItemss() {
    Potion pot1 = new Potion(PotionType.INSTANT_DAMAGE, 2);
    pot1.setSplash(true);
    ItemStack itempot1 = pot1.toItemStack(1);

    Potion pot2 = new Potion(PotionType.POISON, 2);
    pot2.setSplash(true);
    ItemStack itempot2 = pot2.toItemStack(1);

    Potion pot3 = new Potion(PotionType.WEAKNESS, 2);
    pot3.setSplash(true);
    pot3.setHasExtendedDuration(true);
    ItemStack itempot3 = pot3.toItemStack(1);

    ItemStack[] is = {itempot1, itempot2, itempot3};
    return is;
  }
  /*
   * Called when a block is damaged.
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockDispense(BlockDispenseEvent event) {
    ConfigurationManager cfg = plugin.getGlobalStateManager();
    WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());

    if (wcfg.blockPotions.size() > 0) {
      ItemStack item = event.getItem();
      if (item.getType() == Material.POTION && !BukkitUtil.isWaterPotion(item)) {
        Potion potion = Potion.fromDamage(BukkitUtil.getPotionEffectBits(item));
        for (PotionEffect effect : potion.getEffects()) {
          if (potion.isSplash() && wcfg.blockPotions.contains(effect.getType())) {
            event.setCancelled(true);
            return;
          }
        }
      }
    }
  }
Esempio n. 4
0
 @Deprecated
 public static Potion fromDamage(int damage) {
   PotionType type = PotionType.getByDamageValue(damage & 0xF);
   Potion potion;
   Potion potion;
   if ((type == null) || (type == PotionType.WATER)) {
     potion = new Potion(damage & 0x3F);
   } else {
     int level = (damage & 0x20) >> 5;
     level++;
     potion = new Potion(type, level);
   }
   if ((damage & 0x4000) > 0) {
     potion = potion.splash();
   }
   if (((!type.equals(PotionType.INSTANT_DAMAGE)) || (type.equals(PotionType.FIRE_RESISTANCE)))
       && ((damage & 0x40) > 0)) {
     potion = potion.extend();
   }
   return potion;
 }
  @EventHandler
  public static void addPotionInfo(ItemInfoEvent event) {
    ItemStack item = event.getItem();

    if (item.getType() != Material.POTION || item.getDurability() == 0) {
      return;
    }

    Potion potion = Potion.fromItemStack(item);

    StringBuilder message = new StringBuilder(50);

    message.append(ChatColor.GRAY);

    if (potion.getType() == null) {
      return;
    }

    if (potion.isSplash()) {
      message.append("Splash ");
    }

    message.append("Potion of ");
    message.append(capitalizeFirstLetter(potion.getType().name(), '_')).append(' ');
    message.append(toRoman(potion.getLevel()));

    CommandSender sender = event.getSender();

    sender.sendMessage(message.toString());

    for (PotionEffect effect : potion.getEffects()) {
      sender.sendMessage(
          ChatColor.DARK_GRAY
              + capitalizeFirstLetter(effect.getType().getName(), '_')
              + ' '
              + toTime(effect.getDuration() / 20));
    }
  }
Esempio n. 6
0
  public void OmplirCofre(Block blk) {
    Chest chest = (Chest) blk.getState();
    Inventory inv = chest.getInventory();
    inv.clear();
    // inv.clear();
    int maxN = Utils.NombreEntre(4, 9);
    int n = 0;

    while (n < maxN) {
      if (Utils.Possibilitat(4)) {
        inv.addItem(new ItemStack(Material.DIAMOND, 1));
      }
      if (Utils.Possibilitat(8)) {
        inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 1));
      }
      if (Utils.Possibilitat(2)) {
        inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 1, (short) 1));
      }
      if (Utils.Possibilitat(12)) {
        inv.addItem(new ItemStack(Material.IRON_INGOT, 1));
      }
      if (Utils.Possibilitat(5)) {
        inv.addItem(new ItemStack(Material.GOLD_INGOT, 1));
      }
      if (Utils.Possibilitat(3)) {
        inv.addItem(new ItemStack(Material.ENDER_PEARL, 1));
      }
      if (Utils.Possibilitat(4)) {
        Material hoe = Material.WOOD_HOE;
        if (Utils.Possibilitat(35)) {
          hoe = Material.GOLD_HOE;
        }
        if (Utils.Possibilitat(15)) {
          hoe = Material.STONE_HOE;
        }
        if (Utils.Possibilitat(10)) {
          hoe = Material.IRON_HOE;
        }
        if (Utils.Possibilitat(8)) {
          hoe = Material.DIAMOND_HOE;
        }

        inv.addItem(
            Utils.setItemNameAndLore(
                new ItemStack(hoe, 1),
                getBridgeToolName(),
                "Col·loca automàticament els blocs formant un passadís"));
      }
      //			if(Utils.Possibilitat(2)){
      //				inv.addItem(new ItemStack(Material.TNT, 1));
      //			}
      if (Utils.Possibilitat(3)) {
        ItemStack item = new ItemStack(Material.GOLD_LEGGINGS, 1);
        item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Utils.NombreEntre(1, 5));
        inv.addItem(item);
      }
      if (Utils.Possibilitat(3)) {
        ItemStack item = new ItemStack(Material.GOLD_CHESTPLATE, 1);
        item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Utils.NombreEntre(1, 5));
        item.addUnsafeEnchantment(Enchantment.THORNS, Utils.NombreEntre(1, 3));
        inv.addItem(item);
      }
      if (Utils.Possibilitat(3)) {
        ItemStack item = new ItemStack(Material.GOLD_BOOTS, 1);
        item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Utils.NombreEntre(1, 5));
        item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, Utils.NombreEntre(1, 8));
        inv.addItem(item);
      }
      if (Utils.Possibilitat(3)) {
        ItemStack item = new ItemStack(Material.IRON_HELMET, 1);
        item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Utils.NombreEntre(1, 7));
        inv.addItem(item);
      }
      // Pocions
      if (Utils.Possibilitat(5)) {
        ItemStack item = new ItemStack(Material.POTION, Utils.NombreEntre(1, 4));
        Potion pot =
            new Potion(
                1); // The constructor calls for an (int name), but I'm not sure what that is... I
                    // tried 1 and it works fine.
        pot.setType(PotionType.INSTANT_HEAL);
        pot.setLevel(Utils.NombreEntre(1, 2));
        pot.setSplash(true);
        pot.apply(item);
        inv.addItem(item);
      }
      if (Utils.Possibilitat(4)) {
        ItemStack item = new ItemStack(Material.POTION, 1);
        Potion pot =
            new Potion(
                1); // The constructor calls for an (int name), but I'm not sure what that is... I
                    // tried 1 and it works fine.
        pot.setType(PotionType.POISON);
        pot.setLevel(Utils.NombreEntre(1, 2));
        pot.setSplash(true);
        pot.apply(item);
        inv.addItem(item);
      }
      if (Utils.Possibilitat(3)) {
        ItemStack item = new ItemStack(Material.POTION, 1);
        Potion pot =
            new Potion(
                1); // The constructor calls for an (int name), but I'm not sure what that is... I
                    // tried 1 and it works fine.
        pot.setType(PotionType.INSTANT_DAMAGE);
        pot.setLevel(2);
        pot.setSplash(true);
        pot.apply(item);
        inv.addItem(item);
      }
      if (Utils.Possibilitat(3)) {
        ItemStack item = new ItemStack(Material.POTION, 1);
        Potion pot =
            new Potion(
                1); // The constructor calls for an (int name), but I'm not sure what that is... I
                    // tried 1 and it works fine.
        pot.setType(PotionType.STRENGTH);
        pot.setLevel(Utils.NombreEntre(1, 2));
        pot.setSplash(true);
        pot.apply(item);
        inv.addItem(item);
      }
      n = 0;
      for (ItemStack i : inv.getContents()) {
        if (i != null) {
          n++;
        }
      }
    }
  }
Esempio n. 7
0
  /**
   * Sends a display of item information to the specified command sender
   *
   * @param item the item to display, cannot be null
   * @param sender the command sender to send the display to, cannot be null
   */
  public static void showInformation(ItemStack item, CommandSender sender) {
    if (item == null || sender == null) throw new IllegalArgumentException();

    StringBuilder builder = new StringBuilder();
    builder.append(ChatColor.BOLD).append(getName(item)).append(" ");
    if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) {
      builder.append(ChatColor.ITALIC).append("(").append(getName(item, true)).append(") ");
    }
    builder.append(ChatColor.BLUE).append("x").append(item.getAmount());
    DumbAuction.getInstance().sendMessage(sender, ChatColor.AQUA + builder.toString().trim());

    // Display durability
    if (item.getType().getMaxDurability() > 0 && item.getDurability() != 0) {
      double durability =
          1 - ((double) item.getDurability() / (double) item.getType().getMaxDurability());
      int percent = (int) Math.round(durability * 100);
      DumbAuction.getInstance()
          .sendMessage(
              sender, ChatColor.GRAY + "Durability: " + ChatColor.AQUA + "" + percent + "%");
    }

    Potion pot = null;
    try {
      pot = Potion.fromItemStack(item);
    } catch (Exception e) {
    } // Consume error
    List<String> metaMessage = new ArrayList<String>();
    if (item.hasItemMeta() || pot != null) {
      ItemMeta meta = item.getItemMeta();
      if (meta.hasLore()) {
        List<String> lore = meta.getLore();
        metaMessage.add(ChatColor.LIGHT_PURPLE + "Lore: ");
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
        for (String l : lore) {
          metaMessage.add(ChatColor.GRAY + l);
        }
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
      }
      if (meta.hasEnchants() || meta instanceof EnchantmentStorageMeta) {
        metaMessage.add(ChatColor.LIGHT_PURPLE + "Enchants: ");
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
        if (meta.hasEnchants()) {
          Map<Enchantment, Integer> enchants = meta.getEnchants();
          for (Enchantment e : enchants.keySet()) {
            int level = enchants.get(e);
            String strLevel =
                integerToRomanNumeral(level) + " " + ChatColor.GRAY + "(" + level + ")";
            metaMessage.add(ChatColor.AQUA + getEnchantmentName(e) + " " + strLevel);
          }
        }
        if (meta instanceof EnchantmentStorageMeta) {
          EnchantmentStorageMeta emeta = (EnchantmentStorageMeta) meta;
          if (emeta.hasStoredEnchants()) {
            Map<Enchantment, Integer> enchants = emeta.getStoredEnchants();
            for (Enchantment e : enchants.keySet()) {
              int level = enchants.get(e);
              String strLevel =
                  integerToRomanNumeral(level) + " " + ChatColor.GRAY + "(" + level + ")";
              metaMessage.add(ChatColor.AQUA + getEnchantmentName(e) + " " + strLevel);
            }
          }
        }
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
      }
      if (meta instanceof BookMeta) {
        BookMeta book = (BookMeta) meta;
        if (book.hasTitle())
          metaMessage.add(ChatColor.GRAY + "Book Title: " + ChatColor.AQUA + book.getTitle());
        if (book.hasAuthor())
          metaMessage.add(ChatColor.GRAY + "Book Author: " + ChatColor.AQUA + book.getAuthor());
      }
      List<FireworkEffect> effects = new ArrayList<FireworkEffect>();
      int fireworkPower = -1;
      if (meta instanceof FireworkEffectMeta) {
        FireworkEffectMeta firework = (FireworkEffectMeta) meta;
        if (firework.hasEffect()) {
          effects.add(firework.getEffect());
        }
      }
      if (meta instanceof FireworkMeta) {
        FireworkMeta firework = (FireworkMeta) meta;
        if (firework.hasEffects()) {
          effects.addAll(firework.getEffects());
        }
        fireworkPower = firework.getPower();
      }
      if (effects.size() > 0) {
        metaMessage.add(ChatColor.LIGHT_PURPLE + "Firework Effects: ");
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
        for (FireworkEffect effect : effects) {
          metaMessage.add(ChatColor.AQUA + getFireworkTypeName(effect.getType()));
          if (effect.getColors().size() > 0) {
            builder = new StringBuilder();
            for (Color color : effect.getColors()) {
              ChatColor chat =
                  ChatColorPalette.matchColor(color.getRed(), color.getGreen(), color.getBlue());
              String name = getChatName(chat);
              builder.append(chat).append(name).append(ChatColor.GRAY).append(", ");
            }
            metaMessage.add(
                ChatColor.GRAY
                    + "    Colors: "
                    + builder.toString().substring(0, builder.toString().length() - 2));
          }
          if (effect.getFadeColors().size() > 0) {
            builder = new StringBuilder();
            for (Color color : effect.getFadeColors()) {
              ChatColor chat =
                  ChatColorPalette.matchColor(color.getRed(), color.getGreen(), color.getBlue());
              String name = getChatName(chat);
              builder.append(chat).append(name).append(ChatColor.GRAY).append(", ");
            }
            metaMessage.add(
                ChatColor.GRAY
                    + "    Fade Colors: "
                    + builder.toString().substring(0, builder.toString().length() - 2));
          }
        }
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
      }
      if (fireworkPower >= 0) {
        metaMessage.add(ChatColor.GRAY + "Firework Power: " + ChatColor.AQUA + "" + fireworkPower);
      }
      if (meta instanceof LeatherArmorMeta) {
        LeatherArmorMeta leather = (LeatherArmorMeta) meta;
        if (!leather
            .getColor()
            .equals(
                DumbAuction.getInstance().getServer().getItemFactory().getDefaultLeatherColor())) {
          ChatColor chat =
              ChatColorPalette.matchColor(
                  leather.getColor().getRed(),
                  leather.getColor().getGreen(),
                  leather.getColor().getBlue());
          metaMessage.add(ChatColor.GRAY + "Leather Color: " + chat + getChatName(chat));
        }
      }
      if (meta instanceof SkullMeta) {
        SkullMeta skull = (SkullMeta) meta;
        if (skull.hasOwner()) {
          metaMessage.add(ChatColor.GRAY + "Skull Player: " + ChatColor.AQUA + skull.getOwner());
        }
      }
      if (meta instanceof PotionMeta || pot != null) {
        metaMessage.add(ChatColor.LIGHT_PURPLE + "Potion Effects: ");
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
        if (pot != null) {
          for (PotionEffect effect : pot.getEffects()) {
            int amplifier = effect.getAmplifier() + 1;
            int time = effect.getDuration() / 20;
            metaMessage.add(
                ChatColor.AQUA
                    + getPotionEffectName(effect.getType())
                    + " "
                    + integerToRomanNumeral(amplifier)
                    + " "
                    + ChatColor.GRAY
                    + "("
                    + amplifier
                    + ") for "
                    + ChatColor.AQUA
                    + toTime(time));
          }
        }
        if (meta instanceof PotionMeta) {
          PotionMeta potion = (PotionMeta) meta;
          if (potion.hasCustomEffects()) {
            for (PotionEffect effect : potion.getCustomEffects()) {
              int amplifier = effect.getAmplifier() + 1;
              int time = effect.getDuration() / 20;
              metaMessage.add(
                  ChatColor.AQUA
                      + getPotionEffectName(effect.getType())
                      + " "
                      + integerToRomanNumeral(amplifier)
                      + " "
                      + ChatColor.GRAY
                      + "("
                      + amplifier
                      + ") for "
                      + ChatColor.AQUA
                      + toTime(time));
            }
          }
        }
        metaMessage.add(ChatColor.DARK_GRAY + "-------------");
      }
      // Note: MapMeta is useless and not used
    }

    for (String s : metaMessage) {
      DumbAuction.getInstance().sendMessage(sender, s);
    }
  }
Esempio n. 8
0
  @EventHandler
  public void invclick(InventoryClickEvent e) {
    final Player p = (Player) e.getWhoClicked();
    if (e.getInventory().getName().equalsIgnoreCase(ChatColor.BLUE + "Kits")) {
      Long time = System.currentTimeMillis();
      e.setCancelled(true);
      if (e.getCurrentItem().getType() == Material.WOOD) {

        if (Inventoryy.start.containsKey(p.getName())) {
          Long lu = Inventoryy.start.get(p.getName());
          if (lu + 1800000 > time) {
            p.sendMessage(prefix + ChatColor.GREEN + "Du musst noch warten!");
            return;
          }
        }
        p.sendMessage(prefix + ChatColor.GREEN + "Du hast das Starterkit erhalten!");
        p.getInventory().addItem(new ItemStack(Material.CHAINMAIL_BOOTS));
        p.getInventory().addItem(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
        p.getInventory().addItem(new ItemStack(Material.CHAINMAIL_LEGGINGS));
        p.getInventory().addItem(new ItemStack(Material.CHAINMAIL_HELMET));
        p.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
        p.getInventory().addItem(new ItemStack(Material.STONE_AXE));
        p.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
        p.getInventory().addItem(new ItemStack(Material.STONE_HOE));
        p.getInventory().addItem(new ItemStack(Material.APPLE, 32));
        Inventoryy.start.put(p.getName(), time);
      } else if (e.getCurrentItem().getType() == Material.IRON_SWORD) {
        if (Inventoryy.fight.containsKey(p.getName())) {
          Long lu = Inventoryy.fight.get(p.getName());
          if (lu + 1800000 > time) {
            p.sendMessage(prefix + ChatColor.GREEN + "Du musst noch warten!");
            return;
          }
        }
        p.sendMessage(prefix + ChatColor.GREEN + "Du hast das Fight Kit erhalten!");
        p.sendMessage(
            prefix + ChatColor.GREEN + "Warte 30 Minuten, um dieses Kit wieder zu holen!");

        ItemStack schwert = new ItemStack(Material.IRON_SWORD);
        ItemMeta metaschwert = schwert.getItemMeta();
        metaschwert.addEnchant(Enchantment.DAMAGE_ALL, 2, true);
        metaschwert.setDisplayName(ChatColor.GREEN + "Fight Schwert");
        schwert.setItemMeta(metaschwert);
        p.getInventory().addItem(schwert);

        ItemStack helm = new ItemStack(Material.IRON_HELMET);
        ItemMeta metahelm = helm.getItemMeta();
        metahelm.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 2, true);
        metahelm.setDisplayName(ChatColor.GREEN + "Fight Helm");
        helm.setItemMeta(metahelm);
        p.getInventory().addItem(helm);

        ItemStack brustplatte = new ItemStack(Material.IRON_CHESTPLATE);
        ItemMeta metabrustplatte = brustplatte.getItemMeta();
        metabrustplatte.addEnchant(Enchantment.PROTECTION_PROJECTILE, 3, true);
        metabrustplatte.setDisplayName(ChatColor.GREEN + "Fight Brustplatte");
        brustplatte.setItemMeta(metabrustplatte);
        p.getInventory().addItem(brustplatte);

        ItemStack hose = new ItemStack(Material.IRON_LEGGINGS);
        ItemMeta metahose = hose.getItemMeta();
        metahose.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 2, true);
        metahose.setDisplayName(ChatColor.GREEN + "Fight Hose");
        hose.setItemMeta(metahose);
        p.getInventory().addItem(hose);

        ItemStack schuhe = new ItemStack(Material.IRON_BOOTS);
        ItemMeta metaschuhe = schuhe.getItemMeta();
        metaschuhe.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
        metaschuhe.setDisplayName(ChatColor.GREEN + "Fight Schuhe");
        schuhe.setItemMeta(metaschuhe);
        p.getInventory().addItem(schuhe);

        ItemStack heal = new ItemStack(Material.POTION, 5);
        Potion healpot = new Potion(PotionType.INSTANT_HEAL, 2, true);
        healpot.apply(heal);
        p.getInventory().addItem(heal);

        ItemStack starke = new ItemStack(Material.POTION, 3);
        Potion starkepot = new Potion(PotionType.STRENGTH, 1, true);
        starkepot.apply(starke);
        p.getInventory().addItem(starke);

        ItemStack feuer = new ItemStack(Material.POTION, 1);
        Potion feuerpot = new Potion(PotionType.FIRE_RESISTANCE, 1, true);
        feuerpot.apply(feuer);
        p.getInventory().addItem(feuer);

        Inventoryy.fight.put(p.getName(), time);

      } else if (e.getCurrentItem().getType() == Material.IRON_PICKAXE) {
        if (Inventoryy.bau.containsKey(p.getName())) {
          Long lu = Inventoryy.bau.get(p.getName());
          if (lu + 1800000 > time) {
            p.sendMessage(prefix + ChatColor.GREEN + "Du musst noch warten!");
            return;
          }
        }
        ItemStack schaufel = new ItemStack(Material.IRON_SPADE);
        ItemMeta metaschaufel = schaufel.getItemMeta();
        metaschaufel.addEnchant(Enchantment.DIG_SPEED, 2, true);
        metaschaufel.setDisplayName(ChatColor.GREEN + "Bau Schaufel");
        schaufel.setItemMeta(metaschaufel);
        p.getInventory().addItem(schaufel);

        ItemStack hacke = new ItemStack(Material.IRON_PICKAXE);
        ItemMeta metahacke = hacke.getItemMeta();
        metahacke.addEnchant(Enchantment.DIG_SPEED, 2, true);
        metaschaufel.setDisplayName(ChatColor.GREEN + "Bau Spitzhacke");
        hacke.setItemMeta(metahacke);
        p.getInventory().addItem(hacke);

        ItemStack axt = new ItemStack(Material.IRON_AXE);
        ItemMeta metaaxt = axt.getItemMeta();
        metaaxt.addEnchant(Enchantment.DIG_SPEED, 2, true);
        metaschaufel.setDisplayName(ChatColor.GREEN + "Bau Axt");
        axt.setItemMeta(metaaxt);
        p.getInventory().addItem(axt);

        p.sendMessage(prefix + ChatColor.GREEN + "Du hast das Bau Kit erhalten!");
        p.sendMessage(
            prefix + ChatColor.GREEN + "Warte 30 Minuten, um dieses Kit wieder zu holen!");

      } else if (e.getCurrentItem().getType() == Material.EXP_BOTTLE) {
        if (p.hasPermission("karotte.premium")) {
          if (Inventoryy.xp.containsKey(p.getName())) {
            Long lu = Inventoryy.xp.get(p.getName());
            if (lu + 43200000 > time) {
              p.sendMessage(prefix + ChatColor.GREEN + "Du musst noch warten!");
              return;
            }
          }
          int i = 0;
          while (i != 5) {
            ItemStack xp = new ItemStack(Material.EXP_BOTTLE, 64);
            ItemMeta metaxp = xp.getItemMeta();
            metaxp.setDisplayName(ChatColor.GREEN + "XP-Fl�schchen");
            xp.setItemMeta(metaxp);
            p.getInventory().addItem(xp);

            i++;
          }
          Inventoryy.xp.put(p.getName(), time);

        } else {
          p.sendMessage(
              prefix
                  + ChatColor.DARK_RED
                  + "Kaufe dir den Premium Rang, um dieses Feature freizuschalten.");
        }
      } else if (e.getCurrentItem().getType() == Material.OBSIDIAN) {
        if (p.hasPermission("karotte.titan")) {
          if (Inventoryy.titan.containsKey(p.getName())) {
            Long lu = Inventoryy.titan.get(p.getName());
            if (lu + 43200000 > time) {
              p.sendMessage(prefix + ChatColor.GREEN + "Du musst noch warten!");
              return;
            }
          }
          p.sendMessage(prefix + ChatColor.GREEN + "Du hast das Titan Kit erhalten!");
          p.sendMessage(
              prefix + ChatColor.GREEN + "Warte 12 Stunden, um dieses Kit wieder zu holen!");
          p.getInventory().addItem(new ItemStack(Material.DIAMOND_BOOTS));
          p.getInventory().addItem(new ItemStack(Material.DIAMOND_CHESTPLATE));
          p.getInventory().addItem(new ItemStack(Material.DIAMOND_LEGGINGS));
          p.getInventory().addItem(new ItemStack(Material.DIAMOND_HELMET));

          ItemStack titan = new ItemStack(Material.DIAMOND_SWORD);
          ItemMeta metatitan = titan.getItemMeta();
          metatitan.addEnchant(Enchantment.FIRE_ASPECT, 1, true);
          metatitan.setDisplayName(ChatColor.AQUA + "Titan Schwert");
          titan.setItemMeta(metatitan);
          p.getInventory().addItem(titan);
          Inventoryy.titan.put(p.getName(), time);
        } else {
          p.sendMessage(
              prefix
                  + ChatColor.DARK_RED
                  + "Kaufe dir den Titan Rang, um dieses Feature freizuschalten.");
        }
      } else if (e.getCurrentItem().getType() == Material.IRON_DOOR) {
        p.closeInventory();
      }
    } else if (e.getInventory().getName().equalsIgnoreCase(ChatColor.RED + "Spiele")
        || e.getInventory()
            .getName()
            .equalsIgnoreCase(
                ChatColor.DARK_GRAY
                    + "Stein "
                    + ChatColor.DARK_PURPLE
                    + "Schere "
                    + ChatColor.WHITE
                    + "Papier")
        || e.getInventory().getName().equalsIgnoreCase(ChatColor.AQUA + "Spieler gefunden! =D")
        || e.getInventory().getName().equalsIgnoreCase(ChatColor.DARK_GREEN + "InGame")
        || e.getInventory().getName().equalsIgnoreCase(ChatColor.GOLD + "Smartphone OS 1.0")) {

      e.setCancelled(true);

      if (e.getCurrentItem().getType() == Material.SHEARS
          && e.getCurrentItem()
              .getItemMeta()
              .getDisplayName()
              .equalsIgnoreCase(
                  ChatColor.DARK_GRAY
                      + "Stein "
                      + ChatColor.DARK_PURPLE
                      + "Schere "
                      + ChatColor.WHITE
                      + "Papier")) {

        wartessp.add(p);
        Games.wartemenu(p);

        p.closeInventory();
      } else if (e.getCurrentItem().getType() == Material.IRON_DOOR) {
        p.closeInventory();
        if (wartessp.contains(p)) {
          wartessp.remove(p);
        }
      } else if (e.getCurrentItem().getType() == Material.NETHER_STAR) {

      }
    }
  }