Guest User

Untitled

a guest
Dec 29th, 2016
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.10 KB | None | 0 0
  1. package me.sirapathy;
  2.  
  3. import me.sirapathy.Events.OutfitEffects;
  4. import me.sirapathy.Inventories.InventoryGUI;
  5. import me.sirapathy.Inventories.OutfitGUI1;
  6. import me.sirapathy.Skull.SkullManager;
  7. import me.sirapathy.Skull.SkullType;
  8.  
  9. import org.bukkit.Color;
  10. import org.bukkit.Material;
  11. import org.bukkit.command.Command;
  12. import org.bukkit.command.CommandSender;
  13. import org.bukkit.entity.HumanEntity;
  14. import org.bukkit.entity.Player;
  15. import org.bukkit.event.EventHandler;
  16. import org.bukkit.event.Listener;
  17. import org.bukkit.event.inventory.InventoryClickEvent;
  18. import org.bukkit.event.inventory.InventoryType.SlotType;
  19. import org.bukkit.event.player.PlayerQuitEvent;
  20. import org.bukkit.inventory.ItemStack;
  21. import org.bukkit.inventory.meta.LeatherArmorMeta;
  22. import org.bukkit.plugin.java.JavaPlugin;
  23.  
  24. public class Main$1 extends JavaPlugin implements Listener{
  25.  
  26. public void onEnable()
  27. {
  28.  
  29. getLogger().info("SkylandWardrobe has been enabled!");
  30.  
  31. getServer().getPluginManager().registerEvents(this, this);
  32. getServer().getPluginManager().registerEvents(new OutfitEffects(this), this);
  33.  
  34. SkullManager.setUp();
  35.  
  36. OutfitEffects.chickenSpawn();
  37.  
  38. }
  39.  
  40. public void onDisable()
  41. {
  42.  
  43. getLogger().info("SkylandWardrobe has been disabled!");
  44.  
  45. }
  46.  
  47. public ItemStack getColorArmor(Material m, Color c)
  48. {
  49.  
  50. ItemStack i = new ItemStack(m, 1);
  51. LeatherArmorMeta meta = (LeatherArmorMeta) i.getItemMeta();
  52.  
  53. meta.setColor(c);
  54.  
  55. i.setItemMeta(meta);
  56.  
  57. return i;
  58.  
  59. }
  60.  
  61. @EventHandler
  62. public void onQuit(PlayerQuitEvent e)
  63. {
  64.  
  65. e.getPlayer().getInventory().setArmorContents(null);
  66.  
  67. }
  68.  
  69. public int r;
  70. public int g;
  71. public int b = 20;
  72. public int time = 59;
  73.  
  74. @EventHandler
  75. public void onInvClick(final InventoryClickEvent e)
  76. {
  77.  
  78. if (e.getInventory().getName().equals("Skyland Outfits (1/2)"))
  79. {
  80.  
  81. e.setCancelled(true);
  82.  
  83. final HumanEntity p = e.getWhoClicked();
  84.  
  85. if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Rainbow"))
  86. {
  87.  
  88. p.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET));
  89.  
  90. getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
  91. {
  92.  
  93. public void run()
  94. {
  95.  
  96. if (!p.getInventory().getHelmet().getItemMeta().hasDisplayName() && p.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET))
  97. {
  98.  
  99. switch (Main$1.this.time)
  100. {
  101. case 59:
  102. Main$1.this.r = 255;
  103. Main$1.this.g = 0;
  104. Main$1.this.b = 0;
  105. Main$1.this.time -= 1;
  106. break;
  107. case 58:
  108. Main$1.this.r = 255;
  109. Main$1.this.g = 68;
  110. Main$1.this.b = 0;
  111. Main$1.this.time -= 1;
  112. break;
  113. case 57:
  114. Main$1.this.r = 255;
  115. Main$1.this.g = 111;
  116. Main$1.this.b = 0;
  117. Main$1.this.time -= 1;
  118. break;
  119. case 56:
  120. Main$1.this.r = 255;
  121. Main$1.this.g = 171;
  122. Main$1.this.b = 0;
  123. Main$1.this.time -= 1;
  124. break;
  125. case 55:
  126. Main$1.this.r = 255;
  127. Main$1.this.g = 255;
  128. Main$1.this.b = 0;
  129. Main$1.this.time -= 1;
  130. break;
  131. case 54:
  132. Main$1.this.r = 188;
  133. Main$1.this.g = 255;
  134. Main$1.this.b = 0;
  135. Main$1.this.time -= 1;
  136. break;
  137. case 53:
  138. Main$1.this.r = 128;
  139. Main$1.this.g = 255;
  140. Main$1.this.b = 0;
  141. Main$1.this.time -= 1;
  142. break;
  143. case 52:
  144. Main$1.this.r = 43;
  145. Main$1.this.g = 255;
  146. Main$1.this.b = 0;
  147. Main$1.this.time -= 1;
  148. break;
  149. case 51:
  150. Main$1.this.r = 0;
  151. Main$1.this.g = 255;
  152. Main$1.this.b = 9;
  153. Main$1.this.time -= 1;
  154. break;
  155. case 50:
  156. Main$1.this.r = 0;
  157. Main$1.this.g = 255;
  158. Main$1.this.b = 51;
  159. Main$1.this.time -= 1;
  160. break;
  161. case 49:
  162. Main$1.this.r = 0;
  163. Main$1.this.g = 255;
  164. Main$1.this.b = 111;
  165. Main$1.this.time -= 1;
  166. break;
  167. case 48:
  168. Main$1.this.r = 0;
  169. Main$1.this.g = 255;
  170. Main$1.this.b = 162;
  171. Main$1.this.time -= 1;
  172. break;
  173. case 47:
  174. Main$1.this.r = 0;
  175. Main$1.this.g = 255;
  176. Main$1.this.b = 230;
  177. Main$1.this.time -= 1;
  178. break;
  179. case 46:
  180. Main$1.this.r = 0;
  181. Main$1.this.g = 239;
  182. Main$1.this.b = 255;
  183. Main$1.this.time -= 1;
  184. break;
  185. case 45:
  186. Main$1.this.r = 0;
  187. Main$1.this.g = 196;
  188. Main$1.this.b = 255;
  189. Main$1.this.time -= 1;
  190. break;
  191. case 44:
  192. Main$1.this.r = 0;
  193. Main$1.this.g = 173;
  194. Main$1.this.b = 255;
  195. Main$1.this.time -= 1;
  196. break;
  197. case 43:
  198. Main$1.this.r = 0;
  199. Main$1.this.g = 162;
  200. Main$1.this.b = 255;
  201. Main$1.this.time -= 1;
  202. break;
  203. case 42:
  204. Main$1.this.r = 0;
  205. Main$1.this.g = 137;
  206. Main$1.this.b = 255;
  207. Main$1.this.time -= 1;
  208. break;
  209. case 41:
  210. Main$1.this.r = 0;
  211. Main$1.this.g = 100;
  212. Main$1.this.b = 255;
  213. Main$1.this.time -= 1;
  214. break;
  215. case 40:
  216. Main$1.this.r = 0;
  217. Main$1.this.g = 77;
  218. Main$1.this.b = 255;
  219. Main$1.this.time -= 1;
  220. break;
  221. case 39:
  222. Main$1.this.r = 0;
  223. Main$1.this.g = 34;
  224. Main$1.this.b = 255;
  225. Main$1.this.time -= 1;
  226. break;
  227. case 38:
  228. Main$1.this.r = 17;
  229. Main$1.this.g = 0;
  230. Main$1.this.b = 255;
  231. Main$1.this.time -= 1;
  232. break;
  233. case 37:
  234. Main$1.this.r = 37;
  235. Main$1.this.g = 0;
  236. Main$1.this.b = 255;
  237. Main$1.this.time -= 1;
  238. break;
  239. case 36:
  240. Main$1.this.r = 68;
  241. Main$1.this.g = 0;
  242. Main$1.this.b = 255;
  243. Main$1.this.time -= 1;
  244. break;
  245. case 35:
  246. Main$1.this.r = 89;
  247. Main$1.this.g = 0;
  248. Main$1.this.b = 255;
  249. Main$1.this.time -= 1;
  250. break;
  251. case 34:
  252. Main$1.this.r = 102;
  253. Main$1.this.g = 0;
  254. Main$1.this.b = 255;
  255. Main$1.this.time -= 1;
  256. break;
  257. case 33:
  258. Main$1.this.r = 124;
  259. Main$1.this.g = 0;
  260. Main$1.this.b = 255;
  261. Main$1.this.time -= 1;
  262. break;
  263. case 32:
  264. Main$1.this.r = 154;
  265. Main$1.this.g = 0;
  266. Main$1.this.b = 255;
  267. Main$1.this.time -= 1;
  268. break;
  269. case 31:
  270. Main$1.this.r = 222;
  271. Main$1.this.g = 0;
  272. Main$1.this.b = 255;
  273. Main$1.this.time -= 1;
  274. break;
  275. case 30:
  276. Main$1.this.r = 255;
  277. Main$1.this.g = 0;
  278. Main$1.this.b = 247;
  279. Main$1.this.time -= 1;
  280. break;
  281. case 29:
  282. Main$1.this.r = 255;
  283. Main$1.this.g = 0;
  284. Main$1.this.b = 179;
  285. Main$1.this.time -= 1;
  286. break;
  287. case 28:
  288. Main$1.this.r = 255;
  289. Main$1.this.g = 0;
  290. Main$1.this.b = 128;
  291. Main$1.this.time = 59;
  292.  
  293. }
  294.  
  295. Color c = Color.fromRGB(Main$1.this.r, Main$1.this.g, Main$1.this.b);
  296.  
  297. p.getInventory().setHelmet(getColorArmor(Material.LEATHER_HELMET, c));
  298. p.getInventory().setChestplate(getColorArmor(Material.LEATHER_CHESTPLATE, c));
  299. p.getInventory().setLeggings(getColorArmor(Material.LEATHER_LEGGINGS, c));
  300. p.getInventory().setBoots(getColorArmor(Material.LEATHER_BOOTS, c));
  301.  
  302. }
  303.  
  304. }
  305.  
  306. },0,2L);
  307.  
  308. }
  309.  
  310. // Armor
  311.  
  312. if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Chain Helmet"))
  313. {
  314.  
  315. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
  316.  
  317. }
  318.  
  319. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Chain Chestplate"))
  320. {
  321.  
  322. p.getInventory().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
  323.  
  324. }
  325.  
  326. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Chain Leggings"))
  327. {
  328.  
  329. p.getInventory().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
  330.  
  331. }
  332.  
  333. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Chain Boots"))
  334. {
  335.  
  336. p.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
  337.  
  338. }
  339.  
  340. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Gold Helmet"))
  341. {
  342.  
  343. p.getInventory().setHelmet(new ItemStack(Material.GOLD_HELMET));
  344.  
  345. }
  346.  
  347. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Gold Chestplate"))
  348. {
  349.  
  350. p.getInventory().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
  351.  
  352. }
  353.  
  354. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Gold Leggings"))
  355. {
  356.  
  357. p.getInventory().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
  358.  
  359. }
  360.  
  361. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Gold Boots"))
  362. {
  363.  
  364. p.getInventory().setBoots(new ItemStack(Material.GOLD_BOOTS));
  365.  
  366. }
  367.  
  368. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Iron Helmet"))
  369. {
  370.  
  371. p.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
  372.  
  373. }
  374.  
  375. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Iron Chestplate"))
  376. {
  377.  
  378. p.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
  379.  
  380. }
  381.  
  382. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Iron Leggings"))
  383. {
  384.  
  385. p.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
  386.  
  387. }
  388.  
  389. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Iron Boots"))
  390. {
  391.  
  392. p.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
  393.  
  394. }
  395.  
  396. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Diamond Helmet"))
  397. {
  398.  
  399. p.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
  400.  
  401. }
  402.  
  403. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Diamond Chestplate"))
  404. {
  405.  
  406. p.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
  407.  
  408. }
  409.  
  410. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Diamond Leggings"))
  411. {
  412.  
  413. p.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
  414.  
  415. }
  416.  
  417. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Diamond Boots"))
  418. {
  419.  
  420. p.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
  421.  
  422. }
  423.  
  424. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Remove Armor"))
  425. {
  426.  
  427. p.getInventory().setHelmet(null);
  428. p.getInventory().setChestplate(null);
  429. p.getInventory().setLeggings(null);
  430. p.getInventory().setBoots(null);
  431.  
  432. }
  433.  
  434. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Next Page"))
  435. {
  436.  
  437. p.openInventory(OutfitGUI1.getInventory());
  438.  
  439. }
  440.  
  441. }
  442.  
  443. else if (e.getInventory().getName().equals("Skyland Outfits (2/2)")) //Outfits
  444. {
  445.  
  446. e.setCancelled(true);
  447.  
  448. HumanEntity p = e.getWhoClicked();
  449.  
  450. if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Mario"))
  451. {
  452.  
  453. ItemStack MarioChestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
  454. LeatherArmorMeta meta1 = (LeatherArmorMeta) MarioChestplate.getItemMeta();
  455. meta1.setColor(Color.fromRGB(204,1,15));
  456. MarioChestplate.setItemMeta(meta1);
  457. ItemStack MarioLeggings = new ItemStack(Material.LEATHER_LEGGINGS);
  458. LeatherArmorMeta meta2 = (LeatherArmorMeta) MarioLeggings.getItemMeta();
  459. meta2.setColor(Color.fromRGB(1,104,218));
  460. MarioLeggings.setItemMeta(meta2);
  461. ItemStack MarioBoots = new ItemStack(Material.LEATHER_BOOTS);
  462. LeatherArmorMeta meta3 = (LeatherArmorMeta) MarioBoots.getItemMeta();
  463. meta3.setColor(Color.fromRGB(219,157,116));
  464. MarioBoots.setItemMeta(meta3);
  465.  
  466. p.getInventory().setHelmet((ItemStack) SkullManager.outfitSkulls.get(SkullType.MARIO));
  467. p.getInventory().setChestplate(MarioChestplate);
  468. p.getInventory().setLeggings(MarioLeggings);
  469. p.getInventory().setBoots(MarioBoots);
  470.  
  471. }
  472.  
  473. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Sonic"))
  474. {
  475.  
  476. ItemStack SonicChestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
  477. LeatherArmorMeta sonicmeta1 = (LeatherArmorMeta) SonicChestplate.getItemMeta();
  478. sonicmeta1.setColor(Color.fromRGB(8,35,181));
  479. SonicChestplate.setItemMeta(sonicmeta1);
  480. ItemStack SonicLeggings = new ItemStack(Material.LEATHER_LEGGINGS);
  481. LeatherArmorMeta sonicmeta2 = (LeatherArmorMeta) SonicLeggings.getItemMeta();
  482. sonicmeta2.setColor(Color.fromRGB(8,35,181));
  483. SonicLeggings.setItemMeta(sonicmeta2);
  484. ItemStack SonicBoots = new ItemStack(Material.LEATHER_BOOTS);
  485. LeatherArmorMeta sonicmeta3 = (LeatherArmorMeta) SonicBoots.getItemMeta();
  486. sonicmeta3.setColor(Color.fromRGB(135,47,43));
  487. SonicBoots.setItemMeta(sonicmeta3);
  488.  
  489. p.getInventory().setHelmet((ItemStack) SkullManager.outfitSkulls.get(SkullType.SONIC));
  490. p.getInventory().setChestplate(SonicChestplate);
  491. p.getInventory().setLeggings(SonicLeggings);
  492. p.getInventory().setBoots(SonicBoots);
  493.  
  494. }
  495.  
  496. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Link"))
  497. {
  498.  
  499. ItemStack LinkChestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
  500. LeatherArmorMeta linkmeta1 = (LeatherArmorMeta) LinkChestplate.getItemMeta();
  501. linkmeta1.setColor(Color.fromRGB(72,116,57));
  502. LinkChestplate.setItemMeta(linkmeta1);
  503. ItemStack LinkLeggings = new ItemStack(Material.LEATHER_LEGGINGS);
  504. LeatherArmorMeta linkmeta2 = (LeatherArmorMeta) LinkLeggings.getItemMeta();
  505. linkmeta2.setColor(Color.fromRGB(204,205,187));
  506. LinkLeggings.setItemMeta(linkmeta2);
  507. ItemStack LinkBoots = new ItemStack(Material.LEATHER_BOOTS);
  508. LeatherArmorMeta linkmeta3 = (LeatherArmorMeta) LinkBoots.getItemMeta();
  509. linkmeta3.setColor(Color.fromRGB(130,94,62));
  510. LinkBoots.setItemMeta(linkmeta3);
  511.  
  512. p.getInventory().setHelmet((ItemStack) SkullManager.outfitSkulls.get(SkullType.LINK));
  513. p.getInventory().setChestplate(LinkChestplate);
  514. p.getInventory().setLeggings(LinkLeggings);
  515. p.getInventory().setBoots(LinkBoots);
  516.  
  517. }
  518.  
  519. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Remove Armor"))
  520. {
  521.  
  522. p.getInventory().setHelmet(null);
  523. p.getInventory().setChestplate(null);
  524. p.getInventory().setLeggings(null);
  525. p.getInventory().setBoots(null);
  526.  
  527. }
  528.  
  529. else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Last Page"))
  530. {
  531.  
  532. p.openInventory(InventoryGUI.getInventory());
  533.  
  534. }
  535.  
  536. }
  537.  
  538. else if (e.getWhoClicked().getWorld().getName().equals("Spawn"))
  539. {
  540.  
  541. if (e.getSlotType() == SlotType.ARMOR)
  542. {
  543.  
  544. e.setCancelled(true);
  545. e.getWhoClicked().closeInventory();
  546.  
  547. }
  548.  
  549. else
  550. {
  551.  
  552. return;
  553.  
  554. }
  555.  
  556. }
  557.  
  558. else
  559. {
  560.  
  561. return;
  562.  
  563. }
  564.  
  565. }
  566.  
  567. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  568. {
  569.  
  570. Player p = (Player) sender;
  571.  
  572. if (p.hasPermission("skylandwardrobe.gui") || p.isOp())
  573. {
  574.  
  575. if (cmd.getName().equalsIgnoreCase("wardrobe"))
  576. {
  577.  
  578. p.openInventory(InventoryGUI.getInventory());
  579.  
  580. }
  581.  
  582. if (cmd.getName().equalsIgnoreCase("outfits"))
  583. {
  584.  
  585. p.openInventory(OutfitGUI1.getInventory());
  586.  
  587. }
  588.  
  589. }
  590.  
  591. return true;
  592. }
  593.  
  594. }
Add Comment
Please, Sign In to add comment