266 lines
8.7 KiB
Java
266 lines
8.7 KiB
Java
package eu.univento.woolget.utils;
|
|
|
|
import eu.univento.core.api.game.TeamManager;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.inventory.Inventory;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.inventory.meta.ItemMeta;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 0.1
|
|
*/
|
|
public class Shop {
|
|
|
|
private static HashMap<CustomPlayer, Integer> coins = new HashMap<>();
|
|
public static HashMap<CustomPlayer, Integer> getCoins() {
|
|
return coins;
|
|
}
|
|
|
|
public static ArrayList<CustomPlayer> mobileShop() {
|
|
return new ArrayList<>();
|
|
}
|
|
|
|
public static void updateInventory(CustomPlayer p) {
|
|
if(p.getInventory().getItem(8) != null) {
|
|
ItemMeta meta = p.getInventory().getItem(8).getItemMeta();
|
|
meta.setDisplayName(coins.get(p) + " Coins");
|
|
p.getInventory().getItem(8).setItemMeta(meta);
|
|
}else{
|
|
ItemStack item = new ItemStack(Material.GOLD_INGOT);
|
|
ItemMeta meta = item.getItemMeta();
|
|
meta.setDisplayName(coins.get(p) + " Coins");
|
|
item.setItemMeta(meta);
|
|
p.getInventory().setItem(8, item);
|
|
}
|
|
}
|
|
|
|
|
|
public static Inventory getInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Shop");
|
|
|
|
ItemStack weapons = new ItemStack(Material.IRON_SWORD);
|
|
ItemMeta weaponsMeta = weapons.getItemMeta();
|
|
weaponsMeta.setDisplayName("Waffen");
|
|
weapons.setItemMeta(weaponsMeta);
|
|
|
|
ItemStack build = new ItemStack(Material.GLASS, (short) 6);
|
|
ItemMeta buildMeta = build.getItemMeta();
|
|
buildMeta.setDisplayName("Baumaterial");
|
|
build.setItemMeta(buildMeta);
|
|
|
|
ItemStack food = new ItemStack(Material.BREAD);
|
|
ItemMeta foodMeta = food.getItemMeta();
|
|
foodMeta.setDisplayName("Nahrungsmittel");
|
|
food.setItemMeta(foodMeta);
|
|
|
|
ItemStack special = new ItemStack(Material.WOOD_PLATE);
|
|
ItemMeta specialMeta = special.getItemMeta();
|
|
specialMeta.setDisplayName("Special");
|
|
special.setItemMeta(specialMeta);
|
|
|
|
inv.setItem(1, weapons);
|
|
inv.setItem(3, build);
|
|
inv.setItem(5, food);
|
|
inv.setItem(7, special);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getWeaponsInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Waffen");
|
|
|
|
ItemStack swords = new ItemStack(Material.STONE_SWORD);
|
|
ItemMeta swordsMeta = swords.getItemMeta();
|
|
swordsMeta.setDisplayName("Schwerter");
|
|
swords.setItemMeta(swordsMeta);
|
|
|
|
ItemStack bows = new ItemStack(Material.BOW);
|
|
ItemMeta bowsMeta = bows.getItemMeta();
|
|
bowsMeta.setDisplayName("Bögen");
|
|
bows.setItemMeta(bowsMeta);
|
|
|
|
ItemStack armor = new ItemStack(Material.GOLD_CHESTPLATE);
|
|
ItemMeta armorMeta = armor.getItemMeta();
|
|
armorMeta.setDisplayName("Rüstung");
|
|
armor.setItemMeta(armorMeta);
|
|
|
|
ItemStack other = new ItemStack(Material.SHIELD);
|
|
ItemMeta otherMeta = other.getItemMeta();
|
|
otherMeta.setDisplayName("Anderes");
|
|
other.setItemMeta(otherMeta);
|
|
|
|
inv.setItem(1, swords);
|
|
inv.setItem(3, bows);
|
|
inv.setItem(5, armor);
|
|
inv.setItem(7, other);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getSwordInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Schwerter");
|
|
|
|
ItemStack wood = new ItemStack(Material.WOOD_SWORD);
|
|
ItemStack gold = new ItemStack(Material.GOLD_SWORD);
|
|
ItemStack stone = new ItemStack(Material.STONE_SWORD);
|
|
ItemStack iron = new ItemStack(Material.IRON_SWORD);
|
|
ItemStack diamond = new ItemStack(Material.DIAMOND_SWORD);
|
|
|
|
inv.setItem(0, wood);
|
|
inv.setItem(1, gold);
|
|
inv.setItem(2, stone);
|
|
inv.setItem(3, iron);
|
|
inv.setItem(4, diamond);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getBowInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Bögen");
|
|
|
|
ItemStack normal = new ItemStack(Material.BOW);
|
|
|
|
inv.setItem(4, normal);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getArmorInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Rüstung");
|
|
|
|
ItemStack leather = new ItemStack(Material.LEATHER_CHESTPLATE);
|
|
ItemMeta leatherMeta = leather.getItemMeta();
|
|
leatherMeta.setDisplayName("Leder");
|
|
leather.setItemMeta(leatherMeta);
|
|
|
|
ItemStack gold = new ItemStack(Material.GOLD_CHESTPLATE);
|
|
ItemMeta goldMeta = gold.getItemMeta();
|
|
goldMeta.setDisplayName("Gold");
|
|
gold.setItemMeta(goldMeta);
|
|
|
|
ItemStack chain = new ItemStack(Material.CHAINMAIL_CHESTPLATE);
|
|
ItemMeta chainMeta = chain.getItemMeta();
|
|
chainMeta.setDisplayName("Kette");
|
|
chain.setItemMeta(chainMeta);
|
|
|
|
ItemStack iron = new ItemStack(Material.IRON_CHESTPLATE);
|
|
ItemMeta ironMeta = iron.getItemMeta();
|
|
ironMeta.setDisplayName("Eisen");
|
|
iron.setItemMeta(ironMeta);
|
|
|
|
ItemStack diamond = new ItemStack(Material.DIAMOND_CHESTPLATE);
|
|
ItemMeta diamondMeta = diamond.getItemMeta();
|
|
diamondMeta.setDisplayName("Diamand");
|
|
diamond.setItemMeta(diamondMeta);
|
|
|
|
inv.setItem(0, leather);
|
|
inv.setItem(1, gold);
|
|
inv.setItem(2, chain);
|
|
inv.setItem(3, iron);
|
|
inv.setItem(4, diamond);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getOtherInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Anderes");
|
|
|
|
ItemStack rod = new ItemStack(Material.FISHING_ROD);
|
|
ItemStack arrow = new ItemStack(Material.ARROW);
|
|
ItemStack shield = new ItemStack(Material.SHIELD);
|
|
|
|
inv.setItem(0, rod);
|
|
inv.setItem(4, arrow);
|
|
inv.setItem(8, shield);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getBuildInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Baumaterial");
|
|
short color = 0;
|
|
|
|
if(TeamManager.getTeam(p).getName().equals("blue")) color = 11;
|
|
if(TeamManager.getTeam(p).getName().equals("yellow")) color = 4;
|
|
|
|
ItemStack glass = new ItemStack(Material.STAINED_GLASS, color);
|
|
ItemStack clay = new ItemStack(Material.STAINED_CLAY, color);
|
|
|
|
ItemStack wood = new ItemStack(Material.WOOD_PICKAXE);
|
|
ItemStack gold = new ItemStack(Material.GOLD_PICKAXE);
|
|
ItemStack stone = new ItemStack(Material.STONE_PICKAXE);
|
|
ItemStack iron = new ItemStack(Material.IRON_PICKAXE);
|
|
ItemStack diamond = new ItemStack(Material.DIAMOND_PICKAXE);
|
|
|
|
inv.setItem(0, glass);
|
|
inv.setItem(1, clay);
|
|
inv.setItem(2, wood);
|
|
inv.setItem(3, gold);
|
|
inv.setItem(4, stone);
|
|
inv.setItem(5, iron);
|
|
inv.setItem(6, diamond);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getFoodInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Nahrungsmittel");
|
|
|
|
ItemStack apple = new ItemStack(Material.APPLE);
|
|
ItemStack bread = new ItemStack(Material.BREAD);
|
|
ItemStack steak = new ItemStack(Material.COOKED_BEEF);
|
|
ItemStack golden = new ItemStack(Material.GOLDEN_APPLE);
|
|
|
|
inv.setItem(0, apple);
|
|
inv.setItem(1, bread);
|
|
inv.setItem(2, steak);
|
|
inv.setItem(3, golden);
|
|
|
|
return inv;
|
|
}
|
|
|
|
public static Inventory getSpecialInventory(CustomPlayer p) {
|
|
Inventory inv = Bukkit.createInventory(p, 9, "Spezial");
|
|
|
|
ItemStack c4 = new ItemStack(Material.WOOD_PLATE);
|
|
ItemMeta c4Meta = c4.getItemMeta();
|
|
c4Meta.setDisplayName("C4");
|
|
c4.setItemMeta(c4Meta);
|
|
|
|
ItemStack mine = new ItemStack(Material.STONE_PLATE);
|
|
ItemMeta mineMeta = mine.getItemMeta();
|
|
mineMeta.setDisplayName("Miene");
|
|
mine.setItemMeta(mineMeta);
|
|
|
|
ItemStack compass = new ItemStack(Material.COMPASS);
|
|
ItemStack snowball = new ItemStack(Material.SNOW_BALL);
|
|
ItemStack portal = new ItemStack(Material.PORTAL);
|
|
|
|
ItemStack grenade = new ItemStack(Material.FIREBALL);
|
|
ItemMeta grenadeMeta = grenade.getItemMeta();
|
|
grenadeMeta.setDisplayName("Granate");
|
|
grenade.setItemMeta(grenadeMeta);
|
|
|
|
ItemStack shop = new ItemStack(Material.GOLD_INGOT);
|
|
ItemMeta shopMeta = shop.getItemMeta();
|
|
shopMeta.setDisplayName("mobiler Shop");
|
|
shop.setItemMeta(shopMeta);
|
|
|
|
inv.setItem(0, c4);
|
|
inv.setItem(1, mine);
|
|
inv.setItem(2, compass);
|
|
inv.setItem(3, snowball);
|
|
inv.setItem(4, portal);
|
|
inv.setItem(5, grenade);
|
|
inv.setItem(6, shop);
|
|
|
|
return inv;
|
|
}
|
|
|
|
} |