Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package capturethecrystal;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.util.ArrayList;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Player;
- import org.bukkit.event.inventory.InventoryType;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.inventory.meta.SkullMeta;
- import org.bukkit.material.SpawnEgg;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Controller extends JavaPlugin {
- Config conf;
- EventListenerNewCtC listener;
- Lobby lobby;
- String prefix = "§3[§5Capture§3the§5Crystal§3]§f ";
- private Connection connection;
- private ResultSet result;
- private PreparedStatement prestmt;
- private Statement stmt;
- private String url = "jdbc:mysql://localhost:3306/CtC";
- private String user = "root";
- private String password = "";
- private String sql = "";
- //newctc
- public ArrayList<String> worldlistnewctc = new ArrayList<>();
- public ArrayList<String> worldteamanzahlnewctc = new ArrayList<>();
- public ArrayList<String> worldteamgroessenewctc = new ArrayList<>();
- public boolean arenaeditmode = false;
- public boolean mapeditmode = false;
- public ItemStack[] itemsnewctc = new ItemStack[6];
- public Inventory playersave;
- //newmap
- public Inventory mapconfiginvnewctc;
- public Inventory spawnsinvnewctc;
- public Inventory teamsinvnewctc;
- public ItemStack[] teamsitemsnewctc = new ItemStack[8];
- public ItemStack[] traderitemsnewctc = new ItemStack[8];
- public ItemStack[] crystalitemsnewctc = new ItemStack[8];
- public int mapteamanzahlnewctc = 2;
- public int mapteamgroessenewctc = 1;
- public int mapidnewctc;
- public String mapnamenewctc;
- //newarena
- public int arenaidnewctc;
- public Inventory arenaconfiginvnewctc;
- public int arenateamanzahlnewctc = 2;
- public int arenateamgroessenewctc = 1;
- public int mapid = 0;
- public int timelimitnewctc = 30;
- public int pointnewctc = 1;
- public String arenanamenewctc = "";
- private int startmapid = 0;
- public Controller() {
- }
- @Override
- public void onEnable() {
- super.onEnable();
- conf = new Config(this);
- listener = new EventListenerNewCtC(this);
- System.out.println(prefix + "CapturetheCrystal enabled");
- this.database();
- }
- public void onDisable() {
- super.onDisable();
- System.out.println(prefix + "CapturetheCrystal disabled");
- }
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- Player p = (Player) sender;
- if (command.getName().equalsIgnoreCase("newArena")) {
- if (mapeditmode) {
- p.sendMessage(prefix + "Finish or cancel the creation of a new map first.");
- return true;
- }
- if (args.length == 0 || args.length > 1) {
- return false;
- } else {
- p.setGameMode(GameMode.CREATIVE);
- int einträge = 0;
- try {
- sql = "SELECT name FROM arenas";
- stmt = connection.createStatement();
- result = stmt.executeQuery(sql);
- while (result.next()) {
- einträge = einträge + 1;
- String name = result.getString("name");
- if (name != null) {
- if (name.equalsIgnoreCase(args[0])) {
- p.sendMessage(prefix + "§4This arenaname is already taken for an other arena. Please chose a new name.");
- return true;
- }
- }
- }
- } catch (SQLException ex) {
- Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
- } catch (IndexOutOfBoundsException e) {
- p.sendMessage(prefix + "§4 There are no maps registered in your database.");
- return true;
- }
- if (worldlistnewctc.size() == 0) {
- p.sendMessage(prefix + "§4There are no maps registered in your database.");
- return true;
- }
- this.itemsnewarena();
- playersave = p.getInventory();
- p.getInventory().clear();
- arenaidnewctc = einträge + 1;
- arenanamenewctc = args[0];
- arenaeditmode = true;
- p.getInventory().setItem(0, itemsnewctc[0]);
- p.getInventory().setItem(8, itemsnewctc[4]);
- }
- return true;
- }
- if (command.getName().equalsIgnoreCase("newMap")) {
- if (arenaeditmode) {
- p.sendMessage(prefix + "Finish or cancel the creation of a new arena first.");
- return true;
- }
- if (args.length == 0 || args.length > 1) {
- return false;
- } else {
- p.setGameMode(GameMode.CREATIVE);
- int einträge = 0;
- try {
- sql = "SELECT name FROM maps";
- stmt = connection.createStatement();
- result = stmt.executeQuery(sql);
- while (result.next()) {
- einträge = einträge + 1;
- String name = result.getString("name");
- if (name != null) {
- if (name.equalsIgnoreCase(args[0])) {
- p.sendMessage(prefix + "§4 This mapname is already taken for an other map. Please chose a new name.");
- return true;
- }
- }
- }
- } catch (SQLException ex) {
- Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
- }
- playersave = p.getInventory();
- p.getInventory().clear();
- mapidnewctc = einträge + 1;
- mapnamenewctc = args[0];
- this.itemsnewmap();
- mapeditmode = true;
- p.getInventory().setItem(1, itemsnewctc[1]);
- p.getInventory().setItem(2, itemsnewctc[2]);
- p.getInventory().setItem(8, itemsnewctc[3]);
- p.getInventory().setItem(0, itemsnewctc[5]);
- }
- return true;
- }
- if (command.getName().equalsIgnoreCase("startLobby")) {
- if (args.length == 0 || args.length > 1) {
- return false;
- } else {
- startmapid = Integer.parseInt(args[0]);
- try {
- this.startGame();
- } catch (SQLException ex) {
- Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- return true;
- }
- if (command.getName().equalsIgnoreCase("playertolobby")) {
- if (args.length == 0 || args.length > 1) {
- return false;
- } else {
- try {
- lobby.playerJoin(Bukkit.getPlayer(args[0]));
- } catch (SQLException ex) {
- Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- return true;
- }
- if (command.getName().equalsIgnoreCase("test")) {
- if (args.length > 0) {
- return false;
- } else {
- Entity e = Bukkit.getWorld(p.getWorld().getUID()).spawnEntity(p.getLocation(), EntityType.VILLAGER);
- }
- return true;
- }
- if (command.getName().equalsIgnoreCase("reset")) {
- for (int i = 0; i < p.getWorld().getEntities().size(); i++) {
- if (!p.getWorld().getEntities().get(i).getType().equals(EntityType.PLAYER)) {
- p.getWorld().getEntities().get(i).remove();
- }
- }
- return true;
- }
- return false;
- }
- public void database() {
- url = "jdbc:mysql://" + this.getConfig().getString("CapturetheCrystal.database.databaseurl") + "/" + this.getConfig().getString("CapturetheCrystal.database.databasename");
- user = this.getConfig().getString("CapturetheCrystal.database.databaseuser");
- password = this.getConfig().getString("CapturetheCrystal.database.databasepassword");
- try {
- connection = DriverManager.getConnection(url, user, password);
- Class.forName("com.mysql.jdbc.Driver");
- System.out.println(prefix + "Connected to Database: " + url);
- } catch (SQLException e) {
- System.out.println(prefix + "Can't connect to database.");
- System.out.println(prefix + "Make sure you filled in the correct datas in the config.yml file!");
- return;
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- sql = "CREATE TABLE IF NOT EXISTS arenas(arenaid int(3) NULL DEFAULT NULL, mapid int(3) NULL DEFAULT NULL, name varchar(20) NULL DEFAULT NULL , points int(2) NULL DEFAULT NULL , timelimit int(2) NULL DEFAULT NULL, worldname varchar(32) NULL DEFAULT NULL)";
- prestmt = connection.prepareStatement(sql);
- prestmt.executeUpdate();
- sql = "CREATE TABLE IF NOT EXISTS maps(mapid int(6) NULL DEFAULT NULL, name varchar(20) NULL DEFAULT NULL, teamanzahl int(2) NULL DEFAULT NULL, teamgroesse int(3) NULL DEFAULT NULL)";
- prestmt = connection.prepareStatement(sql);
- prestmt.executeUpdate();
- sql = "CREATE TABLE IF NOT EXISTS mapdata(mapid int(6) NULL DEFAULT NULL, data varchar(20) NULL DEFAULT NULL, posx int(6) NULL DEFAULT NULL, posy int(6) NULL DEFAULT NULL, posz int(6) NULL DEFAULT NULL)";
- prestmt = connection.prepareStatement(sql);
- prestmt.executeUpdate();
- worldlistnewctc = this.eintraegeVonDatabase1("maps", "name", null, null);
- worldteamanzahlnewctc = this.eintraegeVonDatabase1("maps", "teamanzahl", null, null);
- worldteamgroessenewctc = this.eintraegeVonDatabase1("maps", "teamgroesse", null, null);
- //sql = "INSERT INTO arenas(arenaid, mapid, name, points) VALUES ('" + (einträge + 1) + "', '0', '" + args[0] + "', '0')";
- //prestmt = connection.prepareStatement(sql);
- //prestmt.executeUpdate();
- } catch (SQLException ex) {
- Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
- } catch (IndexOutOfBoundsException e) {
- e.printStackTrace();
- }
- }
- public boolean eintraegeInDatabase(String table, String[] attributes, String[] values) throws SQLException {
- if (attributes.length != values.length) {
- return false;
- }
- String attri = "";
- String valu = "";
- for (int i = 0; i < attributes.length; i++) {
- attri = attri + attributes[i] + ", ";
- valu = valu + values[i] + "', '";
- }
- attri = attri.substring(0, attri.length() - 2);
- valu = valu.substring(0, valu.length() - 3);
- sql = "INSERT INTO " + table + "(" + attri + ") VALUES ('" + valu + ")";
- stmt = connection.createStatement();
- stmt.executeUpdate(sql);
- return true;
- }
- public ArrayList<String> eintraegeVonDatabase1(String table, String attribut, String value, String where) throws SQLException {
- ArrayList<String> string = new ArrayList<>();
- if (where == null || value == null) {
- sql = "SELECT " + attribut + " FROM " + table + "";
- } else {
- sql = "SELECT " + attribut + " FROM " + table + " WHERE " + where + " = " + value + "";
- }
- prestmt = connection.prepareStatement(sql);
- result = prestmt.executeQuery();
- while (result.next()) {
- string.add(result.getString(attribut));
- }
- return string;
- }
- public ArrayList<String> eintraegeVonDatabase2(String table, String attribut, String[] value, String[] where) throws SQLException {
- ArrayList<String> string = new ArrayList<>();
- sql = "SELECT " + attribut + " FROM " + table + " WHERE ";
- for (int i = 0; i < where.length; i++) {
- sql = sql + where[i] + " = " + value[i] + " AND ";
- }
- sql = sql.substring(0, sql.length() - 5);
- prestmt = connection.prepareStatement(sql);
- result = prestmt.executeQuery();
- while (result.next()) {
- string.add(result.getString(attribut));
- }
- return string;
- }
- public boolean checkDatabase() {
- return true;
- }
- public void startGame() throws SQLException {
- lobby = new Lobby(this, startmapid);
- }
- public void itemsnewmap() {
- ArrayList<String> liste = new ArrayList<String>();
- ItemMeta[] itemsnewctcmeta = new ItemMeta[6];
- itemsnewctc[1] = new ItemStack(Material.BLAZE_POWDER);
- itemsnewctcmeta[1] = itemsnewctc[1].getItemMeta();
- itemsnewctcmeta[1].setDisplayName("§3SPAWNS");
- liste.add("§7Click on a block");
- liste.add("§7to select the spawns");
- itemsnewctcmeta[1].setLore(liste);
- itemsnewctc[1].setItemMeta(itemsnewctcmeta[1]);
- liste.clear();
- itemsnewctc[2] = new ItemStack(Material.BLAZE_ROD);
- itemsnewctcmeta[2] = itemsnewctc[2].getItemMeta();
- itemsnewctcmeta[2].setDisplayName("§6WORLDBORDER");
- liste.add("§7Leftclick: Position 1");
- liste.add("§7Rightclick: Position 2");
- itemsnewctcmeta[2].setLore(liste);
- itemsnewctc[2].setItemMeta(itemsnewctcmeta[2]);
- liste.clear();
- itemsnewctc[3] = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 5);
- itemsnewctcmeta[3] = itemsnewctc[3].getItemMeta();
- itemsnewctcmeta[3].setDisplayName("§2FINISH");
- liste.add("§7Click to create the arena");
- itemsnewctcmeta[3].setLore(liste);
- itemsnewctc[3].setItemMeta(itemsnewctcmeta[3]);
- liste.clear();
- itemsnewctc[5] = new ItemStack(Material.FURNACE);
- itemsnewctcmeta[5] = itemsnewctc[5].getItemMeta();
- itemsnewctcmeta[5].setDisplayName("§4MAPSETTINGS");
- liste.add("§7Click to edit the Settings");
- itemsnewctcmeta[5].setLore(liste);
- itemsnewctc[5].setItemMeta(itemsnewctcmeta[5]);
- liste.clear();
- ItemMeta imeta;
- mapconfiginvnewctc = Bukkit.createInventory(null, InventoryType.FURNACE, prefix + "SETTINGS");
- ItemStack[] configitemsnewctc = new ItemStack[2];
- configitemsnewctc[0] = new ItemStack(Material.TOTEM);
- configitemsnewctc[0].setAmount(2);
- imeta = configitemsnewctc[0].getItemMeta();
- imeta.setDisplayName("§6Amount of teams");
- liste.add("§7Leftclick: Increase");
- liste.add("§7Rightclick: Decrease");
- imeta.setLore(liste);
- configitemsnewctc[0].setItemMeta(imeta);
- liste.clear();
- SkullMeta meta = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);
- meta.setOwner("FistGenius");
- configitemsnewctc[1] = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
- meta.setDisplayName("§aSize of a team");
- liste.add("§7Leftclick: Increase");
- liste.add("§7Rightclick: Decrease");
- meta.setLore(liste);
- configitemsnewctc[1].setItemMeta(meta);
- liste.clear();
- ItemStack item = new ItemStack(Material.MAP);
- imeta = item.getItemMeta();
- meta.setDisplayName("" + mapnamenewctc);
- item.setItemMeta(imeta);
- mapconfiginvnewctc.addItem(configitemsnewctc[0]);
- mapconfiginvnewctc.addItem(configitemsnewctc[1]);
- mapconfiginvnewctc.addItem(item);
- spawnsinvnewctc = Bukkit.createInventory(null, 9, prefix + "SPAWNS");
- ItemStack[] spawnsitemsnewctc = new ItemStack[5];
- spawnsitemsnewctc[0] = new ItemStack(Material.TOTEM);
- imeta = spawnsitemsnewctc[0].getItemMeta();
- imeta.setDisplayName("§3Teams");
- liste.add("§7Click and chose a team");
- liste.add("§7to select this block");
- liste.add("§7as its spawn");
- imeta.setLore(liste);
- spawnsitemsnewctc[0].setItemMeta(imeta);
- liste.clear();
- spawnsitemsnewctc[1] = new ItemStack(Material.CLAY_BRICK);
- imeta = spawnsitemsnewctc[1].getItemMeta();
- imeta.setDisplayName("§cBronze");
- liste.add("§7Click to select this block");
- liste.add("§7as a Bronzespawner");
- imeta.setLore(liste);
- spawnsitemsnewctc[1].setItemMeta(imeta);
- liste.clear();
- spawnsitemsnewctc[2] = new ItemStack(Material.IRON_INGOT);
- imeta = spawnsitemsnewctc[2].getItemMeta();
- imeta.setDisplayName("§7Silver");
- liste.add("§7Click to select this block");
- liste.add("§7as a Silverspawner");
- imeta.setLore(liste);
- spawnsitemsnewctc[2].setItemMeta(imeta);
- liste.clear();
- spawnsitemsnewctc[3] = new ItemStack(Material.GOLD_INGOT);
- imeta = spawnsitemsnewctc[3].getItemMeta();
- imeta.setDisplayName("§eGold");
- liste.add("§7Click to select this block");
- liste.add("§7as a Goldspawner");
- imeta.setLore(liste);
- spawnsitemsnewctc[3].setItemMeta(imeta);
- liste.clear();
- spawnsitemsnewctc[4] = new ItemStack(Material.COMPASS);
- imeta = spawnsitemsnewctc[4].getItemMeta();
- imeta.setDisplayName("§2Lobby");
- liste.add("§7Click to select this block");
- liste.add("§7as the Lobbyspawn");
- imeta.setLore(liste);
- spawnsitemsnewctc[4].setItemMeta(imeta);
- liste.clear();
- for (int i = 0; i < 9; i++) {
- spawnsinvnewctc.setItem(i, new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7));
- }
- spawnsinvnewctc.setItem(2, spawnsitemsnewctc[0]);
- spawnsinvnewctc.setItem(3, spawnsitemsnewctc[4]);
- spawnsinvnewctc.setItem(4, spawnsitemsnewctc[1]);
- spawnsinvnewctc.setItem(5, spawnsitemsnewctc[2]);
- spawnsinvnewctc.setItem(6, spawnsitemsnewctc[3]);
- teamsinvnewctc = Bukkit.createInventory(null, 27, prefix + "TEAMS");
- teamsitemsnewctc[0] = new ItemStack(Material.WOOL, 1, (short) 3);
- imeta = teamsitemsnewctc[0].getItemMeta();
- imeta.setDisplayName("§9TEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team blue");
- imeta.setLore(liste);
- teamsitemsnewctc[0].setItemMeta(imeta);
- liste.clear();
- teamsitemsnewctc[1] = new ItemStack(Material.WOOL, 1, (short) 14);
- imeta = teamsitemsnewctc[1].getItemMeta();
- imeta.setDisplayName("§cTEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team red");
- imeta.setLore(liste);
- teamsitemsnewctc[1].setItemMeta(imeta);
- liste.clear();
- teamsitemsnewctc[2] = new ItemStack(Material.WOOL, 1, (short) 5);
- imeta = teamsitemsnewctc[2].getItemMeta();
- imeta.setDisplayName("§aTEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team green");
- imeta.setLore(liste);
- teamsitemsnewctc[2].setItemMeta(imeta);
- liste.clear();
- teamsitemsnewctc[3] = new ItemStack(Material.WOOL, 1, (short) 4);
- imeta = teamsitemsnewctc[3].getItemMeta();
- imeta.setDisplayName("§eTEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team yewllow");
- imeta.setLore(liste);
- teamsitemsnewctc[3].setItemMeta(imeta);
- liste.clear();
- teamsitemsnewctc[4] = new ItemStack(Material.WOOL, 1, (short) 1);
- imeta = teamsitemsnewctc[4].getItemMeta();
- imeta.setDisplayName("§6TEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team oragne");
- imeta.setLore(liste);
- teamsitemsnewctc[4].setItemMeta(imeta);
- liste.clear();
- teamsitemsnewctc[5] = new ItemStack(Material.WOOL, 1, (short) 10);
- imeta = teamsitemsnewctc[5].getItemMeta();
- imeta.setDisplayName("§5TEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team purple");
- imeta.setLore(liste);
- teamsitemsnewctc[5].setItemMeta(imeta);
- liste.clear();
- teamsitemsnewctc[6] = new ItemStack(Material.WOOL, 1, (short) 15);
- imeta = teamsitemsnewctc[6].getItemMeta();
- imeta.setDisplayName("§8TEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team black");
- imeta.setLore(liste);
- teamsitemsnewctc[6].setItemMeta(imeta);
- liste.clear();
- teamsitemsnewctc[7] = new ItemStack(Material.WOOL, 1, (short) 0);
- imeta = teamsitemsnewctc[7].getItemMeta();
- imeta.setDisplayName("§fTEAMSPAWN");
- liste.add("§7Click to select this block");
- liste.add("§7as spawn for team white");
- imeta.setLore(liste);
- teamsitemsnewctc[7].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[0] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[0].getItemMeta();
- imeta.setDisplayName("§9TEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team blue");
- imeta.setLore(liste);
- traderitemsnewctc[0].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[1] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[1].getItemMeta();
- imeta.setDisplayName("§cTEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team red");
- imeta.setLore(liste);
- traderitemsnewctc[1].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[2] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[2].getItemMeta();
- imeta.setDisplayName("§aTEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team green");
- imeta.setLore(liste);
- traderitemsnewctc[2].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[3] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[3].getItemMeta();
- imeta.setDisplayName("§eTEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team yellow");
- imeta.setLore(liste);
- traderitemsnewctc[3].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[4] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[4].getItemMeta();
- imeta.setDisplayName("§6TEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team oragne");
- imeta.setLore(liste);
- traderitemsnewctc[4].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[5] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[5].getItemMeta();
- imeta.setDisplayName("§5TEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team purple");
- imeta.setLore(liste);
- traderitemsnewctc[5].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[6] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[6].getItemMeta();
- imeta.setDisplayName("§0TEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team black");
- imeta.setLore(liste);
- traderitemsnewctc[6].setItemMeta(imeta);
- liste.clear();
- traderitemsnewctc[7] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
- imeta = traderitemsnewctc[7].getItemMeta();
- imeta.setDisplayName("§fTEAMTRADER");
- liste.add("§7Click to select this block");
- liste.add("§7as traderposition of team white");
- imeta.setLore(liste);
- traderitemsnewctc[7].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[0] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[0].getItemMeta();
- imeta.setDisplayName("§9TEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team blue");
- imeta.setLore(liste);
- crystalitemsnewctc[0].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[1] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[1].getItemMeta();
- imeta.setDisplayName("§cTEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team red");
- imeta.setLore(liste);
- crystalitemsnewctc[1].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[2] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[2].getItemMeta();
- imeta.setDisplayName("§aTEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team green");
- imeta.setLore(liste);
- crystalitemsnewctc[2].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[3] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[3].getItemMeta();
- imeta.setDisplayName("§eTEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team yellow");
- imeta.setLore(liste);
- crystalitemsnewctc[3].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[4] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[4].getItemMeta();
- imeta.setDisplayName("§6TEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team oragne");
- imeta.setLore(liste);
- crystalitemsnewctc[4].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[5] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[5].getItemMeta();
- imeta.setDisplayName("§5TEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team purple");
- imeta.setLore(liste);
- crystalitemsnewctc[5].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[6] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[6].getItemMeta();
- imeta.setDisplayName("§0TEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team black");
- imeta.setLore(liste);
- crystalitemsnewctc[6].setItemMeta(imeta);
- liste.clear();
- crystalitemsnewctc[7] = new ItemStack(Material.END_CRYSTAL);
- imeta = crystalitemsnewctc[7].getItemMeta();
- imeta.setDisplayName("§fTEAMCRYSTAL");
- liste.add("§7Click to select this block");
- liste.add("§7as crystalposition of team white");
- imeta.setLore(liste);
- crystalitemsnewctc[7].setItemMeta(imeta);
- liste.clear();
- }
- public void itemsnewarena() {
- ArrayList<String> liste = new ArrayList<String>();
- ItemMeta[] itemsnewctcmeta = new ItemMeta[5];
- itemsnewctc[0] = new ItemStack(Material.BREWING_STAND_ITEM);
- itemsnewctcmeta[0] = itemsnewctc[0].getItemMeta();
- itemsnewctcmeta[0].setDisplayName("§4ARENASETTINGS");
- liste.add("§7Click to edit the Settings");
- itemsnewctcmeta[0].setLore(liste);
- itemsnewctc[0].setItemMeta(itemsnewctcmeta[0]);
- liste.clear();
- itemsnewctc[4] = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 5);
- itemsnewctcmeta[4] = itemsnewctc[4].getItemMeta();
- itemsnewctcmeta[4].setDisplayName("§2FINISH ARENA");
- liste.add("§7Click to create the arena");
- itemsnewctcmeta[4].setLore(liste);
- itemsnewctc[4].setItemMeta(itemsnewctcmeta[4]);
- liste.clear();
- arenaconfiginvnewctc = Bukkit.createInventory(null, InventoryType.BREWING, prefix + "SETTINGS");
- ItemStack[] configitemsnewctc = new ItemStack[5];
- ItemMeta imeta;
- configitemsnewctc[0] = new ItemStack(Material.TOTEM);
- configitemsnewctc[0].setAmount(2);
- imeta = configitemsnewctc[0].getItemMeta();
- imeta.setDisplayName("§6Amount of teams");
- liste.add("§7Leftclick: Increase");
- liste.add("§7Rightclick: Decrease");
- imeta.setLore(liste);
- configitemsnewctc[0].setItemMeta(imeta);
- liste.clear();
- SkullMeta meta = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);
- meta.setOwner("FistGenius");
- configitemsnewctc[1] = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
- meta.setDisplayName("§aSize of a team");
- liste.add("§7Leftclick: Increase");
- liste.add("§7Rightclick: Decrease");
- meta.setLore(liste);
- configitemsnewctc[1].setItemMeta(meta);
- liste.clear();
- configitemsnewctc[2] = new ItemStack(Material.WATCH);
- configitemsnewctc[2].setAmount(5);
- imeta = configitemsnewctc[2].getItemMeta();
- imeta.setDisplayName("§cTimelimit in minutes");
- liste.add("§7Leftclick: +1");
- liste.add("§7Rightclick: -1");
- liste.add("§7Shift + Leftclick: +5");
- liste.add("§7Shift + Rightclick: -5");
- liste.add("§7Middleclick: no timelimit");
- imeta.setLore(liste);
- configitemsnewctc[2].setItemMeta(imeta);
- liste.clear();
- configitemsnewctc[3] = new ItemStack(Material.BANNER);
- imeta = configitemsnewctc[3].getItemMeta();
- imeta.setDisplayName("§3Capturepoints");
- liste.add("§7Leftclick: Increase");
- liste.add("§7Rightclick: Decrease");
- imeta.setLore(liste);
- configitemsnewctc[3].setItemMeta(imeta);
- liste.clear();
- configitemsnewctc[4] = new ItemStack(Material.MAP);
- imeta = configitemsnewctc[4].getItemMeta();
- imeta.setDisplayName("§9Map: " + worldlistnewctc.get(0));
- liste.add("§7Leftclick: Next");
- liste.add("§7Rightclick: Last");
- imeta.setLore(liste);
- configitemsnewctc[4].setItemMeta(imeta);
- liste.clear();
- for (int i = 0; i < 5; i++) {
- arenaconfiginvnewctc.addItem(configitemsnewctc[i]);
- }
- listener.maprefresh();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement