Advertisement
xXBonoboXx

Untitled

Dec 29th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.84 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package capturethecrystal;
  7.  
  8. import java.sql.Connection;
  9. import java.sql.DriverManager;
  10. import java.sql.PreparedStatement;
  11. import java.sql.ResultSet;
  12. import java.sql.SQLException;
  13. import java.sql.Statement;
  14. import java.util.ArrayList;
  15. import java.util.logging.Level;
  16. import java.util.logging.Logger;
  17. import org.bukkit.Bukkit;
  18. import org.bukkit.GameMode;
  19. import org.bukkit.Material;
  20. import org.bukkit.command.Command;
  21. import org.bukkit.command.CommandSender;
  22. import org.bukkit.entity.Entity;
  23. import org.bukkit.entity.EntityType;
  24. import org.bukkit.entity.Player;
  25. import org.bukkit.event.inventory.InventoryType;
  26. import org.bukkit.inventory.Inventory;
  27. import org.bukkit.inventory.ItemStack;
  28. import org.bukkit.inventory.meta.ItemMeta;
  29. import org.bukkit.inventory.meta.SkullMeta;
  30. import org.bukkit.material.SpawnEgg;
  31. import org.bukkit.plugin.java.JavaPlugin;
  32.  
  33. public class Controller extends JavaPlugin {
  34.  
  35. Config conf;
  36. EventListenerNewCtC listener;
  37. Lobby lobby;
  38.  
  39. String prefix = "§3[§5Capture§3the§5Crystal§3]§f ";
  40.  
  41. private Connection connection;
  42. private ResultSet result;
  43. private PreparedStatement prestmt;
  44. private Statement stmt;
  45. private String url = "jdbc:mysql://localhost:3306/CtC";
  46. private String user = "root";
  47. private String password = "";
  48. private String sql = "";
  49.  
  50. //newctc
  51. public ArrayList<String> worldlistnewctc = new ArrayList<>();
  52. public ArrayList<String> worldteamanzahlnewctc = new ArrayList<>();
  53. public ArrayList<String> worldteamgroessenewctc = new ArrayList<>();
  54. public boolean arenaeditmode = false;
  55. public boolean mapeditmode = false;
  56. public ItemStack[] itemsnewctc = new ItemStack[6];
  57. public Inventory playersave;
  58.  
  59. //newmap
  60. public Inventory mapconfiginvnewctc;
  61. public Inventory spawnsinvnewctc;
  62. public Inventory teamsinvnewctc;
  63. public ItemStack[] teamsitemsnewctc = new ItemStack[8];
  64. public ItemStack[] traderitemsnewctc = new ItemStack[8];
  65. public ItemStack[] crystalitemsnewctc = new ItemStack[8];
  66. public int mapteamanzahlnewctc = 2;
  67. public int mapteamgroessenewctc = 1;
  68. public int mapidnewctc;
  69. public String mapnamenewctc;
  70.  
  71. //newarena
  72. public int arenaidnewctc;
  73. public Inventory arenaconfiginvnewctc;
  74. public int arenateamanzahlnewctc = 2;
  75. public int arenateamgroessenewctc = 1;
  76. public int mapid = 0;
  77. public int timelimitnewctc = 30;
  78. public int pointnewctc = 1;
  79. public String arenanamenewctc = "";
  80.  
  81. private int startmapid = 0;
  82.  
  83. public Controller() {
  84. }
  85.  
  86. @Override
  87. public void onEnable() {
  88. super.onEnable();
  89. conf = new Config(this);
  90. listener = new EventListenerNewCtC(this);
  91. System.out.println(prefix + "CapturetheCrystal enabled");
  92. this.database();
  93. }
  94.  
  95. public void onDisable() {
  96. super.onDisable();
  97. System.out.println(prefix + "CapturetheCrystal disabled");
  98. }
  99.  
  100. @Override
  101. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  102.  
  103. Player p = (Player) sender;
  104.  
  105. if (command.getName().equalsIgnoreCase("newArena")) {
  106. if (mapeditmode) {
  107. p.sendMessage(prefix + "Finish or cancel the creation of a new map first.");
  108. return true;
  109. }
  110. if (args.length == 0 || args.length > 1) {
  111. return false;
  112. } else {
  113. p.setGameMode(GameMode.CREATIVE);
  114. int einträge = 0;
  115. try {
  116. sql = "SELECT name FROM arenas";
  117. stmt = connection.createStatement();
  118. result = stmt.executeQuery(sql);
  119. while (result.next()) {
  120. einträge = einträge + 1;
  121. String name = result.getString("name");
  122. if (name != null) {
  123. if (name.equalsIgnoreCase(args[0])) {
  124. p.sendMessage(prefix + "§4This arenaname is already taken for an other arena. Please chose a new name.");
  125. return true;
  126. }
  127. }
  128. }
  129. } catch (SQLException ex) {
  130. Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
  131. } catch (IndexOutOfBoundsException e) {
  132. p.sendMessage(prefix + "§4 There are no maps registered in your database.");
  133. return true;
  134. }
  135. if (worldlistnewctc.size() == 0) {
  136. p.sendMessage(prefix + "§4There are no maps registered in your database.");
  137. return true;
  138. }
  139. this.itemsnewarena();
  140. playersave = p.getInventory();
  141. p.getInventory().clear();
  142. arenaidnewctc = einträge + 1;
  143. arenanamenewctc = args[0];
  144. arenaeditmode = true;
  145. p.getInventory().setItem(0, itemsnewctc[0]);
  146. p.getInventory().setItem(8, itemsnewctc[4]);
  147. }
  148. return true;
  149. }
  150.  
  151. if (command.getName().equalsIgnoreCase("newMap")) {
  152. if (arenaeditmode) {
  153. p.sendMessage(prefix + "Finish or cancel the creation of a new arena first.");
  154. return true;
  155. }
  156. if (args.length == 0 || args.length > 1) {
  157. return false;
  158. } else {
  159. p.setGameMode(GameMode.CREATIVE);
  160. int einträge = 0;
  161. try {
  162. sql = "SELECT name FROM maps";
  163. stmt = connection.createStatement();
  164. result = stmt.executeQuery(sql);
  165. while (result.next()) {
  166. einträge = einträge + 1;
  167. String name = result.getString("name");
  168. if (name != null) {
  169. if (name.equalsIgnoreCase(args[0])) {
  170. p.sendMessage(prefix + "§4 This mapname is already taken for an other map. Please chose a new name.");
  171. return true;
  172. }
  173. }
  174. }
  175. } catch (SQLException ex) {
  176. Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
  177. }
  178. playersave = p.getInventory();
  179. p.getInventory().clear();
  180. mapidnewctc = einträge + 1;
  181. mapnamenewctc = args[0];
  182. this.itemsnewmap();
  183. mapeditmode = true;
  184. p.getInventory().setItem(1, itemsnewctc[1]);
  185. p.getInventory().setItem(2, itemsnewctc[2]);
  186. p.getInventory().setItem(8, itemsnewctc[3]);
  187. p.getInventory().setItem(0, itemsnewctc[5]);
  188. }
  189. return true;
  190. }
  191.  
  192. if (command.getName().equalsIgnoreCase("startLobby")) {
  193. if (args.length == 0 || args.length > 1) {
  194. return false;
  195. } else {
  196. startmapid = Integer.parseInt(args[0]);
  197. try {
  198. this.startGame();
  199. } catch (SQLException ex) {
  200. Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
  201. }
  202. }
  203. return true;
  204. }
  205.  
  206. if (command.getName().equalsIgnoreCase("playertolobby")) {
  207. if (args.length == 0 || args.length > 1) {
  208. return false;
  209. } else {
  210. try {
  211. lobby.playerJoin(Bukkit.getPlayer(args[0]));
  212. } catch (SQLException ex) {
  213. Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
  214. }
  215. }
  216. return true;
  217. }
  218.  
  219. if (command.getName().equalsIgnoreCase("test")) {
  220. if (args.length > 0) {
  221. return false;
  222. } else {
  223. Entity e = Bukkit.getWorld(p.getWorld().getUID()).spawnEntity(p.getLocation(), EntityType.VILLAGER);
  224. }
  225. return true;
  226. }
  227.  
  228. if (command.getName().equalsIgnoreCase("reset")) {
  229. for (int i = 0; i < p.getWorld().getEntities().size(); i++) {
  230. if (!p.getWorld().getEntities().get(i).getType().equals(EntityType.PLAYER)) {
  231. p.getWorld().getEntities().get(i).remove();
  232. }
  233. }
  234. return true;
  235. }
  236.  
  237. return false;
  238. }
  239.  
  240. public void database() {
  241. url = "jdbc:mysql://" + this.getConfig().getString("CapturetheCrystal.database.databaseurl") + "/" + this.getConfig().getString("CapturetheCrystal.database.databasename");
  242. user = this.getConfig().getString("CapturetheCrystal.database.databaseuser");
  243. password = this.getConfig().getString("CapturetheCrystal.database.databasepassword");
  244. try {
  245. connection = DriverManager.getConnection(url, user, password);
  246. Class.forName("com.mysql.jdbc.Driver");
  247. System.out.println(prefix + "Connected to Database: " + url);
  248. } catch (SQLException e) {
  249. System.out.println(prefix + "Can't connect to database.");
  250. System.out.println(prefix + "Make sure you filled in the correct datas in the config.yml file!");
  251. return;
  252. } catch (Exception e) {
  253. e.printStackTrace();
  254. }
  255.  
  256. try {
  257. 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)";
  258. prestmt = connection.prepareStatement(sql);
  259. prestmt.executeUpdate();
  260. 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)";
  261. prestmt = connection.prepareStatement(sql);
  262. prestmt.executeUpdate();
  263. 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)";
  264. prestmt = connection.prepareStatement(sql);
  265. prestmt.executeUpdate();
  266. worldlistnewctc = this.eintraegeVonDatabase1("maps", "name", null, null);
  267. worldteamanzahlnewctc = this.eintraegeVonDatabase1("maps", "teamanzahl", null, null);
  268. worldteamgroessenewctc = this.eintraegeVonDatabase1("maps", "teamgroesse", null, null);
  269. //sql = "INSERT INTO arenas(arenaid, mapid, name, points) VALUES ('" + (einträge + 1) + "', '0', '" + args[0] + "', '0')";
  270. //prestmt = connection.prepareStatement(sql);
  271. //prestmt.executeUpdate();
  272. } catch (SQLException ex) {
  273. Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
  274. } catch (IndexOutOfBoundsException e) {
  275. e.printStackTrace();
  276. }
  277. }
  278.  
  279. public boolean eintraegeInDatabase(String table, String[] attributes, String[] values) throws SQLException {
  280. if (attributes.length != values.length) {
  281. return false;
  282. }
  283. String attri = "";
  284. String valu = "";
  285. for (int i = 0; i < attributes.length; i++) {
  286. attri = attri + attributes[i] + ", ";
  287. valu = valu + values[i] + "', '";
  288. }
  289. attri = attri.substring(0, attri.length() - 2);
  290. valu = valu.substring(0, valu.length() - 3);
  291. sql = "INSERT INTO " + table + "(" + attri + ") VALUES ('" + valu + ")";
  292. stmt = connection.createStatement();
  293. stmt.executeUpdate(sql);
  294. return true;
  295. }
  296.  
  297. public ArrayList<String> eintraegeVonDatabase1(String table, String attribut, String value, String where) throws SQLException {
  298. ArrayList<String> string = new ArrayList<>();
  299. if (where == null || value == null) {
  300. sql = "SELECT " + attribut + " FROM " + table + "";
  301. } else {
  302. sql = "SELECT " + attribut + " FROM " + table + " WHERE " + where + " = " + value + "";
  303. }
  304. prestmt = connection.prepareStatement(sql);
  305. result = prestmt.executeQuery();
  306. while (result.next()) {
  307. string.add(result.getString(attribut));
  308. }
  309. return string;
  310. }
  311.  
  312. public ArrayList<String> eintraegeVonDatabase2(String table, String attribut, String[] value, String[] where) throws SQLException {
  313. ArrayList<String> string = new ArrayList<>();
  314. sql = "SELECT " + attribut + " FROM " + table + " WHERE ";
  315. for (int i = 0; i < where.length; i++) {
  316. sql = sql + where[i] + " = " + value[i] + " AND ";
  317. }
  318. sql = sql.substring(0, sql.length() - 5);
  319. prestmt = connection.prepareStatement(sql);
  320. result = prestmt.executeQuery();
  321. while (result.next()) {
  322. string.add(result.getString(attribut));
  323. }
  324. return string;
  325. }
  326.  
  327. public boolean checkDatabase() {
  328. return true;
  329. }
  330.  
  331. public void startGame() throws SQLException {
  332. lobby = new Lobby(this, startmapid);
  333. }
  334.  
  335. public void itemsnewmap() {
  336. ArrayList<String> liste = new ArrayList<String>();
  337. ItemMeta[] itemsnewctcmeta = new ItemMeta[6];
  338.  
  339. itemsnewctc[1] = new ItemStack(Material.BLAZE_POWDER);
  340. itemsnewctcmeta[1] = itemsnewctc[1].getItemMeta();
  341. itemsnewctcmeta[1].setDisplayName("§3SPAWNS");
  342. liste.add("§7Click on a block");
  343. liste.add("§7to select the spawns");
  344. itemsnewctcmeta[1].setLore(liste);
  345. itemsnewctc[1].setItemMeta(itemsnewctcmeta[1]);
  346. liste.clear();
  347.  
  348. itemsnewctc[2] = new ItemStack(Material.BLAZE_ROD);
  349. itemsnewctcmeta[2] = itemsnewctc[2].getItemMeta();
  350. itemsnewctcmeta[2].setDisplayName("§6WORLDBORDER");
  351. liste.add("§7Leftclick: Position 1");
  352. liste.add("§7Rightclick: Position 2");
  353. itemsnewctcmeta[2].setLore(liste);
  354. itemsnewctc[2].setItemMeta(itemsnewctcmeta[2]);
  355. liste.clear();
  356.  
  357. itemsnewctc[3] = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 5);
  358. itemsnewctcmeta[3] = itemsnewctc[3].getItemMeta();
  359. itemsnewctcmeta[3].setDisplayName("§2FINISH");
  360. liste.add("§7Click to create the arena");
  361. itemsnewctcmeta[3].setLore(liste);
  362. itemsnewctc[3].setItemMeta(itemsnewctcmeta[3]);
  363. liste.clear();
  364.  
  365. itemsnewctc[5] = new ItemStack(Material.FURNACE);
  366. itemsnewctcmeta[5] = itemsnewctc[5].getItemMeta();
  367. itemsnewctcmeta[5].setDisplayName("§4MAPSETTINGS");
  368. liste.add("§7Click to edit the Settings");
  369. itemsnewctcmeta[5].setLore(liste);
  370. itemsnewctc[5].setItemMeta(itemsnewctcmeta[5]);
  371. liste.clear();
  372.  
  373. ItemMeta imeta;
  374. mapconfiginvnewctc = Bukkit.createInventory(null, InventoryType.FURNACE, prefix + "SETTINGS");
  375.  
  376. ItemStack[] configitemsnewctc = new ItemStack[2];
  377.  
  378. configitemsnewctc[0] = new ItemStack(Material.TOTEM);
  379. configitemsnewctc[0].setAmount(2);
  380. imeta = configitemsnewctc[0].getItemMeta();
  381. imeta.setDisplayName("§6Amount of teams");
  382. liste.add("§7Leftclick: Increase");
  383. liste.add("§7Rightclick: Decrease");
  384. imeta.setLore(liste);
  385. configitemsnewctc[0].setItemMeta(imeta);
  386. liste.clear();
  387.  
  388. SkullMeta meta = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);
  389. meta.setOwner("FistGenius");
  390. configitemsnewctc[1] = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
  391. meta.setDisplayName("§aSize of a team");
  392. liste.add("§7Leftclick: Increase");
  393. liste.add("§7Rightclick: Decrease");
  394. meta.setLore(liste);
  395. configitemsnewctc[1].setItemMeta(meta);
  396. liste.clear();
  397.  
  398. ItemStack item = new ItemStack(Material.MAP);
  399. imeta = item.getItemMeta();
  400. meta.setDisplayName("" + mapnamenewctc);
  401. item.setItemMeta(imeta);
  402.  
  403. mapconfiginvnewctc.addItem(configitemsnewctc[0]);
  404. mapconfiginvnewctc.addItem(configitemsnewctc[1]);
  405. mapconfiginvnewctc.addItem(item);
  406.  
  407. spawnsinvnewctc = Bukkit.createInventory(null, 9, prefix + "SPAWNS");
  408.  
  409. ItemStack[] spawnsitemsnewctc = new ItemStack[5];
  410.  
  411. spawnsitemsnewctc[0] = new ItemStack(Material.TOTEM);
  412. imeta = spawnsitemsnewctc[0].getItemMeta();
  413. imeta.setDisplayName("§3Teams");
  414. liste.add("§7Click and chose a team");
  415. liste.add("§7to select this block");
  416. liste.add("§7as its spawn");
  417. imeta.setLore(liste);
  418. spawnsitemsnewctc[0].setItemMeta(imeta);
  419. liste.clear();
  420.  
  421. spawnsitemsnewctc[1] = new ItemStack(Material.CLAY_BRICK);
  422. imeta = spawnsitemsnewctc[1].getItemMeta();
  423. imeta.setDisplayName("§cBronze");
  424. liste.add("§7Click to select this block");
  425. liste.add("§7as a Bronzespawner");
  426. imeta.setLore(liste);
  427. spawnsitemsnewctc[1].setItemMeta(imeta);
  428. liste.clear();
  429.  
  430. spawnsitemsnewctc[2] = new ItemStack(Material.IRON_INGOT);
  431. imeta = spawnsitemsnewctc[2].getItemMeta();
  432. imeta.setDisplayName("§7Silver");
  433. liste.add("§7Click to select this block");
  434. liste.add("§7as a Silverspawner");
  435. imeta.setLore(liste);
  436. spawnsitemsnewctc[2].setItemMeta(imeta);
  437. liste.clear();
  438.  
  439. spawnsitemsnewctc[3] = new ItemStack(Material.GOLD_INGOT);
  440. imeta = spawnsitemsnewctc[3].getItemMeta();
  441. imeta.setDisplayName("§eGold");
  442. liste.add("§7Click to select this block");
  443. liste.add("§7as a Goldspawner");
  444. imeta.setLore(liste);
  445. spawnsitemsnewctc[3].setItemMeta(imeta);
  446. liste.clear();
  447.  
  448. spawnsitemsnewctc[4] = new ItemStack(Material.COMPASS);
  449. imeta = spawnsitemsnewctc[4].getItemMeta();
  450. imeta.setDisplayName("§2Lobby");
  451. liste.add("§7Click to select this block");
  452. liste.add("§7as the Lobbyspawn");
  453. imeta.setLore(liste);
  454. spawnsitemsnewctc[4].setItemMeta(imeta);
  455. liste.clear();
  456.  
  457. for (int i = 0; i < 9; i++) {
  458. spawnsinvnewctc.setItem(i, new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7));
  459. }
  460.  
  461. spawnsinvnewctc.setItem(2, spawnsitemsnewctc[0]);
  462. spawnsinvnewctc.setItem(3, spawnsitemsnewctc[4]);
  463. spawnsinvnewctc.setItem(4, spawnsitemsnewctc[1]);
  464. spawnsinvnewctc.setItem(5, spawnsitemsnewctc[2]);
  465. spawnsinvnewctc.setItem(6, spawnsitemsnewctc[3]);
  466.  
  467. teamsinvnewctc = Bukkit.createInventory(null, 27, prefix + "TEAMS");
  468.  
  469. teamsitemsnewctc[0] = new ItemStack(Material.WOOL, 1, (short) 3);
  470. imeta = teamsitemsnewctc[0].getItemMeta();
  471. imeta.setDisplayName("§9TEAMSPAWN");
  472. liste.add("§7Click to select this block");
  473. liste.add("§7as spawn for team blue");
  474. imeta.setLore(liste);
  475. teamsitemsnewctc[0].setItemMeta(imeta);
  476. liste.clear();
  477.  
  478. teamsitemsnewctc[1] = new ItemStack(Material.WOOL, 1, (short) 14);
  479. imeta = teamsitemsnewctc[1].getItemMeta();
  480. imeta.setDisplayName("§cTEAMSPAWN");
  481. liste.add("§7Click to select this block");
  482. liste.add("§7as spawn for team red");
  483. imeta.setLore(liste);
  484. teamsitemsnewctc[1].setItemMeta(imeta);
  485. liste.clear();
  486.  
  487. teamsitemsnewctc[2] = new ItemStack(Material.WOOL, 1, (short) 5);
  488. imeta = teamsitemsnewctc[2].getItemMeta();
  489. imeta.setDisplayName("§aTEAMSPAWN");
  490. liste.add("§7Click to select this block");
  491. liste.add("§7as spawn for team green");
  492. imeta.setLore(liste);
  493. teamsitemsnewctc[2].setItemMeta(imeta);
  494. liste.clear();
  495.  
  496. teamsitemsnewctc[3] = new ItemStack(Material.WOOL, 1, (short) 4);
  497. imeta = teamsitemsnewctc[3].getItemMeta();
  498. imeta.setDisplayName("§eTEAMSPAWN");
  499. liste.add("§7Click to select this block");
  500. liste.add("§7as spawn for team yewllow");
  501. imeta.setLore(liste);
  502. teamsitemsnewctc[3].setItemMeta(imeta);
  503. liste.clear();
  504.  
  505. teamsitemsnewctc[4] = new ItemStack(Material.WOOL, 1, (short) 1);
  506. imeta = teamsitemsnewctc[4].getItemMeta();
  507. imeta.setDisplayName("§6TEAMSPAWN");
  508. liste.add("§7Click to select this block");
  509. liste.add("§7as spawn for team oragne");
  510. imeta.setLore(liste);
  511. teamsitemsnewctc[4].setItemMeta(imeta);
  512. liste.clear();
  513.  
  514. teamsitemsnewctc[5] = new ItemStack(Material.WOOL, 1, (short) 10);
  515. imeta = teamsitemsnewctc[5].getItemMeta();
  516. imeta.setDisplayName("§5TEAMSPAWN");
  517. liste.add("§7Click to select this block");
  518. liste.add("§7as spawn for team purple");
  519. imeta.setLore(liste);
  520. teamsitemsnewctc[5].setItemMeta(imeta);
  521. liste.clear();
  522.  
  523. teamsitemsnewctc[6] = new ItemStack(Material.WOOL, 1, (short) 15);
  524. imeta = teamsitemsnewctc[6].getItemMeta();
  525. imeta.setDisplayName("§8TEAMSPAWN");
  526. liste.add("§7Click to select this block");
  527. liste.add("§7as spawn for team black");
  528. imeta.setLore(liste);
  529. teamsitemsnewctc[6].setItemMeta(imeta);
  530. liste.clear();
  531.  
  532. teamsitemsnewctc[7] = new ItemStack(Material.WOOL, 1, (short) 0);
  533. imeta = teamsitemsnewctc[7].getItemMeta();
  534. imeta.setDisplayName("§fTEAMSPAWN");
  535. liste.add("§7Click to select this block");
  536. liste.add("§7as spawn for team white");
  537. imeta.setLore(liste);
  538. teamsitemsnewctc[7].setItemMeta(imeta);
  539. liste.clear();
  540.  
  541. traderitemsnewctc[0] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  542. imeta = traderitemsnewctc[0].getItemMeta();
  543. imeta.setDisplayName("§9TEAMTRADER");
  544. liste.add("§7Click to select this block");
  545. liste.add("§7as traderposition of team blue");
  546. imeta.setLore(liste);
  547. traderitemsnewctc[0].setItemMeta(imeta);
  548. liste.clear();
  549.  
  550. traderitemsnewctc[1] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  551. imeta = traderitemsnewctc[1].getItemMeta();
  552. imeta.setDisplayName("§cTEAMTRADER");
  553. liste.add("§7Click to select this block");
  554. liste.add("§7as traderposition of team red");
  555. imeta.setLore(liste);
  556. traderitemsnewctc[1].setItemMeta(imeta);
  557. liste.clear();
  558.  
  559. traderitemsnewctc[2] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  560. imeta = traderitemsnewctc[2].getItemMeta();
  561. imeta.setDisplayName("§aTEAMTRADER");
  562. liste.add("§7Click to select this block");
  563. liste.add("§7as traderposition of team green");
  564. imeta.setLore(liste);
  565. traderitemsnewctc[2].setItemMeta(imeta);
  566. liste.clear();
  567.  
  568. traderitemsnewctc[3] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  569. imeta = traderitemsnewctc[3].getItemMeta();
  570. imeta.setDisplayName("§eTEAMTRADER");
  571. liste.add("§7Click to select this block");
  572. liste.add("§7as traderposition of team yellow");
  573. imeta.setLore(liste);
  574. traderitemsnewctc[3].setItemMeta(imeta);
  575. liste.clear();
  576.  
  577. traderitemsnewctc[4] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  578. imeta = traderitemsnewctc[4].getItemMeta();
  579. imeta.setDisplayName("§6TEAMTRADER");
  580. liste.add("§7Click to select this block");
  581. liste.add("§7as traderposition of team oragne");
  582. imeta.setLore(liste);
  583. traderitemsnewctc[4].setItemMeta(imeta);
  584. liste.clear();
  585.  
  586. traderitemsnewctc[5] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  587. imeta = traderitemsnewctc[5].getItemMeta();
  588. imeta.setDisplayName("§5TEAMTRADER");
  589. liste.add("§7Click to select this block");
  590. liste.add("§7as traderposition of team purple");
  591. imeta.setLore(liste);
  592. traderitemsnewctc[5].setItemMeta(imeta);
  593. liste.clear();
  594.  
  595. traderitemsnewctc[6] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  596. imeta = traderitemsnewctc[6].getItemMeta();
  597. imeta.setDisplayName("§0TEAMTRADER");
  598. liste.add("§7Click to select this block");
  599. liste.add("§7as traderposition of team black");
  600. imeta.setLore(liste);
  601. traderitemsnewctc[6].setItemMeta(imeta);
  602. liste.clear();
  603.  
  604. traderitemsnewctc[7] = new ItemStack(new SpawnEgg(EntityType.VILLAGER).getItemType());
  605. imeta = traderitemsnewctc[7].getItemMeta();
  606. imeta.setDisplayName("§fTEAMTRADER");
  607. liste.add("§7Click to select this block");
  608. liste.add("§7as traderposition of team white");
  609. imeta.setLore(liste);
  610. traderitemsnewctc[7].setItemMeta(imeta);
  611. liste.clear();
  612.  
  613. crystalitemsnewctc[0] = new ItemStack(Material.END_CRYSTAL);
  614. imeta = crystalitemsnewctc[0].getItemMeta();
  615. imeta.setDisplayName("§9TEAMCRYSTAL");
  616. liste.add("§7Click to select this block");
  617. liste.add("§7as crystalposition of team blue");
  618. imeta.setLore(liste);
  619. crystalitemsnewctc[0].setItemMeta(imeta);
  620. liste.clear();
  621.  
  622. crystalitemsnewctc[1] = new ItemStack(Material.END_CRYSTAL);
  623. imeta = crystalitemsnewctc[1].getItemMeta();
  624. imeta.setDisplayName("§cTEAMCRYSTAL");
  625. liste.add("§7Click to select this block");
  626. liste.add("§7as crystalposition of team red");
  627. imeta.setLore(liste);
  628. crystalitemsnewctc[1].setItemMeta(imeta);
  629. liste.clear();
  630.  
  631. crystalitemsnewctc[2] = new ItemStack(Material.END_CRYSTAL);
  632. imeta = crystalitemsnewctc[2].getItemMeta();
  633. imeta.setDisplayName("§aTEAMCRYSTAL");
  634. liste.add("§7Click to select this block");
  635. liste.add("§7as crystalposition of team green");
  636. imeta.setLore(liste);
  637. crystalitemsnewctc[2].setItemMeta(imeta);
  638. liste.clear();
  639.  
  640. crystalitemsnewctc[3] = new ItemStack(Material.END_CRYSTAL);
  641. imeta = crystalitemsnewctc[3].getItemMeta();
  642. imeta.setDisplayName("§eTEAMCRYSTAL");
  643. liste.add("§7Click to select this block");
  644. liste.add("§7as crystalposition of team yellow");
  645. imeta.setLore(liste);
  646. crystalitemsnewctc[3].setItemMeta(imeta);
  647. liste.clear();
  648.  
  649. crystalitemsnewctc[4] = new ItemStack(Material.END_CRYSTAL);
  650. imeta = crystalitemsnewctc[4].getItemMeta();
  651. imeta.setDisplayName("§6TEAMCRYSTAL");
  652. liste.add("§7Click to select this block");
  653. liste.add("§7as crystalposition of team oragne");
  654. imeta.setLore(liste);
  655. crystalitemsnewctc[4].setItemMeta(imeta);
  656. liste.clear();
  657.  
  658. crystalitemsnewctc[5] = new ItemStack(Material.END_CRYSTAL);
  659. imeta = crystalitemsnewctc[5].getItemMeta();
  660. imeta.setDisplayName("§5TEAMCRYSTAL");
  661. liste.add("§7Click to select this block");
  662. liste.add("§7as crystalposition of team purple");
  663. imeta.setLore(liste);
  664. crystalitemsnewctc[5].setItemMeta(imeta);
  665. liste.clear();
  666.  
  667. crystalitemsnewctc[6] = new ItemStack(Material.END_CRYSTAL);
  668. imeta = crystalitemsnewctc[6].getItemMeta();
  669. imeta.setDisplayName("§0TEAMCRYSTAL");
  670. liste.add("§7Click to select this block");
  671. liste.add("§7as crystalposition of team black");
  672. imeta.setLore(liste);
  673. crystalitemsnewctc[6].setItemMeta(imeta);
  674. liste.clear();
  675.  
  676. crystalitemsnewctc[7] = new ItemStack(Material.END_CRYSTAL);
  677. imeta = crystalitemsnewctc[7].getItemMeta();
  678. imeta.setDisplayName("§fTEAMCRYSTAL");
  679. liste.add("§7Click to select this block");
  680. liste.add("§7as crystalposition of team white");
  681. imeta.setLore(liste);
  682. crystalitemsnewctc[7].setItemMeta(imeta);
  683. liste.clear();
  684. }
  685.  
  686. public void itemsnewarena() {
  687. ArrayList<String> liste = new ArrayList<String>();
  688. ItemMeta[] itemsnewctcmeta = new ItemMeta[5];
  689.  
  690. itemsnewctc[0] = new ItemStack(Material.BREWING_STAND_ITEM);
  691. itemsnewctcmeta[0] = itemsnewctc[0].getItemMeta();
  692. itemsnewctcmeta[0].setDisplayName("§4ARENASETTINGS");
  693. liste.add("§7Click to edit the Settings");
  694. itemsnewctcmeta[0].setLore(liste);
  695. itemsnewctc[0].setItemMeta(itemsnewctcmeta[0]);
  696. liste.clear();
  697.  
  698. itemsnewctc[4] = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 5);
  699. itemsnewctcmeta[4] = itemsnewctc[4].getItemMeta();
  700. itemsnewctcmeta[4].setDisplayName("§2FINISH ARENA");
  701. liste.add("§7Click to create the arena");
  702. itemsnewctcmeta[4].setLore(liste);
  703. itemsnewctc[4].setItemMeta(itemsnewctcmeta[4]);
  704. liste.clear();
  705.  
  706. arenaconfiginvnewctc = Bukkit.createInventory(null, InventoryType.BREWING, prefix + "SETTINGS");
  707. ItemStack[] configitemsnewctc = new ItemStack[5];
  708. ItemMeta imeta;
  709.  
  710. configitemsnewctc[0] = new ItemStack(Material.TOTEM);
  711. configitemsnewctc[0].setAmount(2);
  712. imeta = configitemsnewctc[0].getItemMeta();
  713. imeta.setDisplayName("§6Amount of teams");
  714. liste.add("§7Leftclick: Increase");
  715. liste.add("§7Rightclick: Decrease");
  716. imeta.setLore(liste);
  717. configitemsnewctc[0].setItemMeta(imeta);
  718. liste.clear();
  719.  
  720. SkullMeta meta = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);
  721. meta.setOwner("FistGenius");
  722. configitemsnewctc[1] = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
  723. meta.setDisplayName("§aSize of a team");
  724. liste.add("§7Leftclick: Increase");
  725. liste.add("§7Rightclick: Decrease");
  726. meta.setLore(liste);
  727. configitemsnewctc[1].setItemMeta(meta);
  728. liste.clear();
  729.  
  730. configitemsnewctc[2] = new ItemStack(Material.WATCH);
  731. configitemsnewctc[2].setAmount(5);
  732. imeta = configitemsnewctc[2].getItemMeta();
  733. imeta.setDisplayName("§cTimelimit in minutes");
  734. liste.add("§7Leftclick: +1");
  735. liste.add("§7Rightclick: -1");
  736. liste.add("§7Shift + Leftclick: +5");
  737. liste.add("§7Shift + Rightclick: -5");
  738. liste.add("§7Middleclick: no timelimit");
  739. imeta.setLore(liste);
  740. configitemsnewctc[2].setItemMeta(imeta);
  741. liste.clear();
  742.  
  743. configitemsnewctc[3] = new ItemStack(Material.BANNER);
  744. imeta = configitemsnewctc[3].getItemMeta();
  745. imeta.setDisplayName("§3Capturepoints");
  746. liste.add("§7Leftclick: Increase");
  747. liste.add("§7Rightclick: Decrease");
  748. imeta.setLore(liste);
  749. configitemsnewctc[3].setItemMeta(imeta);
  750. liste.clear();
  751.  
  752. configitemsnewctc[4] = new ItemStack(Material.MAP);
  753. imeta = configitemsnewctc[4].getItemMeta();
  754. imeta.setDisplayName("§9Map: " + worldlistnewctc.get(0));
  755. liste.add("§7Leftclick: Next");
  756. liste.add("§7Rightclick: Last");
  757. imeta.setLore(liste);
  758. configitemsnewctc[4].setItemMeta(imeta);
  759. liste.clear();
  760.  
  761. for (int i = 0; i < 5; i++) {
  762. arenaconfiginvnewctc.addItem(configitemsnewctc[i]);
  763. }
  764. listener.maprefresh();
  765. }
  766. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement