Advertisement
Guest User

Untitled

a guest
Jan 9th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.49 KB | None | 0 0
  1. package me.Arrxzon.rankkits;
  2.  
  3. import me.Arrxzon.rankkits.SaveLoad;
  4. import java.util.ArrayList;
  5.  
  6. import net.milkbowl.vault.economy.Economy;
  7. import net.milkbowl.vault.economy.EconomyResponse;
  8. import net.milkbowl.vault.permission.Permission;
  9.  
  10. import org.bukkit.Bukkit;
  11. import org.bukkit.ChatColor;
  12. import org.bukkit.Material;
  13.  
  14.  
  15. import org.bukkit.command.Command;
  16. import org.bukkit.command.CommandSender;
  17. import org.bukkit.enchantments.Enchantment;
  18. import org.bukkit.entity.Player;
  19. import org.bukkit.inventory.ItemStack;
  20. import org.bukkit.inventory.PlayerInventory;
  21. import org.bukkit.plugin.RegisteredServiceProvider;
  22. import org.bukkit.plugin.java.JavaPlugin;
  23.  
  24. import ru.tehkode.permissions.PermissionUser;
  25. import ru.tehkode.permissions.bukkit.PermissionsEx;
  26.  
  27. public class RankKits extends JavaPlugin{
  28.  
  29. private static final int slotsNeeded = 10;
  30. public static Economy econ = null;
  31. public static Permission perms = null;
  32. public static RankKits plugin;
  33.  
  34. public void onEnable() {
  35. if(!getDataFolder().exists()) {
  36. getDataFolder().mkdir();
  37. }
  38. try{
  39. cooldown = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  40. cooldown2 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  41. cooldown3 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  42. cooldown4 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  43. cooldown5 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  44. cooldown6 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  45. cooldown7 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  46. cooldown8 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  47. cooldown9 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  48. cooldown10 = SaveLoad.load("plugins\\RankKits\\hashmap.bin");
  49. }
  50. catch(Exception e){
  51. e.printStackTrace();
  52. }
  53. getLogger().info("RankKits by Arrxzon Enabled!");
  54. if (!setupEconomy()) {
  55. getLogger().severe(ChatColor.RED + "Disabled due to no Vault dependency found!");
  56. getServer().getPluginManager().disablePlugin(this);
  57. return;
  58. }
  59. }
  60. public void onDisable() {
  61. // if(!getDataFolder().exists()) {
  62. // getDataFolder().mkdir();
  63. // }
  64. try{
  65. SaveLoad.save(cooldown, "plugins\\RankKits\\hashmap.bin");
  66. SaveLoad.save(cooldown2, "plugins\\RankKits\\hashmap.bin");
  67. SaveLoad.save(cooldown3, "plugins\\RankKits\\hashmap.bin");
  68. SaveLoad.save(cooldown4, "plugins\\RankKits\\hashmap.bin");
  69. SaveLoad.save(cooldown5, "plugins\\RankKits\\hashmap.bin");
  70. SaveLoad.save(cooldown6, "plugins\\RankKits\\hashmap.bin");
  71. SaveLoad.save(cooldown7, "plugins\\RankKits\\hashmap.bin");
  72. SaveLoad.save(cooldown8, "plugins\\RankKits\\hashmap.bin");
  73. SaveLoad.save(cooldown9, "plugins\\RankKits\\hashmap.bin");
  74. SaveLoad.save(cooldown10, "plugins\\RankKits\\hashmap.bin");
  75. }
  76. catch(Exception e){
  77. e.printStackTrace();
  78. }
  79.  
  80. }
  81.  
  82. private boolean setupEconomy() {
  83. if (getServer().getPluginManager().getPlugin("Vault") == null) {
  84. return false;
  85. }
  86. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
  87. if (rsp == null) {
  88. return false;
  89. }
  90. econ = rsp.getProvider();
  91. return econ != null;
  92. }
  93. @SuppressWarnings("unused")
  94. private boolean setupPermissions() {
  95. RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
  96. perms = rsp.getProvider();
  97. return perms != null;
  98. }
  99.  
  100. private ArrayList<String> cooldown = new ArrayList<String>();
  101. private ArrayList<String> cooldown1 = new ArrayList<String>();
  102. private ArrayList<String> cooldown2 = new ArrayList<String>();
  103. private ArrayList<String> cooldown3 = new ArrayList<String>();
  104. private ArrayList<String> cooldown4 = new ArrayList<String>();
  105. private ArrayList<String> cooldown5 = new ArrayList<String>();
  106. private ArrayList<String> cooldown6 = new ArrayList<String>();
  107. private ArrayList<String> cooldown7 = new ArrayList<String>();
  108. private ArrayList<String> cooldown8 = new ArrayList<String>();
  109. private ArrayList<String> cooldown9 = new ArrayList<String>();
  110. private ArrayList<String> cooldown10 = new ArrayList<String>();
  111.  
  112. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  113.  
  114. final Player p = (Player) sender;
  115. PlayerInventory pi = p.getInventory();
  116. PermissionUser user = PermissionsEx.getUser(p);
  117.  
  118. // final String name = Player.getName();
  119. // if (plugin.hashmap.keySet().contains(getName())) {
  120. // plugin.hashmap.put(getName(), plugin.hashmap.get(getName()) + 1);
  121. // }
  122.  
  123. if (cmd.getName().equalsIgnoreCase("rkits")) {
  124. p.sendMessage(ChatColor.GOLD + "--==[" + ChatColor.AQUA + ChatColor.BOLD + "EdgeWire Rank Kits available" + ChatColor.GOLD + "]==--" + ChatColor.GRAY + "");
  125. p.sendMessage("[" + ChatColor.BLUE + "RankKit" + ChatColor.WHITE + "]" + " [" + ChatColor.BLUE + "Cost" + ChatColor.WHITE + "]" + " [" + ChatColor.BLUE + "Cooldown|hours" + ChatColor.WHITE + "]");
  126.  
  127. p.sendMessage("[" + ChatColor.AQUA + "Recruit" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $0 " + " [" + ChatColor.DARK_AQUA + "1" + ChatColor.WHITE + "]");
  128. p.sendMessage("[" + ChatColor.AQUA + "Private" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $3,000 " + " [" + ChatColor.DARK_AQUA + "1.5" + ChatColor.WHITE + "]");
  129. p.sendMessage("[" + ChatColor.AQUA + "Lieutenant" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $6,000 " + " [" + ChatColor.DARK_AQUA + "2" + ChatColor.WHITE + "]");
  130. p.sendMessage("[" + ChatColor.AQUA + "Officer" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $12,000 " + " [" + ChatColor.DARK_AQUA + "3" + ChatColor.WHITE + "]");
  131. p.sendMessage("[" + ChatColor.AQUA + "Captain" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $35,000 " + " [" + ChatColor.DARK_AQUA + "5" + ChatColor.WHITE + "]");
  132. p.sendMessage("[" + ChatColor.AQUA + "Corporal" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $40,000 " + " [" + ChatColor.DARK_AQUA + "10" + ChatColor.WHITE + "]");
  133. p.sendMessage("[" + ChatColor.AQUA + "Commander" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $50,000 " + " [" + ChatColor.DARK_AQUA + "11" + ChatColor.WHITE + "]");
  134. p.sendMessage("[" + ChatColor.GREEN + "Sergeant" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $75,000 " + " [" + ChatColor.DARK_AQUA + "12" + ChatColor.WHITE + "]");
  135. p.sendMessage("[" + ChatColor.GREEN + "Sergeant Major" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $90,000 " + " [" + ChatColor.DARK_AQUA + "12" + ChatColor.WHITE + "]");
  136. p.sendMessage("[" + ChatColor.GREEN + "Master Sergeant" + ChatColor.WHITE + "]" + ChatColor.WHITE + " $100,000 " + " [" + ChatColor.DARK_AQUA + "12" + ChatColor.WHITE + "]");
  137. //To Do. list cooldown ????
  138. return true;
  139. }
  140.  
  141. if (cmd.getName().equalsIgnoreCase("rkit")) {
  142. if (args.length == 1) {
  143. if (args[0].equalsIgnoreCase("help")) {
  144. p.sendMessage(ChatColor.GOLD + "----==[" + ChatColor.AQUA + ChatColor.BOLD + "EdgeWire Rank Kits Help" + ChatColor.GOLD + "]==----");
  145. p.sendMessage(ChatColor.GOLD + "--" + ChatColor.WHITE + ChatColor.ITALIC + " You start from lowest rank and buy your way up,");
  146. p.sendMessage(ChatColor.GOLD + "--" + ChatColor.WHITE + ChatColor.ITALIC + " Each rank has it's own kit.");
  147. p.sendMessage(ChatColor.GOLD + "--" + ChatColor.WHITE + ChatColor.ITALIC + " Your able to use kits from previous ranks.");
  148. p.sendMessage(ChatColor.GOLD + "--");
  149. p.sendMessage(ChatColor.GOLD + "/kit:" + ChatColor.WHITE + " Shows This Menu");
  150. p.sendMessage(ChatColor.GOLD + "/kits:" + ChatColor.WHITE + " Lists All RankKits, Price and Cooldown");
  151. p.sendMessage(ChatColor.GOLD + "/kit [Name]:" + ChatColor.WHITE + " Purchases RankKit if Possible");
  152. p.sendMessage(ChatColor.GOLD + "--" + ChatColor.GREEN + " Green" + ChatColor.WHITE + ChatColor.ITALIC + " = Donators only");
  153. }
  154. }
  155. }
  156.  
  157. if (cmd.getName().equalsIgnoreCase("rkit")) {
  158. if (args.length == 0) {
  159. p.sendMessage(ChatColor.GOLD + "---" + ChatColor.AQUA + ChatColor.BOLD + "Rank Kits Alpha v0.0.9" + ChatColor.GOLD + "---");
  160. p.sendMessage(ChatColor.GOLD + " /kit help:" + ChatColor.AQUA + " For Help");
  161. p.sendMessage(ChatColor.GOLD + "-" + ChatColor.GRAY + ChatColor.ITALIC + "Brought to you by Arrxzon" + ChatColor.GOLD + "-");
  162. return true;
  163. }
  164.  
  165. /*
  166. * RECRUIT
  167. */
  168. if (args.length == 1) {
  169. //inventory check
  170. int openSlots = 0;
  171. for(ItemStack item : p.getInventory().getContents()){
  172. if(item == null)
  173. openSlots++;
  174. }
  175. if(openSlots < slotsNeeded){
  176. p.sendMessage("Please remove "+(slotsNeeded - openSlots)+" items from your inventory!");
  177. return false;
  178. }
  179. //end inventory check
  180. if(sender.hasPermission("rkit.0"))
  181. if (args[0].equalsIgnoreCase("recruit")) {
  182. if (cooldown.contains(p.getName())) {
  183. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  184. return false;
  185. }
  186. pi.addItem(new ItemStack(Material.LEATHER_HELMET, 1));
  187. pi.addItem(new ItemStack(Material.LEATHER_BOOTS, 1));
  188. pi.addItem(new ItemStack(Material.LEATHER_CHESTPLATE, 1));
  189. pi.addItem(new ItemStack(Material.LEATHER_LEGGINGS, 1));
  190. pi.addItem(new ItemStack(Material.COOKED_BEEF, 10));
  191. p.sendMessage(ChatColor.AQUA + "You got RankKit" + ChatColor.GREEN + " Recruit");
  192. cooldown.add(p.getName());
  193. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  194. public void run() {
  195. cooldown.remove(p.getName());
  196. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Private" + ChatColor.AQUA + " again!");
  197. }
  198. }, 600); //30seconds 1.5 hours
  199. return true;
  200. }
  201. }
  202.  
  203.  
  204. /*
  205. * Private
  206. */
  207.  
  208. if (args.length == 1) {
  209. //p.getInventory().contains(9);
  210.  
  211. if(sender.hasPermission("rkit.1"))
  212. if (args[0].equalsIgnoreCase("private")) {
  213. if (cooldown1.contains(p.getName())) {
  214. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  215. return true;
  216. }
  217. EconomyResponse r = econ.withdrawPlayer(p.getName(), 3000);
  218. if (r.transactionSuccess()) {
  219. ItemStack is = new ItemStack(Material.IRON_SWORD, 1);
  220. is.addEnchantment(Enchantment.DAMAGE_ALL,1);
  221. pi.addItem(new ItemStack(Material.CHAINMAIL_HELMET, 1));
  222. pi.addItem(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1));
  223. pi.addItem(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1));
  224. pi.addItem(new ItemStack(Material.CHAINMAIL_BOOTS, 1));
  225. pi.addItem(new ItemStack(Material.COOKED_BEEF, 16));
  226. p.getInventory().addItem(is);
  227. p.sendMessage(ChatColor.AQUA + "You got RankKit" + ChatColor.GREEN + " Private" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 3000");
  228. if(user.inGroup("default")){
  229. user.addGroup("private");
  230. user.removeGroup("default");
  231. }
  232. cooldown1.add(p.getName());
  233. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  234. public void run() {
  235. cooldown1.remove(p.getName());
  236. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Private" + ChatColor.AQUA + " again!");
  237. }
  238. }, 108000); // 1.5 hours
  239. return true;
  240. }
  241. }
  242. }
  243. // else {
  244. // sender.sendMessage("You do not have permission for this kit. Have you got the previous first ?");
  245. // }
  246. /*
  247. * Lieutenant
  248. */
  249. if (args.length == 1) {
  250. if(sender.hasPermission("rkit.lieutenant"))
  251. if (args[0].equalsIgnoreCase("lieutenant")) {
  252. if (cooldown2.contains(p.getName())) {
  253. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  254. return true;
  255. }
  256. EconomyResponse r = econ.withdrawPlayer(p.getName(), 6000);
  257. if (r.transactionSuccess()) {
  258. ItemStack is = new ItemStack(Material.IRON_SWORD, 1);
  259. is.addEnchantment(Enchantment.DAMAGE_ALL, 2);
  260. pi.addItem(new ItemStack(Material.IRON_HELMET, 1));
  261. pi.addItem(new ItemStack(Material.IRON_CHESTPLATE, 1));
  262. pi.addItem(new ItemStack(Material.IRON_LEGGINGS, 1));
  263. pi.addItem(new ItemStack(Material.IRON_BOOTS, 1));
  264. pi.addItem(new ItemStack(Material.COOKED_BEEF, 32));
  265. p.getInventory().addItem(is);
  266. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Lieutenant" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 6000");
  267. if(user.inGroup("private")){
  268. user.addGroup("lieutenant");
  269. user.removeGroup("private");
  270. }
  271. cooldown2.add(p.getName());
  272. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  273. public void run() {
  274. cooldown2.remove(p.getName());
  275. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Lieutenant" + ChatColor.AQUA + " again!");
  276. }
  277. }, 144000); //2 hours
  278. return true;
  279. }
  280. }
  281. }
  282. /*
  283. * officer
  284. */
  285. if (args.length == 1) {
  286. if(sender.hasPermission("rkit.officer")) {
  287. if (args[0].equalsIgnoreCase("officer")) {
  288. if (cooldown3.contains(p.getName())) {
  289. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  290. return true;
  291. }
  292. EconomyResponse r = econ.withdrawPlayer(p.getName(), 15000);
  293. if (r.transactionSuccess()) {
  294. ItemStack is = new ItemStack(Material.IRON_SWORD, 1);
  295. is.addEnchantment(Enchantment.DAMAGE_ALL, 2);
  296. is.addEnchantment(Enchantment.FIRE_ASPECT, 1);
  297. ItemStack is1 = new ItemStack(Material.IRON_HELMET, 1);
  298. is1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  299. ItemStack is2 = new ItemStack(Material.IRON_CHESTPLATE, 1);
  300. is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  301. ItemStack is3 = new ItemStack(Material.IRON_LEGGINGS, 1);
  302. is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  303. ItemStack is4 = new ItemStack(Material.IRON_BOOTS, 1);
  304. is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
  305. pi.addItem(new ItemStack(Material.COOKED_BEEF, 32));
  306. p.getInventory().addItem(is, is1, is2, is3, is4);
  307. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Officer" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 15000");
  308. if(user.inGroup("lieutenant")){
  309. user.addGroup("officer");
  310. user.removeGroup("lieutenant");
  311. }
  312. cooldown3.add(p.getName());
  313. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  314. public void run() {
  315. cooldown3.remove(p.getName());
  316. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Officer" + ChatColor.AQUA + " again!");
  317. }
  318. }, 216000); //3hours
  319. return true;
  320. }
  321. else {
  322. p.sendMessage(ChatColor.RED + "Could not execute transaction. Got enough coins ?");
  323. return true;
  324. }
  325. }
  326. }
  327. // else {
  328. // sender.sendMessage("You do not have permission for this kit. Have you got the previous first ?");
  329. // }
  330. }
  331. /*
  332. * Captain
  333. *
  334. *
  335. */
  336. if (args.length == 1) {
  337. if(sender.hasPermission("rkit.captain")) {
  338. if (args[0].equalsIgnoreCase("captain")) {
  339. if (cooldown4.contains(p.getName())) {
  340. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  341. return true;
  342. }
  343. EconomyResponse r = econ.withdrawPlayer(p.getName(), 35000);
  344. if (r.transactionSuccess()) {
  345. ItemStack is = new ItemStack(Material.DIAMOND_SWORD, 1);
  346. is.addEnchantment(Enchantment.DAMAGE_ALL, 2);
  347. pi.addItem(new ItemStack(Material.DIAMOND_HELMET, 1));
  348. pi.addItem(new ItemStack(Material.DIAMOND_CHESTPLATE, 1));
  349. pi.addItem(new ItemStack(Material.DIAMOND_LEGGINGS, 1));
  350. pi.addItem(new ItemStack(Material.DIAMOND_BOOTS, 1));
  351. pi.addItem(new ItemStack(Material.COOKED_BEEF, 64));
  352. p.getInventory().addItem(is);
  353. if(user.inGroup("officer")){
  354. user.addGroup("captain");
  355. user.removeGroup("officer");
  356. }
  357. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Captain" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 35000");
  358. cooldown4.add(p.getName());
  359. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  360. public void run() {
  361. cooldown4.remove(p.getName());
  362. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Captain" + ChatColor.AQUA + " again!");
  363. }
  364. }, 360000); //5 hours
  365. return true;
  366. }
  367. else {
  368. p.sendMessage(ChatColor.RED + "Could not execute transaction. Got enough coins ?");
  369. return true;
  370. }
  371. }
  372. }
  373. // else {
  374. // sender.sendMessage("You do not have permission for this kit. Have you got the previous first ?");
  375. // }
  376. }
  377. /*
  378. * Corporal
  379. */
  380. if (args.length == 1) {
  381. if(sender.hasPermission("rkit.corporal")) {
  382. if (args[0].equalsIgnoreCase("corporal")) {
  383. if (cooldown5.contains(p.getName())) {
  384. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  385. return true;
  386. }
  387. EconomyResponse r = econ.withdrawPlayer(p.getName(), 40000);
  388. if (r.transactionSuccess()) {
  389. ItemStack is1 = new ItemStack(Material.DIAMOND_SWORD, 1);
  390. is1.addEnchantment(Enchantment.DAMAGE_ALL, 3);
  391. ItemStack is2 = new ItemStack(Material.DIAMOND_HELMET, 1);
  392. is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  393. ItemStack is3 = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
  394. is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  395. ItemStack is4 = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
  396. is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  397. ItemStack is5 = new ItemStack(Material.DIAMOND_BOOTS, 1);
  398. is5.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  399. ItemStack is6 = new ItemStack(Material.BOW, 1);
  400. is6.addEnchantment(Enchantment.ARROW_DAMAGE, 2);
  401. pi.addItem(new ItemStack(Material.COOKED_BEEF, 64));
  402. p.getInventory().addItem(is1, is2, is3, is4, is5, is6);
  403. if(user.inGroup("captain")){
  404. user.addGroup("corporal");
  405. user.removeGroup("captain");
  406. }
  407. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Corporal" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 40000");
  408. cooldown5.add(p.getName());
  409. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  410. public void run() {
  411. cooldown5.remove(p.getName());
  412. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Corporal" + ChatColor.AQUA + " again!");
  413. }
  414. }, 720000); //10 hours
  415. return true;
  416. }
  417. }
  418. }
  419. // else {
  420. // sender.sendMessage("You do not have permission for this kit. Have you got the previous first ?");
  421. // }
  422. }
  423. /*
  424. * Commander
  425. */
  426. if (args.length == 1) {
  427. if(sender.hasPermission("rkit.commander")) {
  428. if (args[0].equalsIgnoreCase("Commander")) {
  429. if (cooldown6.contains(p.getName())) {
  430. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  431. return true;
  432. }
  433. EconomyResponse r = econ.withdrawPlayer(p.getName(), 50000);
  434. if (r.transactionSuccess()) {
  435. ItemStack is1 = new ItemStack(Material.DIAMOND_SWORD, 1);
  436. is1.addEnchantment(Enchantment.DAMAGE_ALL, 3);
  437. is1.addEnchantment(Enchantment.FIRE_ASPECT, 1);
  438. ItemStack is2 = new ItemStack(Material.DIAMOND_HELMET, 1);
  439. is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
  440. ItemStack is3 = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
  441. is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
  442. ItemStack is4 = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
  443. is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
  444. ItemStack is5 = new ItemStack(Material.DIAMOND_BOOTS, 1);
  445. is5.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
  446. ItemStack is6 = new ItemStack(Material.BOW, 1);
  447. is6.addEnchantment(Enchantment.ARROW_DAMAGE, 2);
  448. is6.addEnchantment(Enchantment.ARROW_INFINITE, 1);
  449. pi.addItem(new ItemStack(Material.COOKED_BEEF, 64));
  450. p.getInventory().addItem(is1, is2, is3, is4, is5, is6);
  451. if(user.inGroup("corporal")){
  452. user.addGroup("commander");
  453. user.removeGroup("corporal");
  454. }
  455. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Commander" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 50000");
  456. cooldown6.add(p.getName());
  457. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  458. public void run() {
  459. cooldown6.remove(p.getName());
  460. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Commander" + ChatColor.AQUA + " again!");
  461. }
  462. }, 792000); //11 hours
  463. return true;
  464. }
  465. }
  466. }
  467. // else {
  468. // sender.sendMessage("You do not have permission for this kit. Have you got the previous first ?");
  469. // }
  470. }
  471. /*
  472. * Sergeant
  473. *
  474. */
  475. if (args.length == 1) {
  476. if(sender.hasPermission("rkit.vip1")) {
  477. if (args[0].equalsIgnoreCase("Sergeant")) {
  478. if (cooldown7.contains(p.getName())) {
  479. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  480. return true;
  481. }
  482. EconomyResponse r = econ.withdrawPlayer(p.getName(), 75000);
  483. if (r.transactionSuccess()) {
  484. ItemStack is1 = new ItemStack(Material.DIAMOND_SWORD, 1);
  485. is1.addEnchantment(Enchantment.DAMAGE_ALL, 4);
  486. is1.addEnchantment(Enchantment.FIRE_ASPECT, 2);
  487. is1.addEnchantment(Enchantment.KNOCKBACK, 2);
  488. ItemStack is2 = new ItemStack(Material.DIAMOND_HELMET, 1);
  489. is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  490. is2.addEnchantment(Enchantment.PROTECTION_FIRE, 3);
  491. ItemStack is3 = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
  492. is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  493. is3.addEnchantment(Enchantment.PROTECTION_FIRE, 3);
  494. ItemStack is4 = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
  495. is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  496. is4.addEnchantment(Enchantment.PROTECTION_FIRE, 3);
  497. ItemStack is5 = new ItemStack(Material.DIAMOND_BOOTS, 1);
  498. is5.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  499. is5.addEnchantment(Enchantment.PROTECTION_FIRE, 3);
  500. ItemStack is6 = new ItemStack(Material.BOW, 1);
  501. is6.addEnchantment(Enchantment.ARROW_DAMAGE, 4);
  502. is6.addEnchantment(Enchantment.ARROW_KNOCKBACK, 2);
  503. is6.addEnchantment(Enchantment.ARROW_INFINITE, 1);
  504. pi.addItem(new ItemStack(Material.COOKED_BEEF, 64));
  505. p.getInventory().addItem(is1, is2, is3, is4, is5, is6);
  506. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Sergeant" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 75000");
  507. cooldown7.add(p.getName());
  508. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  509. public void run() {
  510. cooldown7.remove(p.getName());
  511. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Sergeant" + ChatColor.AQUA + " again!");
  512. }
  513. }, 864000); //12 hours
  514. return true;
  515. }
  516. else {
  517. p.sendMessage(ChatColor.RED + "Could not execute transaction. Got enough coins ?");
  518. return true;
  519. }
  520. }
  521. }
  522. // else {
  523. // p.sendMessage(ChatColor.RED + "You do not have permission for this Donators kit.");
  524. // }
  525. }
  526. /*
  527. * Sergeant Major
  528. */
  529. if (args.length == 1) {
  530. if(sender.hasPermission("rkit.vip2")) {
  531. if (args[0].equalsIgnoreCase("SergeantMajor")) {
  532. if (cooldown8.contains(p.getName())) {
  533. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  534. return true;
  535. }
  536. EconomyResponse r = econ.withdrawPlayer(p.getName(), 90000);
  537. if (r.transactionSuccess()) {
  538. ItemStack is = new ItemStack(Material.DIAMOND_SWORD, 1);
  539. is.addEnchantment(Enchantment.DAMAGE_ALL, 4);
  540. is.addEnchantment(Enchantment.FIRE_ASPECT, 2);
  541. is.addEnchantment(Enchantment.KNOCKBACK, 2);
  542. ItemStack is1 = new ItemStack(Material.DIAMOND_HELMET, 1);
  543. is1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  544. is1.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  545. is1.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  546. ItemStack is2 = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
  547. is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  548. is2.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  549. is2.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  550. ItemStack is3 = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
  551. is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  552. is3.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  553. is3.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  554. ItemStack is4 = new ItemStack(Material.DIAMOND_BOOTS, 1);
  555. is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  556. is4.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  557. is4.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  558. ItemStack is5 = new ItemStack(Material.BOW, 1);
  559. is5.addEnchantment(Enchantment.ARROW_DAMAGE, 4);
  560. is5.addEnchantment(Enchantment.ARROW_FIRE, 1);
  561. is5.addEnchantment(Enchantment.ARROW_KNOCKBACK, 2);
  562. is5.addEnchantment(Enchantment.ARROW_INFINITE, 1);
  563. pi.addItem(new ItemStack(Material.COOKED_BEEF, 64));
  564. pi.addItem(new ItemStack(Material.GOLDEN_APPLE, 16));
  565. p.getInventory().addItem(is, is1, is2, is3, is4, is5);
  566. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Sergeant Major" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 90000");
  567. cooldown8.add(p.getName());
  568. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  569. public void run() {
  570. cooldown8.remove(p.getName());
  571. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Sergeant Major" + ChatColor.AQUA + " again!");
  572. }
  573. }, 864000); //12 hours
  574. return true;
  575. }
  576. else {
  577. p.sendMessage(ChatColor.RED + "Could not execute transaction. Got enough coins ?");
  578. return true;
  579. }
  580. }
  581. }
  582. // else {
  583. // p.sendMessage(ChatColor.RED + "You do not have permission for this Donators kit.");
  584. // }
  585.  
  586. }
  587. /*
  588. * Master Sergeant
  589. */
  590. if (args.length == 1) {
  591. if(sender.hasPermission("rkit.vip3")) {
  592. if (args[0].equalsIgnoreCase("MasterSergeant")) {
  593. if (cooldown9.contains(p.getName())) {
  594. p.sendMessage(ChatColor.RED + "This kit is on cooldown!");
  595. return true;
  596. }
  597. EconomyResponse r = econ.withdrawPlayer(p.getName(), 100000);
  598. if (r.transactionSuccess()) {
  599. ItemStack is = new ItemStack(Material.DIAMOND_SWORD, 1);
  600. is.addEnchantment(Enchantment.DAMAGE_ALL, 5);
  601. is.addEnchantment(Enchantment.FIRE_ASPECT, 2);
  602. is.addEnchantment(Enchantment.KNOCKBACK, 2);
  603. is.addEnchantment(Enchantment.DURABILITY, 3);
  604. ItemStack is1 = new ItemStack(Material.DIAMOND_HELMET, 1);
  605. is1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  606. is1.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  607. is1.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  608. ItemStack is2 = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
  609. is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  610. is2.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  611. is2.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  612. ItemStack is3 = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
  613. is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  614. is3.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  615. is3.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  616. ItemStack is4 = new ItemStack(Material.DIAMOND_BOOTS, 1);
  617. is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  618. is4.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
  619. is4.addEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 4);
  620. ItemStack is5 = new ItemStack(Material.BOW, 1);
  621. is5.addEnchantment(Enchantment.ARROW_DAMAGE, 4);
  622. is5.addEnchantment(Enchantment.ARROW_FIRE, 1);
  623. is5.addEnchantment(Enchantment.ARROW_KNOCKBACK, 2);
  624. is5.addEnchantment(Enchantment.ARROW_INFINITE, 1);
  625. pi.addItem(new ItemStack(Material.COOKED_BEEF, 64));
  626. pi.addItem(new ItemStack(Material.GOLDEN_APPLE, 32));
  627. p.getInventory().addItem(is, is1, is2, is3, is4, is5);
  628. p.sendMessage(ChatColor.AQUA + "You got kit" + ChatColor.GREEN + " Master Sergeant" + ChatColor.AQUA + " at the cost of" + ChatColor.GREEN + " 100000");
  629. cooldown9.add(p.getName());
  630. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  631. public void run() {
  632. cooldown9.remove(p.getName());
  633. p.sendMessage(ChatColor.AQUA + "you can now use kit" + ChatColor.GREEN + " Master Sergeant" + ChatColor.AQUA + " again!");
  634. }
  635. }, 864000); //12 hours
  636. return true;
  637. }
  638. else {
  639. p.sendMessage(ChatColor.RED + "Could not execute transaction. Got enough coins ?");
  640. return true;
  641. }
  642.  
  643. }
  644. }
  645. // else {
  646. // p.sendMessage(ChatColor.RED + "You do not have permission for this Donators kit.");
  647. // }
  648. }
  649. }
  650. return true;
  651. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement