Kit GUI - Commands sending twice

Discussion in 'Plugin Development' started by Keyboard, Mar 24, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Keyboard

    Main file:
    http://pastebin.com/G8C7vdUf
    I've messed around with this a lot and the messages send twice, this is my kitgui file
    Code:java
    1. package com.gmail.MeteorCraft.main;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandExecutor;
    11. import org.bukkit.command.CommandSender;
    12. import org.bukkit.entity.Player;
    13. import org.bukkit.event.EventHandler;
    14. import org.bukkit.event.Listener;
    15. import org.bukkit.event.inventory.InventoryClickEvent;
    16. import org.bukkit.inventory.Inventory;
    17. import org.bukkit.inventory.ItemStack;
    18. import org.bukkit.inventory.meta.ItemMeta;
    19.  
    20. public class KitGUI implements Listener, CommandExecutor {
    21.  
    22. public static Inventory paper = Bukkit.createInventory(null, 54,
    23. ChatColor.LIGHT_PURPLE + "Hardcore Kits selection");
    24.  
    25. public boolean onCommand(CommandSender sender, Command cmd, String label,
    26. String[] args) {
    27. final Player p = (Player) sender;
    28. if (cmd.getName().equalsIgnoreCase("kits")) {
    29. ItemStack slot0 = new ItemStack(Material.CARPET, 1);
    30. ItemStack slot1 = new ItemStack(Material.THIN_GLASS, 1);
    31. ItemStack slot2 = new ItemStack(Material.THIN_GLASS, 1);
    32. ItemStack slot3 = new ItemStack(Material.THIN_GLASS, 1);
    33. ItemStack slot4 = new ItemStack(Material.SULPHUR, 1);
    34. ItemStack slot5 = new ItemStack(Material.THIN_GLASS, 1);
    35. ItemStack slot6 = new ItemStack(Material.THIN_GLASS, 1);
    36. ItemStack slot7 = new ItemStack(Material.THIN_GLASS, 1);
    37. ItemStack slot8 = new ItemStack(Material.CARPET, 1);
    38. ItemStack slot9 = new ItemStack(Material.BOW, 1);
    39. ItemStack slot10 = new ItemStack(Material.FISHING_ROD, 1);
    40. ItemStack slot11 = new ItemStack(Material.STICK, 1);
    41. ItemStack slot12 = new ItemStack(Material.FIREWORK, 1);
    42. ItemStack slot13 = new ItemStack(Material.BLAZE_ROD, 1);
    43. ItemStack slot14 = new ItemStack(Material.FEATHER, 1);
    44. ItemStack slot15 = new ItemStack(Material.WATER, 1);
    45. ItemStack slot16 = new ItemStack(Material.WEB, 1);
    46. ItemStack slot17 = new ItemStack(Material.REDSTONE, 1);
    47. ItemStack slot18 = new ItemStack(Material.IRON_BOOTS, 1);
    48. ItemStack slot19 = new ItemStack(Material.SNOW_BALL, 1);
    49. ItemStack slot20 = new ItemStack(Material.WOOD_AXE, 1);
    50. ItemStack slot21 = new ItemStack(Material.SPIDER_EYE, 1);
    51. ItemStack slot22 = new ItemStack(Material.SADDLE, 1);
    52. ItemStack slot23 = new ItemStack(Material.SAND, 1);
    53. ItemStack slot24 = new ItemStack(Material.THIN_GLASS, 1);
    54. ItemStack slot25 = new ItemStack(Material.THIN_GLASS, 1);
    55. ItemStack slot26 = new ItemStack(Material.THIN_GLASS, 1);
    56. ItemStack slot27 = new ItemStack(Material.THIN_GLASS, 1);
    57. ItemStack slot28 = new ItemStack(Material.THIN_GLASS, 1);
    58. ItemStack slot29 = new ItemStack(Material.THIN_GLASS, 1);
    59. ItemStack slot30 = new ItemStack(Material.THIN_GLASS, 1);
    60. ItemStack slot31 = new ItemStack(Material.THIN_GLASS, 1);
    61. ItemStack slot32 = new ItemStack(Material.THIN_GLASS, 1);
    62. ItemStack slot33 = new ItemStack(Material.THIN_GLASS, 1);
    63. ItemStack slot34 = new ItemStack(Material.THIN_GLASS, 1);
    64. ItemStack slot35 = new ItemStack(Material.THIN_GLASS, 1);
    65. ItemStack slot36 = new ItemStack(Material.THIN_GLASS, 1);
    66. ItemStack slot37 = new ItemStack(Material.THIN_GLASS, 1);
    67. ItemStack slot38 = new ItemStack(Material.THIN_GLASS, 1);
    68. ItemStack slot39 = new ItemStack(Material.THIN_GLASS, 1);
    69. ItemStack slot40 = new ItemStack(Material.THIN_GLASS, 1);
    70. ItemStack slot41 = new ItemStack(Material.THIN_GLASS, 1);
    71. ItemStack slot42 = new ItemStack(Material.THIN_GLASS, 1);
    72. ItemStack slot43 = new ItemStack(Material.THIN_GLASS, 1);
    73. ItemStack slot44 = new ItemStack(Material.THIN_GLASS, 1);
    74. ItemStack slot45 = new ItemStack(Material.THIN_GLASS, 1);
    75. ItemStack slot46 = new ItemStack(Material.THIN_GLASS, 1);
    76. ItemStack slot47 = new ItemStack(Material.THIN_GLASS, 1);
    77. ItemStack slot48 = new ItemStack(Material.THIN_GLASS, 1);
    78. ItemStack slot49 = new ItemStack(Material.THIN_GLASS, 1);
    79. ItemStack slot50 = new ItemStack(Material.THIN_GLASS, 1);
    80. ItemStack slot51 = new ItemStack(Material.THIN_GLASS, 1);
    81. ItemStack slot52 = new ItemStack(Material.THIN_GLASS, 1);
    82. ItemStack slot53 = new ItemStack(Material.THIN_GLASS, 1);
    83. p.openInventory(paper);
    84. ItemMeta meta0 = slot0.getItemMeta();
    85. ItemMeta meta1 = slot1.getItemMeta();
    86. ItemMeta meta2 = slot2.getItemMeta();
    87. ItemMeta meta3 = slot3.getItemMeta();
    88. ItemMeta meta4 = slot4.getItemMeta();
    89. ItemMeta meta5 = slot5.getItemMeta();
    90. ItemMeta meta6 = slot6.getItemMeta();
    91. ItemMeta meta7 = slot7.getItemMeta();
    92. ItemMeta meta8 = slot8.getItemMeta();
    93. ItemMeta meta9 = slot9.getItemMeta();
    94. ItemMeta meta10 = slot10.getItemMeta();
    95. ItemMeta meta11 = slot11.getItemMeta();
    96. ItemMeta meta12 = slot12.getItemMeta();
    97. ItemMeta meta13 = slot13.getItemMeta();
    98. ItemMeta meta14 = slot14.getItemMeta();
    99. ItemMeta meta15 = slot15.getItemMeta();
    100. ItemMeta meta16 = slot15.getItemMeta();
    101. ItemMeta meta17 = slot17.getItemMeta();
    102. ItemMeta meta18 = slot18.getItemMeta();
    103. ItemMeta meta19 = slot19.getItemMeta();
    104. ItemMeta meta20 = slot20.getItemMeta();
    105. ItemMeta meta21 = slot21.getItemMeta();
    106. ItemMeta meta22 = slot22.getItemMeta();
    107. ItemMeta meta23 = slot23.getItemMeta();
    108. ItemMeta meta24 = slot24.getItemMeta();
    109. ItemMeta meta25 = slot25.getItemMeta();
    110. ItemMeta meta26 = slot26.getItemMeta();
    111. ItemMeta meta27 = slot27.getItemMeta();
    112. ItemMeta meta28 = slot28.getItemMeta();
    113. ItemMeta meta29 = slot29.getItemMeta();
    114. ItemMeta meta30 = slot30.getItemMeta();
    115. ItemMeta meta31 = slot31.getItemMeta();
    116. ItemMeta meta32 = slot32.getItemMeta();
    117. ItemMeta meta33 = slot33.getItemMeta();
    118. ItemMeta meta34 = slot34.getItemMeta();
    119. ItemMeta meta35 = slot35.getItemMeta();
    120. ItemMeta meta36 = slot36.getItemMeta();
    121. ItemMeta meta37 = slot37.getItemMeta();
    122. ItemMeta meta38 = slot38.getItemMeta();
    123. ItemMeta meta39 = slot39.getItemMeta();
    124. ItemMeta meta40 = slot40.getItemMeta();
    125. ItemMeta meta41 = slot41.getItemMeta();
    126. ItemMeta meta42 = slot42.getItemMeta();
    127. ItemMeta meta43 = slot43.getItemMeta();
    128. ItemMeta meta44 = slot44.getItemMeta();
    129. ItemMeta meta45 = slot45.getItemMeta();
    130. ItemMeta meta46 = slot46.getItemMeta();
    131. ItemMeta meta47 = slot47.getItemMeta();
    132. ItemMeta meta48 = slot48.getItemMeta();
    133. ItemMeta meta49 = slot49.getItemMeta();
    134. ItemMeta meta50 = slot50.getItemMeta();
    135. ItemMeta meta51 = slot51.getItemMeta();
    136. ItemMeta meta52 = slot52.getItemMeta();
    137. ItemMeta meta53 = slot53.getItemMeta();
    138. meta0.setDisplayName(" ");
    139. meta1.setDisplayName(" ");
    140. meta2.setDisplayName(" ");
    141. meta3.setDisplayName(" ");
    142. meta4.setDisplayName(" ");
    143. meta5.setDisplayName(" ");
    144. meta6.setDisplayName(" ");
    145. meta7.setDisplayName(" ");
    146. meta8.setDisplayName(ChatColor.GREEN + "Next Page -->");
    147. if (p.hasPermission("hkits.kit.Archer"))
    148. meta9.setDisplayName(ChatColor.GREEN + "Archer");
    149. else
    150. meta9.setDisplayName(ChatColor.RED + "Archer");
    151. if (p.hasPermission("hkits.kit.Fisherman"))
    152.  
    153. meta10.setDisplayName(ChatColor.GREEN + "Fisherman");
    154. else
    155. meta10.setDisplayName(ChatColor.RED + "Fisherman");
    156.  
    157. if (p.hasPermission("hkits.kit.Grandpa"))
    158. meta11.setDisplayName(ChatColor.GREEN + "Grandpa");
    159. else
    160. meta11.setDisplayName(ChatColor.RED + "Grandpa");
    161.  
    162. if (p.hasPermission("hkits.kit.Kangaroo"))
    163. meta12.setDisplayName(ChatColor.GREEN + "Kangaroo");
    164. else
    165. meta12.setDisplayName(ChatColor.RED + "Kangaroo");
    166.  
    167. if (p.hasPermission("hkits.kit.Monk"))
    168. meta13.setDisplayName(ChatColor.GREEN + "Monk");
    169. else
    170. meta13.setDisplayName(ChatColor.RED + "Monk");
    171. if (p.hasPermission("hkits.kit.Phantom"))
    172. meta14.setDisplayName(ChatColor.GREEN + "Phantom");
    173. else
    174. meta14.setDisplayName(ChatColor.RED + "Phantom");
    175.  
    176. if (p.hasPermission("hkits.kit.Poseidon"))
    177. meta15.setDisplayName(ChatColor.GREEN + "Poseidon");
    178. else
    179. meta15.setDisplayName(ChatColor.RED + "Poseidon");
    180.  
    181. if (p.hasPermission("hkits.kit.Snail"))
    182. meta16.setDisplayName(ChatColor.GREEN + "Snail");
    183. else
    184. meta16.setDisplayName(ChatColor.RED + "Snail");
    185. if (p.hasPermission("hkits.kit.Spectre"))
    186. meta17.setDisplayName(ChatColor.GREEN + "Spectre");
    187. else
    188. meta17.setDisplayName(ChatColor.RED + "Spectre");
    189. if (p.hasPermission("hkits.kit.Stomper"))
    190. meta18.setDisplayName(ChatColor.GREEN + "Stomper");
    191. else
    192. meta18.setDisplayName(ChatColor.RED + "Stomper");
    193. if (p.hasPermission("hkits.kit.Switcher"))
    194. meta19.setDisplayName(ChatColor.GREEN + "Switcher");
    195. else
    196. meta19.setDisplayName(ChatColor.RED + "Switcher");
    197. if (p.hasPermission("hkits.kit.Thor"))
    198. meta20.setDisplayName(ChatColor.GREEN + "Thor");
    199. else
    200. meta20.setDisplayName(ChatColor.RED + "Thor");
    201. if (p.hasPermission("hkits.kit.Viper"))
    202. meta21.setDisplayName(ChatColor.GREEN + "Viper");
    203. else
    204. meta21.setDisplayName(ChatColor.RED + "Viper");
    205. if (p.hasPermission("hkits.kit.Rider"))
    206. meta22.setDisplayName(ChatColor.GREEN + "Rider");
    207. else
    208. meta22.setDisplayName(ChatColor.RED + "Rider");
    209. if (p.hasPermission("hkits.kit.Camel"))
    210. meta23.setDisplayName(ChatColor.GREEN + "Camel");
    211. else
    212. meta23.setDisplayName(ChatColor.RED + "Camel");
    213. meta24.setDisplayName(" ");
    214. meta25.setDisplayName(" ");
    215. meta26.setDisplayName(" ");
    216. meta27.setDisplayName(" ");
    217. meta28.setDisplayName(" ");
    218. meta29.setDisplayName(" ");
    219. meta30.setDisplayName(" ");
    220. meta31.setDisplayName(" ");
    221. meta32.setDisplayName(" ");
    222. meta33.setDisplayName(" ");
    223. meta34.setDisplayName(" ");
    224. meta35.setDisplayName(" ");
    225. meta36.setDisplayName(" ");
    226. meta37.setDisplayName(" ");
    227. meta38.setDisplayName(" ");
    228. meta39.setDisplayName(" ");
    229. meta40.setDisplayName(" ");
    230. meta41.setDisplayName(" ");
    231. meta42.setDisplayName(" ");
    232. meta43.setDisplayName(" ");
    233. meta44.setDisplayName(" ");
    234. meta45.setDisplayName(" ");
    235. meta46.setDisplayName(" ");
    236. meta47.setDisplayName(" ");
    237. meta48.setDisplayName(" ");
    238. meta49.setDisplayName(" ");
    239. meta50.setDisplayName(" ");
    240. meta51.setDisplayName(" ");
    241. meta52.setDisplayName(" ");
    242. meta53.setDisplayName(" ");
    243. List<String> lore9 = new ArrayList<String>();
    244. lore9.add(ChatColor.WHITE
    245. + "Start with a bow and 10 arrows and make");
    246. lore9.add(ChatColor.WHITE + "arrows easily");
    247. meta9.setLore(lore9);
    248.  
    249. List<String> lore10 = new ArrayList<String>();
    250. lore10.add(ChatColor.WHITE
    251. + "Start the game with a fishing rod that");
    252. lore10.add(ChatColor.WHITE + "can reel in players");
    253. meta10.setLore(lore10);
    254.  
    255. List<String> lore13 = new ArrayList<String>();
    256. lore13.add(ChatColor.WHITE
    257. + "Switch a players item from their hand");
    258. lore13.add(ChatColor.WHITE + "by right clicking the rod");
    259. meta13.setLore(lore13);
    260.  
    261. List<String> lore13l = new ArrayList<String>();
    262. lore13l.add(ChatColor.WHITE + "Start with a ");
    263. lore13l.add(ChatColor.WHITE + "knockback II stick");
    264. meta11.setLore(lore13l);
    265.  
    266. List<String> lore12 = new ArrayList<String>();
    267. lore12.add(ChatColor.WHITE + "Use your powerful rocket that ");
    268. lore12.add(ChatColor.WHITE + "enables you to double-jump");
    269. meta12.setLore(lore12);
    270.  
    271. List<String> lore14 = new ArrayList<String>();
    272. lore14.add(ChatColor.WHITE + "Use a feather to gain");
    273. lore14.add(ChatColor.WHITE + "a temporary flight ability");
    274. meta14.setLore(lore14);
    275.  
    276. List<String> lore15 = new ArrayList<String>();
    277. lore15.add(ChatColor.WHITE + "Become stronger in water");
    278. lore15.add(ChatColor.WHITE + "with a boost of strength");
    279. meta15.setLore(lore15);
    280.  
    281. List<String> lore16 = new ArrayList<String>();
    282. lore16.add(ChatColor.WHITE
    283. + "Do damage to others and have a 1 in 3");
    284. lore16.add(ChatColor.WHITE + "chance to give them slowness II");
    285. meta16.setLore(lore16);
    286. List<String> lore17 = new ArrayList<String>();
    287. lore17.add(ChatColor.WHITE + "Turn invisible to");
    288. lore17.add(ChatColor.WHITE + "surprise your enemies");
    289. meta17.setLore(lore17);
    290. List<String> lore18 = new ArrayList<String>();
    291. lore18.add(ChatColor.WHITE + "Jump down from higher places to");
    292. lore18.add(ChatColor.WHITE + " do massive damage to other players");
    293. meta18.setLore(lore18);
    294. List<String> lore19 = new ArrayList<String>();
    295. lore19.add(ChatColor.WHITE + "Throw a switcher ball at someone ");
    296. lore19.add(ChatColor.WHITE + "to switch places with them");
    297. meta19.setLore(lore19);
    298. List<String> lore20 = new ArrayList<String>();
    299. lore20.add(ChatColor.WHITE + "Call down lightning ");
    300. lore20.add(ChatColor.WHITE + "with your mighty axe");
    301. meta20.setLore(lore20);
    302. List<String> lore21 = new ArrayList<String>();
    303. lore21.add(ChatColor.WHITE
    304. + "Do damage to others and have a 1 in 3");
    305. lore21.add(ChatColor.WHITE + "chance to give them poison II");
    306. meta21.setLore(lore21);
    307. List<String> lore22 = new ArrayList<String>();
    308. lore22.add(ChatColor.WHITE
    309. + "Start with a pony");
    310. lore22.add(ChatColor.WHITE + " that you can ride");
    311. meta22.setLore(lore22);
    312. List<String> lore23 = new ArrayList<String>();
    313. lore23.add(ChatColor.WHITE
    314. + "The desert is your home");
    315. lore23.add(ChatColor.WHITE + " giving you an edge in deserts.");
    316. meta23.setLore(lore23);
    317. slot0.setItemMeta(meta0);
    318. slot1.setItemMeta(meta1);
    319. slot2.setItemMeta(meta2);
    320. slot3.setItemMeta(meta3);
    321. slot4.setItemMeta(meta4);
    322. slot5.setItemMeta(meta5);
    323. slot6.setItemMeta(meta6);
    324. slot7.setItemMeta(meta7);
    325. slot8.setItemMeta(meta8);
    326. slot9.setItemMeta(meta9);
    327. slot10.setItemMeta(meta10);
    328. slot11.setItemMeta(meta11);
    329. slot12.setItemMeta(meta12);
    330. slot13.setItemMeta(meta13);
    331. slot14.setItemMeta(meta14);
    332. slot15.setItemMeta(meta15);
    333. slot16.setItemMeta(meta16);
    334. slot17.setItemMeta(meta17);
    335. slot18.setItemMeta(meta18);
    336. slot19.setItemMeta(meta19);
    337. slot20.setItemMeta(meta20);
    338. slot21.setItemMeta(meta21);
    339. slot22.setItemMeta(meta22);
    340. slot23.setItemMeta(meta23);
    341. slot24.setItemMeta(meta24);
    342. slot25.setItemMeta(meta25);
    343. slot26.setItemMeta(meta26);
    344. slot27.setItemMeta(meta27);
    345. slot28.setItemMeta(meta28);
    346. slot29.setItemMeta(meta29);
    347. slot30.setItemMeta(meta30);
    348. slot31.setItemMeta(meta31);
    349. slot32.setItemMeta(meta32);
    350. slot33.setItemMeta(meta33);
    351. slot34.setItemMeta(meta34);
    352. slot35.setItemMeta(meta35);
    353. slot36.setItemMeta(meta36);
    354. slot37.setItemMeta(meta37);
    355. slot38.setItemMeta(meta26);
    356. slot39.setItemMeta(meta27);
    357. slot40.setItemMeta(meta40);
    358. slot41.setItemMeta(meta41);
    359. slot42.setItemMeta(meta42);
    360. slot43.setItemMeta(meta43);
    361. slot44.setItemMeta(meta44);
    362. slot45.setItemMeta(meta45);
    363. slot46.setItemMeta(meta46);
    364. slot47.setItemMeta(meta47);
    365. slot48.setItemMeta(meta48);
    366. slot49.setItemMeta(meta49);
    367. slot50.setItemMeta(meta50);
    368. slot51.setItemMeta(meta51);
    369. slot52.setItemMeta(meta52);
    370. slot53.setItemMeta(meta53);
    371.  
    372. paper.setItem(0, slot0);
    373. paper.setItem(1, slot1);
    374. paper.setItem(2, slot2);
    375. paper.setItem(3, slot3);
    376. paper.setItem(4, slot4);
    377. paper.setItem(5, slot5);
    378. paper.setItem(6, slot6);
    379. paper.setItem(7, slot7);
    380. paper.setItem(8, slot8);
    381. paper.setItem(9, slot9);
    382. paper.setItem(10, slot10);
    383. paper.setItem(11, slot11);
    384. paper.setItem(12, slot12);
    385. paper.setItem(13, slot13);
    386. paper.setItem(14, slot14);
    387. paper.setItem(15, slot15);
    388. paper.setItem(16, slot16);
    389. paper.setItem(17, slot17);
    390. paper.setItem(18, slot18);
    391. paper.setItem(19, slot19);
    392. paper.setItem(20, slot20);
    393. paper.setItem(21, slot21);
    394. paper.setItem(22, slot22);
    395. paper.setItem(23, slot23);
    396. paper.setItem(24, slot24);
    397. paper.setItem(25, slot25);
    398. paper.setItem(26, slot26);
    399. paper.setItem(27, slot27);
    400. paper.setItem(28, slot28);
    401. paper.setItem(29, slot29);
    402. paper.setItem(30, slot30);
    403. paper.setItem(31, slot31);
    404. paper.setItem(32, slot32);
    405. paper.setItem(33, slot33);
    406. paper.setItem(34, slot34);
    407. paper.setItem(35, slot35);
    408. paper.setItem(36, slot36);
    409. paper.setItem(37, slot37);
    410. paper.setItem(38, slot38);
    411. paper.setItem(39, slot39);
    412. paper.setItem(40, slot40);
    413. paper.setItem(41, slot41);
    414. paper.setItem(42, slot42);
    415. paper.setItem(43, slot43);
    416. paper.setItem(44, slot44);
    417. paper.setItem(45, slot45);
    418. paper.setItem(46, slot46);
    419. paper.setItem(47, slot47);
    420. paper.setItem(48, slot48);
    421. paper.setItem(49, slot49);
    422. paper.setItem(50, slot50);
    423. paper.setItem(51, slot51);
    424. paper.setItem(52, slot52);
    425. paper.setItem(53, slot53);
    426. }
    427.  
    428. return false;
    429.  
    430. }
    431. @EventHandler
    432. public void onInventoryClick(InventoryClickEvent ev){
    433. Player player = (Player) ev.getWhoClicked();
    434. ItemStack clicked = ev.getCurrentItem();
    435. Inventory inventory = ev.getInventory();
    436. if (inventory.getName().equals(paper.getName()))
    437. if (clicked.getType() == Material.THIN_GLASS) {
    438. if (ev.isShiftClick())
    439. ;
    440. ev.setCancelled(true);
    441. player.updateInventory();
    442. }
    443. if (inventory.getName().equals(paper.getName()))
    444. if (clicked.getType() == Material.SULPHUR) {
    445. if (ev.isShiftClick());
    446. ev.setCancelled(true);
    447. player.updateInventory();
    448. player.closeInventory();
    449. }
    450. if (inventory.getName().equals(paper.getName()))
    451. if (ev.getSlot() == 20) {
    452. player.performCommand("viper");
    453. if (ev.isShiftClick());
    454. ev.setCancelled(true);
    455. player.updateInventory();
    456. player.closeInventory();
    457. }
    458. if (inventory.getName().equals(paper.getName()))
    459. if (ev.getSlot() == 14) {
    460. player.performCommand("phantom");
    461. if (ev.isShiftClick());
    462. ev.setCancelled(true);
    463. player.updateInventory();
    464. player.closeInventory();
    465. }
    466. if (inventory.getName().equals(paper.getName()))
    467. if (ev.getSlot() == 16 ) {
    468. player.performCommand("snail");
    469. if (ev.isShiftClick());
    470. ev.setCancelled(true);
    471. player.updateInventory();
    472. player.closeInventory();
    473. }
    474. if (inventory.getName().equals(paper.getName()))
    475. if (ev.getSlot() == 17) {
    476. player.performCommand("spectre");
    477. if (ev.isShiftClick());
    478. ev.setCancelled(true);
    479. player.updateInventory();
    480. player.closeInventory();
    481. }
    482. if (inventory.getName().equals(paper.getName()))
    483. if (ev.getSlot() == 18) {
    484. player.performCommand("stomper");
    485. if (ev.isShiftClick());
    486. ev.setCancelled(true);
    487. player.updateInventory();
    488. player.closeInventory();
    489. }
    490. if (inventory.getName().equals(paper.getName()))
    491. if (ev.getSlot() == 19) {
    492. player.performCommand("switcher");
    493. if (ev.isShiftClick());
    494. ev.setCancelled(true);
    495. player.updateInventory();
    496. player.closeInventory();
    497. }
    498. if (inventory.getName().equals(paper.getName()))
    499. if (ev.getSlot() == 10) {
    500. player.performCommand("fisherman");
    501. if (ev.isShiftClick());
    502. ev.setCancelled(true);
    503. player.updateInventory();
    504. player.closeInventory();
    505. }
    506. if (inventory.getName().equals(paper.getName()))
    507. if (clicked.getType() == Material.WATER) {
    508. player.performCommand("poseidon");
    509. if (ev.isShiftClick());
    510. ev.setCancelled(true);
    511. player.updateInventory();
    512. player.closeInventory();
    513. }
    514. if (inventory.getName().equals(paper.getName()))
    515. if (ev.getSlot() == 19) {
    516. player.performCommand("thor");
    517. if (ev.isShiftClick());
    518. ev.setCancelled(true);
    519. player.updateInventory();
    520. player.closeInventory();
    521. }
    522. if (inventory.getName().equals(paper.getName()))
    523. if (clicked.getType() == Material.SPIDER_EYE) {
    524. player.performCommand("Viper");
    525. if (ev.isShiftClick());
    526. ev.setCancelled(true);
    527. player.closeInventory();
    528. }
    529. if (inventory.getName().equals(paper.getName()))
    530. if (ev.getSlot() == 9) {
    531. player.closeInventory();
    532. player.performCommand("archer");
    533. if (ev.isShiftClick());
    534. ev.setCancelled(true);
    535.  
    536. }
    537. if (inventory.getName().equals(paper.getName()))
    538. if (clicked.getType() == Material.CARPET) {
    539. if (ev.isShiftClick());
    540. ev.setCancelled(true);
    541. player.updateInventory();
    542. player.closeInventory();
    543. }
    544. if (inventory.getName().equals(paper.getName()))
    545. if (ev.getSlot() == 11) {
    546. player.performCommand("Grandpa");
    547. if (ev.isShiftClick());
    548. ev.setCancelled(true);
    549. player.updateInventory();
    550. player.closeInventory();
    551. }
    552. if (inventory.getName().equals(paper.getName()))
    553. if (ev.getSlot() == 12) {
    554. player.performCommand("kangaroo");
    555. if (ev.isShiftClick());
    556. ev.setCancelled(true);
    557. player.updateInventory();
    558. player.closeInventory();
    559. }
    560. if (inventory.getName().equals(paper.getName()))
    561. if (ev.getSlot() == 21) {
    562. player.performCommand("rider");
    563. if (ev.isShiftClick());
    564. ev.setCancelled(true);
    565. player.updateInventory();
    566. player.closeInventory();
    567. }
    568. if (inventory.getName().equals(paper.getName()))
    569. if (ev.getSlot() == 22) {
    570. player.performCommand("camel");
    571. if (ev.isShiftClick());
    572. ev.setCancelled(true);
    573. player.updateInventory();
    574. player.closeInventory();
    575. }
    576.  
    577. }
    578. }
    579. any ideas?
     
  2. Offline

    Venexor

    Keyboard
    I don't have a solution to your problem partly because all of your code is shoved into one class. I suggest you use multiple classes if there are certain tasks you are repeating like in your code above. I don't think anyone would be able to help you if you put about 600 lines of code all mashed up like that.
     
  3. Offline

    Keyboard

    Yeah, it is a bit messy lol
     
  4. Offline

    Botifier

    whats the error?
     
  5. Offline

    amhokies

    Keyboard
    You registered the listener twice. Once on line 112, and again on line 147.
     
    Keyboard likes this.
  6. Offline

    AoH_Ruthless

    Keyboard
    You really should clean that code up!
     
  7. Offline

    amhokies

    This as well. Repetitive things can be made into methods to make your life easier.
     
  8. Offline

    d3v1n302418

    Keyboard First off, what is the objective of if(evt.isShiftClick()); thats not doing anything, and you should perform the command after closing the inventory. You also don't need p.updateInventory() there...
     
  9. Offline

    Keyboard

    +1 thanks
     
Thread Status:
Not open for further replies.

Share This Page