Esempio n. 1
0
 public static void openClothingMenu(Player player) {
   Inventory clothing = Bukkit.createInventory(null, 45, Colorizer.string("&lClothing Shop"));
   clothing.setItem(
       3,
       Methods.createCustomItem(
           Material.IRON_PLATE, 0, Colorizer.string("&a&lClothing Shop"), null, true));
   clothing.setItem(
       4,
       Methods.createCustomItem(
           Material.GOLD_PLATE,
           0,
           Colorizer.string("&a&l" + Bits.getBits(player) + " Bits"),
           null,
           true));
   clothing.setItem(
       5,
       Methods.createCustomItem(
           Material.IRON_PLATE, 0, Colorizer.string("&a&lClothing Shop"), null, true));
   clothing.setItem(
       10,
       Methods.createCustomItem(
           Material.DIAMOND_HELMET, 0, Colorizer.string("&aHead"), null, false));
   clothing.setItem(
       12,
       Methods.createCustomItem(
           Material.DIAMOND_CHESTPLATE, 0, Colorizer.string("&aChest"), null, false));
   clothing.setItem(
       14,
       Methods.createCustomItem(
           Material.DIAMOND_LEGGINGS, 0, Colorizer.string("&aLegs"), null, false));
   clothing.setItem(
       16,
       Methods.createCustomItem(
           Material.DIAMOND_BOOTS, 0, Colorizer.string("&aFeet"), null, false));
   List<String> raveLore =
       Colorizer.lore(
           null,
           "&fWear the rainbow!",
           null,
           "&aRight-Click To Purchase",
           "&fPrice: &e" + ravePrice + " Bits");
   List<String> spaceLore =
       Colorizer.lore(
           null,
           "&fExperience Apollo 13...",
           null,
           "&aRight-Click To Purchase",
           "&fPrice: &e" + spacePrice + " Bits");
   if (!Clothing.hasRaveHat(player))
     clothing.setItem(
         19,
         Methods.createCustomItem(
             Material.LEATHER_HELMET, 0, Colorizer.string("&a&lRave Hat"), raveLore, false));
   else
     clothing.setItem(
         19,
         Methods.createCustomItem(
             Material.INK_SACK, 8, Colorizer.string("&c&lRave Hat"), NPCMechanics.hasIt, false));
   if (!Clothing.hasRaveShirt(player))
     clothing.setItem(
         21,
         Methods.createCustomItem(
             Material.LEATHER_CHESTPLATE, 0, Colorizer.string("&a&lRave Shirt"), raveLore, false));
   else
     clothing.setItem(
         21,
         Methods.createCustomItem(
             Material.INK_SACK, 8, Colorizer.string("&c&lRave Shirt"), NPCMechanics.hasIt, false));
   if (!Clothing.hasRavePants(player))
     clothing.setItem(
         23,
         Methods.createCustomItem(
             Material.LEATHER_LEGGINGS, 0, Colorizer.string("&a&lRave Pants"), raveLore, false));
   else
     clothing.setItem(
         23,
         Methods.createCustomItem(
             Material.INK_SACK, 8, Colorizer.string("&c&lRave Pants"), NPCMechanics.hasIt, false));
   if (!Clothing.hasRaveShoes(player))
     clothing.setItem(
         25,
         Methods.createCustomItem(
             Material.LEATHER_BOOTS, 0, Colorizer.string("&a&lRave Shoes"), raveLore, false));
   else
     clothing.setItem(
         25,
         Methods.createCustomItem(
             Material.INK_SACK, 8, Colorizer.string("&c&lRave Shoes"), NPCMechanics.hasIt, false));
   if (!Clothing.hasSpaceHelmet(player))
     clothing.setItem(
         28,
         Methods.createCustomItem(
             Material.GLASS, 0, Colorizer.string("&a&lSpace Helmet"), spaceLore, false));
   else
     clothing.setItem(
         28,
         Methods.createCustomItem(
             Material.INK_SACK,
             8,
             Colorizer.string("&c&lSpace Helmet"),
             NPCMechanics.hasIt,
             false));
   player.openInventory(clothing);
 }
Esempio n. 2
0
 static void buyRaveShoes(Player player, Inventory inventory) {
   Bits.editBits(player, -ravePrice);
   Clothing.setRaveShoes(player, true);
   NPCMechanics.setPurchased(player, 25);
   player.sendMessage(clothingPrefix + Colorizer.string("&fYou purchased &eRave Shoes&f."));
 }
Esempio n. 3
0
 static void buySpaceHelmet(Player player, Inventory inventory) {
   Bits.editBits(player, -spacePrice);
   Clothing.setSpaceHelmet(player, true);
   NPCMechanics.setPurchased(player, 28);
   player.sendMessage(clothingPrefix + Colorizer.string("&fYou purchased &eSpace Helmet&f."));
 }
Esempio n. 4
0
public class NPCClothing {
  static String clothingPrefix = Colorizer.string("&9Charlie> &f");
  static int ravePrice = 100000;
  static int spacePrice = 75000;

  public static void openClothingMenu(Player player) {
    Inventory clothing = Bukkit.createInventory(null, 45, Colorizer.string("&lClothing Shop"));
    clothing.setItem(
        3,
        Methods.createCustomItem(
            Material.IRON_PLATE, 0, Colorizer.string("&a&lClothing Shop"), null, true));
    clothing.setItem(
        4,
        Methods.createCustomItem(
            Material.GOLD_PLATE,
            0,
            Colorizer.string("&a&l" + Bits.getBits(player) + " Bits"),
            null,
            true));
    clothing.setItem(
        5,
        Methods.createCustomItem(
            Material.IRON_PLATE, 0, Colorizer.string("&a&lClothing Shop"), null, true));
    clothing.setItem(
        10,
        Methods.createCustomItem(
            Material.DIAMOND_HELMET, 0, Colorizer.string("&aHead"), null, false));
    clothing.setItem(
        12,
        Methods.createCustomItem(
            Material.DIAMOND_CHESTPLATE, 0, Colorizer.string("&aChest"), null, false));
    clothing.setItem(
        14,
        Methods.createCustomItem(
            Material.DIAMOND_LEGGINGS, 0, Colorizer.string("&aLegs"), null, false));
    clothing.setItem(
        16,
        Methods.createCustomItem(
            Material.DIAMOND_BOOTS, 0, Colorizer.string("&aFeet"), null, false));
    List<String> raveLore =
        Colorizer.lore(
            null,
            "&fWear the rainbow!",
            null,
            "&aRight-Click To Purchase",
            "&fPrice: &e" + ravePrice + " Bits");
    List<String> spaceLore =
        Colorizer.lore(
            null,
            "&fExperience Apollo 13...",
            null,
            "&aRight-Click To Purchase",
            "&fPrice: &e" + spacePrice + " Bits");
    if (!Clothing.hasRaveHat(player))
      clothing.setItem(
          19,
          Methods.createCustomItem(
              Material.LEATHER_HELMET, 0, Colorizer.string("&a&lRave Hat"), raveLore, false));
    else
      clothing.setItem(
          19,
          Methods.createCustomItem(
              Material.INK_SACK, 8, Colorizer.string("&c&lRave Hat"), NPCMechanics.hasIt, false));
    if (!Clothing.hasRaveShirt(player))
      clothing.setItem(
          21,
          Methods.createCustomItem(
              Material.LEATHER_CHESTPLATE, 0, Colorizer.string("&a&lRave Shirt"), raveLore, false));
    else
      clothing.setItem(
          21,
          Methods.createCustomItem(
              Material.INK_SACK, 8, Colorizer.string("&c&lRave Shirt"), NPCMechanics.hasIt, false));
    if (!Clothing.hasRavePants(player))
      clothing.setItem(
          23,
          Methods.createCustomItem(
              Material.LEATHER_LEGGINGS, 0, Colorizer.string("&a&lRave Pants"), raveLore, false));
    else
      clothing.setItem(
          23,
          Methods.createCustomItem(
              Material.INK_SACK, 8, Colorizer.string("&c&lRave Pants"), NPCMechanics.hasIt, false));
    if (!Clothing.hasRaveShoes(player))
      clothing.setItem(
          25,
          Methods.createCustomItem(
              Material.LEATHER_BOOTS, 0, Colorizer.string("&a&lRave Shoes"), raveLore, false));
    else
      clothing.setItem(
          25,
          Methods.createCustomItem(
              Material.INK_SACK, 8, Colorizer.string("&c&lRave Shoes"), NPCMechanics.hasIt, false));
    if (!Clothing.hasSpaceHelmet(player))
      clothing.setItem(
          28,
          Methods.createCustomItem(
              Material.GLASS, 0, Colorizer.string("&a&lSpace Helmet"), spaceLore, false));
    else
      clothing.setItem(
          28,
          Methods.createCustomItem(
              Material.INK_SACK,
              8,
              Colorizer.string("&c&lSpace Helmet"),
              NPCMechanics.hasIt,
              false));
    player.openInventory(clothing);
  }

  static void clothingShopSelection(Player player, Inventory inventory, ItemStack item) {
    switch (item.getType()) {
      case LEATHER_HELMET:
        if (NPCMechanics.enoughBits(player, ravePrice)) {
          buyRaveHat(player, inventory);
        } else notEnough(player);
        break;
      case LEATHER_CHESTPLATE:
        if (NPCMechanics.enoughBits(player, ravePrice)) {
          buyRaveShirt(player, inventory);
        } else notEnough(player);
        break;
      case LEATHER_LEGGINGS:
        if (NPCMechanics.enoughBits(player, ravePrice)) {
          buyRavePants(player, inventory);
        } else notEnough(player);
        break;
      case LEATHER_BOOTS:
        if (NPCMechanics.enoughBits(player, ravePrice)) {
          buyRaveShoes(player, inventory);
        } else notEnough(player);
        break;
      case GLASS:
        if (NPCMechanics.enoughBits(player, spacePrice)) {
          buySpaceHelmet(player, inventory);
        } else notEnough(player);
        break;
      case INK_SACK:
        player.sendMessage(clothingPrefix + "You already have this item!");
        Sounds.itemBreak(player);
        break;
      default:
        break;
    }
  }

  static void notEnough(Player player) {
    player.sendMessage(clothingPrefix + "Sorry, you don't have enough Bits for that.");
    Sounds.itemBreak(player);
  }

  static void buyRaveHat(Player player, Inventory inventory) {
    Bits.editBits(player, -ravePrice);
    Clothing.setRaveHat(player, true);
    NPCMechanics.setPurchased(player, 19);
    player.sendMessage(clothingPrefix + Colorizer.string("&fYou purchased &eRave Hat&f."));
  }

  static void buyRaveShirt(Player player, Inventory inventory) {
    Bits.editBits(player, -ravePrice);
    Clothing.setRaveShirt(player, true);
    NPCMechanics.setPurchased(player, 21);
    player.sendMessage(clothingPrefix + Colorizer.string("&fYou purchased &eRave Shirt&f."));
  }

  static void buyRavePants(Player player, Inventory inventory) {
    Bits.editBits(player, -ravePrice);
    Clothing.setRavePants(player, true);
    NPCMechanics.setPurchased(player, 23);
    player.sendMessage(clothingPrefix + Colorizer.string("&fYou purchased &eRave Pants&f."));
  }

  static void buyRaveShoes(Player player, Inventory inventory) {
    Bits.editBits(player, -ravePrice);
    Clothing.setRaveShoes(player, true);
    NPCMechanics.setPurchased(player, 25);
    player.sendMessage(clothingPrefix + Colorizer.string("&fYou purchased &eRave Shoes&f."));
  }

  static void buySpaceHelmet(Player player, Inventory inventory) {
    Bits.editBits(player, -spacePrice);
    Clothing.setSpaceHelmet(player, true);
    NPCMechanics.setPurchased(player, 28);
    player.sendMessage(clothingPrefix + Colorizer.string("&fYou purchased &eSpace Helmet&f."));
  }
}