Advertisement
Guest User

Kitmap Signs

a guest
Jul 23rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.57 KB | None | 0 0
  1. package fr.patatedouce.kitmap;
  2.  
  3. import org.bukkit.entity.*;
  4. import org.bukkit.enchantments.*;
  5. import org.bukkit.*;
  6. import org.bukkit.inventory.*;
  7. import org.bukkit.event.player.*;
  8. import org.bukkit.event.block.*;
  9. import org.bukkit.block.*;
  10. import org.bukkit.event.*;
  11.  
  12. public class KitMapSigns implements Listener
  13. {
  14. ItemStack healthpot;
  15. ItemStack speedpot;
  16. ItemStack frespot;
  17.  
  18. public KitMapSigns() {
  19. this.healthpot = new ItemStack(Material.POTION, 1, (short)16421);
  20. this.speedpot = new ItemStack(Material.POTION, 1, (short)8226);
  21. this.frespot = new ItemStack(Material.POTION, 1, (short)8259);
  22. }
  23.  
  24. public void giveDiamondKit(final Player p) {
  25. final ItemStack diamondhelmet = new ItemStack(Material.DIAMOND_HELMET, 1);
  26. diamondhelmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  27. diamondhelmet.addEnchantment(Enchantment.DURABILITY, 3);
  28. final ItemStack diamondchestplate = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
  29. diamondchestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  30. diamondchestplate.addEnchantment(Enchantment.DURABILITY, 3);
  31. final ItemStack diamondleggings = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
  32. diamondleggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  33. diamondleggings.addEnchantment(Enchantment.DURABILITY, 3);
  34. final ItemStack diamondboots = new ItemStack(Material.DIAMOND_BOOTS, 1);
  35. diamondboots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  36. diamondboots.addEnchantment(Enchantment.DURABILITY, 3);
  37. diamondboots.addEnchantment(Enchantment.PROTECTION_FALL, 4);
  38. final ItemStack sword = new ItemStack(Material.DIAMOND_SWORD, 1);
  39. sword.addEnchantment(Enchantment.DAMAGE_ALL, Main.instance.getConfig().getInt("Kit Map Sharpness"));
  40. sword.addEnchantment(Enchantment.DURABILITY, 3);
  41. if (Main.instance.getConfig().getInt("Kit Map Fire") != 0) {
  42. sword.addEnchantment(Enchantment.FIRE_ASPECT, Main.instance.getConfig().getInt("Kit Map Fire"));
  43. }
  44. final PlayerInventory pi = p.getInventory();
  45. pi.setItem(0, sword);
  46. pi.setItem(1, new ItemStack(Material.ENDER_PEARL, 16));
  47. pi.setItem(2, this.healthpot);
  48. pi.setItem(3, this.healthpot);
  49. pi.setItem(4, this.healthpot);
  50. pi.setItem(5, this.healthpot);
  51. pi.setItem(6, this.healthpot);
  52. pi.setItem(7, this.speedpot);
  53. pi.setItem(8, new ItemStack(Material.BAKED_POTATO, 64));
  54. pi.setItem(9, this.healthpot);
  55. pi.setItem(10, this.healthpot);
  56. pi.setItem(11, this.healthpot);
  57. pi.setItem(12, this.healthpot);
  58. pi.setItem(13, this.healthpot);
  59. pi.setItem(14, this.healthpot);
  60. pi.setItem(15, this.healthpot);
  61. pi.setItem(16, this.frespot);
  62. pi.setItem(17, this.speedpot);
  63. pi.setItem(18, this.healthpot);
  64. pi.setItem(19, this.healthpot);
  65. pi.setItem(20, this.healthpot);
  66. pi.setItem(21, this.healthpot);
  67. pi.setItem(22, this.healthpot);
  68. pi.setItem(23, this.healthpot);
  69. pi.setItem(24, this.healthpot);
  70. pi.setItem(25, this.speedpot);
  71. pi.setItem(26, this.speedpot);
  72. pi.setItem(27, this.healthpot);
  73. pi.setItem(28, this.healthpot);
  74. pi.setItem(29, this.healthpot);
  75. pi.setItem(30, this.healthpot);
  76. pi.setItem(31, this.healthpot);
  77. pi.setItem(32, this.healthpot);
  78. pi.setItem(33, this.healthpot);
  79. pi.setItem(34, this.speedpot);
  80. pi.setItem(35, this.speedpot);
  81. pi.setBoots(diamondboots);
  82. pi.setLeggings(diamondleggings);
  83. pi.setChestplate(diamondchestplate);
  84. pi.setHelmet(diamondhelmet);
  85. p.updateInventory();
  86. p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&8[&c&l!&8] &bClass &b&LDiamond &bActivated."));
  87. }
  88.  
  89. public void giveBardKit(final Player p) {
  90. final ItemStack goldhelmet = new ItemStack(Material.GOLD_HELMET, 1);
  91. goldhelmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  92. goldhelmet.addEnchantment(Enchantment.DURABILITY, 3);
  93. final ItemStack goldchestplate = new ItemStack(Material.GOLD_CHESTPLATE, 1);
  94. goldchestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  95. goldchestplate.addEnchantment(Enchantment.DURABILITY, 3);
  96. final ItemStack goldleggings = new ItemStack(Material.GOLD_LEGGINGS, 1);
  97. goldleggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  98. goldleggings.addEnchantment(Enchantment.DURABILITY, 3);
  99. final ItemStack goldboots = new ItemStack(Material.GOLD_BOOTS, 1);
  100. goldboots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  101. goldboots.addEnchantment(Enchantment.DURABILITY, 3);
  102. goldboots.addEnchantment(Enchantment.PROTECTION_FALL, 4);
  103. final ItemStack sword = new ItemStack(Material.DIAMOND_SWORD, 1);
  104. sword.addEnchantment(Enchantment.DAMAGE_ALL, Main.instance.getConfig().getInt("Kit Map Sharpness"));
  105. sword.addEnchantment(Enchantment.DURABILITY, 3);
  106. if (Main.instance.getConfig().getInt("Kit Map Fire") != 0) {
  107. sword.addEnchantment(Enchantment.FIRE_ASPECT, Main.instance.getConfig().getInt("Kit Map Fire"));
  108. }
  109. final PlayerInventory pi = p.getInventory();
  110. pi.setItem(0, sword);
  111. pi.setItem(1, new ItemStack(Material.ENDER_PEARL, 16));
  112. pi.setItem(2, new ItemStack(Material.IRON_INGOT, 16));
  113. pi.setItem(3, new ItemStack(Material.SUGAR, 16));
  114. pi.setItem(4, new ItemStack(Material.BLAZE_POWDER, 16));
  115. pi.setItem(5, new ItemStack(Material.FEATHER, 16));
  116. pi.setItem(5, new ItemStack(Material.GHAST_TEAR, 1));
  117. pi.setItem(6, this.healthpot);
  118. pi.setItem(7, this.frespot);
  119. pi.setItem(8, new ItemStack(Material.BAKED_POTATO, 64));
  120. pi.setItem(9, this.healthpot);
  121. pi.setItem(10, this.healthpot);
  122. pi.setItem(11, this.healthpot);
  123. pi.setItem(12, this.healthpot);
  124. pi.setItem(13, this.healthpot);
  125. pi.setItem(14, this.healthpot);
  126. pi.setItem(15, this.healthpot);
  127. pi.setItem(16, this.healthpot);
  128. pi.setItem(17, this.healthpot);
  129. pi.setItem(18, this.healthpot);
  130. pi.setItem(19, this.healthpot);
  131. pi.setItem(20, this.healthpot);
  132. pi.setItem(21, this.healthpot);
  133. pi.setItem(22, this.healthpot);
  134. pi.setItem(23, this.healthpot);
  135. pi.setItem(24, this.healthpot);
  136. pi.setItem(25, this.healthpot);
  137. pi.setItem(26, this.healthpot);
  138. pi.setItem(27, this.healthpot);
  139. pi.setItem(28, this.healthpot);
  140. pi.setItem(29, this.healthpot);
  141. pi.setItem(30, this.healthpot);
  142. pi.setItem(31, this.healthpot);
  143. pi.setItem(32, this.healthpot);
  144. pi.setItem(33, this.healthpot);
  145. pi.setItem(34, this.healthpot);
  146. pi.setItem(35, this.healthpot);
  147. pi.setBoots(goldboots);
  148. pi.setLeggings(goldleggings);
  149. pi.setChestplate(goldchestplate);
  150. pi.setHelmet(goldhelmet);
  151. p.updateInventory();
  152. p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&8[&c&l!&8] &bClass &e&lBard &bActivated."));
  153. }
  154.  
  155. public void giveArcherKit(final Player p) {
  156. final ItemStack leatherhelmet = new ItemStack(Material.LEATHER_HELMET, 1);
  157. leatherhelmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  158. leatherhelmet.addEnchantment(Enchantment.DURABILITY, 3);
  159. final ItemStack leatherchestplate = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
  160. leatherchestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  161. leatherchestplate.addEnchantment(Enchantment.DURABILITY, 3);
  162. final ItemStack leatherleggings = new ItemStack(Material.LEATHER_LEGGINGS, 1);
  163. leatherleggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  164. leatherleggings.addEnchantment(Enchantment.DURABILITY, 3);
  165. final ItemStack leatherboots = new ItemStack(Material.LEATHER_BOOTS, 1);
  166. leatherboots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, Main.instance.getConfig().getInt("Kit Map Protection"));
  167. leatherboots.addEnchantment(Enchantment.DURABILITY, 3);
  168. leatherboots.addEnchantment(Enchantment.PROTECTION_FALL, 4);
  169. final ItemStack sword = new ItemStack(Material.DIAMOND_SWORD, 1);
  170. sword.addEnchantment(Enchantment.DAMAGE_ALL, Main.instance.getConfig().getInt("Kit Map Sharpness"));
  171. sword.addEnchantment(Enchantment.DURABILITY, 3);
  172. if (Main.instance.getConfig().getInt("Kit Map Fire") != 0) {
  173. sword.addEnchantment(Enchantment.FIRE_ASPECT, Main.instance.getConfig().getInt("Kit Map Fire"));
  174. }
  175. final ItemStack bow = new ItemStack(Material.BOW, 1);
  176. bow.addEnchantment(Enchantment.ARROW_DAMAGE, Main.instance.getConfig().getInt("Kit Map Power"));
  177. bow.addEnchantment(Enchantment.DURABILITY, 3);
  178. bow.addEnchantment(Enchantment.ARROW_INFINITE, 1);
  179. final PlayerInventory pi = p.getInventory();
  180. pi.setItem(0, sword);
  181. pi.setItem(1, new ItemStack(Material.ENDER_PEARL, 16));
  182. pi.setItem(2, bow);
  183. pi.setItem(3, new ItemStack(Material.SUGAR, 64));
  184. pi.setItem(4, this.healthpot);
  185. pi.setItem(5, this.healthpot);
  186. pi.setItem(6, this.healthpot);
  187. pi.setItem(7, this.healthpot);
  188. pi.setItem(8, new ItemStack(Material.BAKED_POTATO, 64));
  189. pi.setItem(9, new ItemStack(Material.ARROW, 64));
  190. pi.setItem(10, this.healthpot);
  191. pi.setItem(11, this.healthpot);
  192. pi.setItem(12, this.healthpot);
  193. pi.setItem(13, this.healthpot);
  194. pi.setItem(14, this.healthpot);
  195. pi.setItem(15, this.healthpot);
  196. pi.setItem(16, this.healthpot);
  197. pi.setItem(17, this.frespot);
  198. pi.setItem(18, this.healthpot);
  199. pi.setItem(19, this.healthpot);
  200. pi.setItem(20, this.healthpot);
  201. pi.setItem(21, this.healthpot);
  202. pi.setItem(22, this.healthpot);
  203. pi.setItem(23, this.healthpot);
  204. pi.setItem(24, this.healthpot);
  205. pi.setItem(25, this.healthpot);
  206. pi.setItem(26, this.healthpot);
  207. pi.setItem(27, this.healthpot);
  208. pi.setItem(28, this.healthpot);
  209. pi.setItem(29, this.healthpot);
  210. pi.setItem(30, this.healthpot);
  211. pi.setItem(31, this.healthpot);
  212. pi.setItem(32, this.healthpot);
  213. pi.setItem(33, this.healthpot);
  214. pi.setItem(34, this.healthpot);
  215. pi.setItem(35, this.healthpot);
  216. pi.setBoots(leatherboots);
  217. pi.setLeggings(leatherleggings);
  218. pi.setChestplate(leatherchestplate);
  219. pi.setHelmet(leatherhelmet);
  220. p.updateInventory();
  221. p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&8[&c&l!&8] &bClass &6&LArcher &bActivated."));
  222. }
  223.  
  224. @EventHandler
  225. public void onclicksigncrowbarbuy(final PlayerInteractEvent e) {
  226. final Player p = e.getPlayer();
  227. if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
  228. final BlockState state = e.getClickedBlock().getState();
  229. if (state instanceof Sign) {
  230. final Sign s = (Sign)state;
  231. if (s.getLine(1).equals(ChatColor.translateAlternateColorCodes('&', "&3- &bClass &3-")) && s.getLine(2).equals(ChatColor.AQUA + "Diamond")) {
  232. this.giveDiamondKit(p);
  233. }
  234. else if (s.getLine(1).equals(ChatColor.translateAlternateColorCodes('&', "&3- &bClass &3-")) && s.getLine(2).equals(ChatColor.YELLOW + "Bard")) {
  235. this.giveBardKit(p);
  236. }
  237. else if (s.getLine(1).equals(ChatColor.translateAlternateColorCodes('&', "&3- &bClass &3-")) && s.getLine(2).equals(ChatColor.GOLD + "Archer")) {
  238. this.giveArcherKit(p);
  239. }
  240. }
  241. }
  242. }
  243. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement