Need help with custom plugin :( - not showing in /plugins

Discussion in 'Plugin Help/Development/Requests' started by AFK Games, Apr 18, 2015.

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

    AFK Games

    Hello, I recently updated my custom plugin and its not showing in /plugins so...
    heres my code:

    If you could also suggest any usual problems that would be great thanks, sorry :(

    Code:java
    1. /* MAIN CLASS */
    2. package me.AFKGames;
    3.  
    4. import java.util.List;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Location;
    9. import org.bukkit.Material;
    10. import org.bukkit.OfflinePlayer;
    11. import org.bukkit.World;
    12. import org.bukkit.command.Command;
    13. import org.bukkit.command.CommandSender;
    14. import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
    15. import org.bukkit.entity.Arrow;
    16. import org.bukkit.entity.Entity;
    17. import org.bukkit.entity.Item;
    18. import org.bukkit.entity.Player;
    19. import org.bukkit.inventory.ItemStack;
    20. import org.bukkit.plugin.java.JavaPlugin;
    21. import org.bukkit.potion.Potion;
    22. import org.bukkit.potion.PotionEffect;
    23. import org.bukkit.potion.PotionType;
    24. import org.bukkit.scheduler.BukkitScheduler;
    25.  
    26. public class MainClass extends JavaPlugin {
    27.  
    28. @Override
    29. public void onEnable()
    30. {
    31. new ListenerClass(this);
    32. this.getConfig().options().copyDefaults(true);
    33. saveConfig();
    34.  
    35. //Remove ground items every 8 minutes.
    36. BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
    37. scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
    38. @Override
    39. public void run()
    40. {
    41. for(Player p: Bukkit.getOnlinePlayers())
    42. {
    43. TitleSender.sendActionBar(p, "" + ChatColor.RED + ChatColor.BOLD + "Removed all ground items.");
    44. TitleSender.sendTitle(p, ChatColor.GREEN + "Free Tokens", ChatColor.GREEN + "Thanks for playing here.");
    45.  
    46. int times = getConfig().getInt(p.getName() + ".tokens");
    47. times += 50;
    48. getConfig().set(p.getName() + ".tokens", times);
    49. p.sendMessage(ChatColor.GREEN + "You have earned 50 tokens.");
    50. saveConfig();
    51. p.sendMessage(ChatColor.WHITE + "You now have " + getConfig().getInt(p.getName() + ".tokens") + " tokens.");
    52.  
    53. }
    54.  
    55. World world = getServer().getWorld("world");
    56. List<Entity> entList = world.getEntities();
    57. for(Entity current : entList)
    58. {
    59. if (current instanceof Item || current instanceof Arrow)
    60. {
    61. current.remove();
    62. }
    63. }
    64.  
    65. }
    66.  
    67. }, 0L, 8000L);
    68.  
    69. ListenerClass ls = new ListenerClass(this);
    70. ls.UpdateDonators();
    71. ls.UpdateHelpers();
    72. ls.UpdateSwears();
    73. ls.UpdateTwitchers();
    74.  
    75. }
    76.  
    77. @Override
    78. public void onDisable()
    79. {
    80. saveConfig();
    81. }
    82.  
    83. public static ListenerClass listen = new ListenerClass(new MainClass());
    84.  
    85. @SuppressWarnings("deprecation")
    86. public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args)
    87. {
    88.  
    89. //Moderator commands!
    90. if(cmd.getName().equalsIgnoreCase("mod") && sender instanceof Player)
    91. {
    92.  
    93. Player player = (Player) sender;
    94.  
    95. if(!listen.getRoomList().contains(player) || !player.isOp())
    96. {
    97. player.sendMessage(ChatColor.RED + "Only assigned for staff use only!");
    98. return true;
    99. }
    100.  
    101. if(args.length == 0 || args.length == 1)
    102. {
    103. player.sendMessage(ChatColor.RED + "Usage: /mod kick <player>");
    104. player.sendMessage(ChatColor.RED + "Usage: /mod ban <player>");
    105. player.sendMessage(ChatColor.RED + "Usage: /mod unban <player>");
    106. player.sendMessage(ChatColor.RED + "Usage: /mod warn <player>");
    107. return true;
    108. }
    109.  
    110. if(args[0].equalsIgnoreCase("kick"))
    111. {
    112. Player victim = Bukkit.getPlayerExact(args[1]);
    113.  
    114. if(victim == null)
    115. {
    116. player.sendMessage(ChatColor.RED + "Could not find player " + args[1]);
    117. return true;
    118. }
    119.  
    120. if(victim.isOp())
    121. {
    122. player.sendMessage(ChatColor.RED + "You can not kick an operator!");
    123. return true;
    124. }
    125.  
    126. if(victim == player)
    127. {
    128. player.sendMessage(ChatColor.RED + "You can not kick yourself!");
    129. return true;
    130. }
    131.  
    132. player.sendMessage(ChatColor.RED + "You kicked " + ChatColor.GOLD + victim.getName());
    133. victim.kickPlayer(ChatColor.RED + "Kicked by " + player.getName());
    134.  
    135. }
    136.  
    137. if(args[0].equalsIgnoreCase("ban"))
    138. {
    139. Player victim = Bukkit.getPlayerExact(args[1]);
    140.  
    141. if(victim == null)
    142. {
    143. player.sendMessage(ChatColor.RED + "Could not find player " + args[1]);
    144. return true;
    145. }
    146.  
    147. if(victim.isOp())
    148. {
    149. player.sendMessage(ChatColor.RED + "You can not ban an operator!");
    150. return true;
    151. }
    152.  
    153. if(victim == player)
    154. {
    155. player.sendMessage(ChatColor.RED + "You can not ban yourself!");
    156. return true;
    157. }
    158.  
    159. player.sendMessage(ChatColor.RED + "You banned " + ChatColor.GOLD + victim.getName());
    160. victim.kickPlayer(ChatColor.RED + "Banned by " + player.getName());
    161. victim.setBanned(true);
    162.  
    163. }
    164.  
    165. if(args[0].equalsIgnoreCase("unban"))
    166. {
    167. OfflinePlayer target = player.getServer().getOfflinePlayer(args[1]);
    168.  
    169. if(target == player)
    170. {
    171. player.sendMessage(ChatColor.RED + "You can not unban yourself!");
    172. return true;
    173. }
    174.  
    175. if(!target.isBanned())
    176. {
    177. player.sendMessage(ChatColor.RED + "Player is not banned!");
    178. return true;
    179. }
    180.  
    181. player.sendMessage(ChatColor.RED + "You unbanned " + ChatColor.GOLD + target.getName());
    182. target.setBanned(false);
    183.  
    184. }
    185.  
    186. if(args[0].equalsIgnoreCase("warn"))
    187. {
    188. Player victim = Bukkit.getPlayerExact(args[1]);
    189.  
    190. if(victim == player)
    191. {
    192. player.sendMessage(ChatColor.RED + "You can not warn yourself!");
    193. return true;
    194. }
    195. player.sendMessage(ChatColor.RED + "You warned " + ChatColor.GOLD + victim.getName());
    196. victim.sendMessage(ChatColor.RED + "You have been warned by " + ChatColor.GOLD + player.getName());
    197.  
    198. }
    199.  
    200.  
    201. return true;
    202. }
    203.  
    204.  
    205.  
    206. if(cmd.getName().equalsIgnoreCase("donate") && sender instanceof Player)
    207. {
    208. Player player = (Player) sender;
    209. player.sendMessage("§l§m@------§r- §r§lDONATE §l§m--------§r§l@");
    210. player.sendMessage("§6§l[URL='http://goo.gl/df7Qj8'][U]http://goo.gl/df7Qj8[/U][/URL]");
    211. player.sendMessage("§l§m@-----------------§r§l@");
    212. return true;
    213. }
    214.  
    215. if(cmd.getName().equalsIgnoreCase("vote") && sender instanceof Player)
    216. {
    217. Player player = (Player) sender;
    218. player.sendMessage("§l§m@------§r- §r§lVOTE §l§m--------§r§l@");
    219. player.sendMessage("§6§l[URL='http://goo.gl/KU7tJs'][U]http://goo.gl/KU7tJs[/U][/URL]");
    220. player.sendMessage("§l§m@-----------------§r§l@");
    221. return true;
    222. }
    223.  
    224. //Mob frenzy
    225. if(cmd.getName().equalsIgnoreCase("mf") && sender instanceof Player)
    226. {
    227. Player player = (Player) sender;
    228. player.teleport(new Location(Bukkit.getWorld("world"), (double)1000.169, (double)74.0, (double)1013.026, (float)-39.7041, (float)1.0102539));
    229. return true;
    230. }
    231.  
    232.  
    233. /* ARENA 1 */
    234.  
    235. if(cmd.getName().equalsIgnoreCase("a1") && sender instanceof Player)
    236. {
    237.  
    238. Player player = (Player) sender;
    239.  
    240. player.teleport(new Location(Bukkit.getWorld("world"), (double)1035.52139, (double)67.0, (double)974.482, (float)-178.82104, (float)2.3532715));
    241. TitleSender.sendTitle(player, ChatColor.DARK_GRAY + "Castle", ChatColor.YELLOW + "Welcome to Arena 1");
    242.  
    243. return true;
    244.  
    245. }
    246.  
    247. /* ARENA 2 */
    248. if(cmd.getName().equalsIgnoreCase("a2") && sender instanceof Player)
    249. {
    250.  
    251. Player player = (Player) sender;
    252.  
    253. player.teleport(new Location(Bukkit.getWorld("world"), (double)1071.26, (double)73.0, (double)1038.139, (float)-222.877, (float)5.26));
    254. TitleSender.sendTitle(player, ChatColor.RED + "Nether", ChatColor.YELLOW + "Welcome to Arena 2");
    255.  
    256. return true;
    257.  
    258. }
    259.  
    260. /* ARENA 3 */
    261. if(cmd.getName().equalsIgnoreCase("a3") && sender instanceof Player)
    262. {
    263.  
    264. Player player = (Player) sender;
    265.  
    266. player.teleport(new Location(Bukkit.getWorld("world"), (double)967.014, (double)69.0, (double)995.165, (float)-180.281, (float)0.111));
    267. TitleSender.sendTitle(player, ChatColor.AQUA + "Ice Age", ChatColor.YELLOW + "Welcome to Arena 3");
    268.  
    269. return true;
    270.  
    271. }
    272.  
    273.  
    274. /* REST OF CODE */
    275. if(cmd.getName().equalsIgnoreCase("st") && sender instanceof Player)
    276. {
    277. Player op = (Player) sender;
    278.  
    279. if(op.isOp())
    280. {
    281. Player player;
    282.  
    283. try
    284. {
    285. player = Bukkit.getServer().getPlayerExact(args[0]);
    286. }
    287. catch(Exception ex)
    288. {
    289. op.sendMessage("Could not find player, use the correct syntax!");
    290. return false;
    291. }
    292.  
    293. if(getConfig().getInt(player.getName() + ".tokens") == 0)
    294. {
    295. getConfig().set(player.getName() + ".tokens", Integer.parseInt(args[1]));
    296. saveConfig();
    297. op.sendMessage("Set " + args[0] + "'s tokens to: " + Integer.parseInt(args[1]));
    298. }
    299. else
    300. {
    301. getConfig().set(player.getName() + ".tokens", Integer.parseInt(args[1]));
    302. saveConfig();
    303. op.sendMessage("Set " + args[0] + "'s tokens to: " + Integer.parseInt(args[1]));
    304. }
    305.  
    306.  
    307. return true;
    308. }
    309. else
    310. {
    311. op.sendMessage("Only reserved for operators to use!");
    312. return false;
    313. }
    314.  
    315. }
    316.  
    317. if(cmd.getName().equalsIgnoreCase("tokens") && sender instanceof Player)
    318. {
    319. Player player = (Player) sender;
    320.  
    321. if(getConfig().getInt(player.getName() + ".tokens") == 0)
    322. {
    323. player.sendMessage(ChatColor.WHITE + "You have no tokens! :(");
    324. }
    325. else
    326. {
    327. player.sendMessage(ChatColor.WHITE + "You have " + getConfig().getInt(player.getName() + ".tokens") + " tokens.");
    328. }
    329.  
    330. return true;
    331.  
    332. }
    333.  
    334. if(cmd.getName().equalsIgnoreCase("hub") && sender instanceof Player)
    335. {
    336. Player player = (Player) sender;
    337.  
    338. player.sendMessage("" + ChatColor.AQUA + ChatColor.BOLD + "Teleported to the main hub.");
    339. player.teleport(new Location(Bukkit.getWorld("world"), (double)1056.865, (double)65.0, (double)984.931, (float)-269.6558, (float)-0.7958078));
    340.  
    341. for (PotionEffect effect : player.getActivePotionEffects())
    342. {
    343. player.removePotionEffect(effect.getType());
    344. }
    345.  
    346. ((CraftPlayer)player).getHandle().getDataWatcher().watch(9, (byte) 0);
    347.  
    348. player.setFoodLevel(20);
    349. player.setHealth(20.0);
    350.  
    351. return true;
    352. }
    353.  
    354. if(cmd.getName().equalsIgnoreCase("news") && sender instanceof Player)
    355. {
    356. Player player = (Player) sender;
    357. if(player.isOp())
    358. {
    359. String myString = "";
    360.  
    361. for(int i = 0; i < args.length; i++)
    362. {
    363. String arg = args[I] + " ";
    364. myString = myString + arg;
    365. }
    366.  
    367. myString = myString.replace("'", "`");
    368.  
    369. for(Player p : Bukkit.getOnlinePlayers())
    370. {
    371. myString = myString.replace("$name", p.getName());
    372. myString = myString.replace("$world", p.getWorld().getName());
    373. }
    374.  
    375. myString = myString.replace("&0", "" + ChatColor.BLACK);
    376. myString = myString.replace("&1", "" + ChatColor.DARK_BLUE);
    377. myString = myString.replace("&2", "" + ChatColor.DARK_GREEN);
    378. myString = myString.replace("&3", "" + ChatColor.DARK_AQUA);
    379. myString = myString.replace("&4", "" + ChatColor.DARK_RED);
    380. myString = myString.replace("&5", "" + ChatColor.DARK_PURPLE);
    381. myString = myString.replace("&6", "" + ChatColor.GOLD);
    382. myString = myString.replace("&7", "" + ChatColor.GRAY);
    383. myString = myString.replace("&8", "" + ChatColor.DARK_GRAY);
    384. myString = myString.replace("&9", "" + ChatColor.BLUE);
    385. myString = myString.replace("&a", "" + ChatColor.GREEN);
    386. myString = myString.replace("&b", "" + ChatColor.AQUA);
    387. myString = myString.replace("&c", "" + ChatColor.RED);
    388. myString = myString.replace("&d", "" + ChatColor.LIGHT_PURPLE);
    389. myString = myString.replace("&e", "" + ChatColor.YELLOW);
    390. myString = myString.replace("&f", "" + ChatColor.WHITE);
    391.  
    392. myString = myString.replace("&k", "" + ChatColor.MAGIC);
    393. myString = myString.replace("&l", "" + ChatColor.BOLD);
    394. myString = myString.replace("&m", "" + ChatColor.STRIKETHROUGH);
    395. myString = myString.replace("&n", "" + ChatColor.UNDERLINE);
    396. myString = myString.replace("&o", "" + ChatColor.ITALIC);
    397. myString = myString.replace("&r", "" + ChatColor.RESET);
    398.  
    399.  
    400. for(Player p: player.getServer().getOnlinePlayers())
    401. {
    402. TitleSender.sendTitle(p, ChatColor.RED + "Important News", myString);
    403. }
    404. }
    405.  
    406. return true;
    407. }
    408.  
    409. if(cmd.getName().equalsIgnoreCase("pvp") && sender instanceof Player)
    410. {
    411. Player player = (Player) sender;
    412.  
    413. try
    414. {
    415.  
    416. //Warrior class
    417. if(args[0].equalsIgnoreCase("1"))
    418. {
    419. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a warrior.");
    420.  
    421. player.getInventory().clear();
    422.  
    423. player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET, 1));
    424. player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
    425. player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
    426. player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
    427.  
    428. player.getInventory().addItem(new ItemStack(Material.IRON_SWORD, 1));
    429. player.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 5));
    430. }
    431.  
    432. //Archer class
    433. if(args[0].equalsIgnoreCase("2"))
    434. {
    435. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are an archer.");
    436.  
    437. player.getInventory().clear();
    438.  
    439. player.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET, 1));
    440. player.getInventory().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1));
    441. player.getInventory().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1));
    442. player.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS, 1));
    443.  
    444. player.getInventory().addItem(new ItemStack(Material.WOOD_AXE, 1));
    445. player.getInventory().addItem(new ItemStack(Material.BOW, 1));
    446. player.getInventory().addItem(new ItemStack(Material.ARROW, 30));
    447. player.getInventory().addItem(new ItemStack(Material.COOKED_MUTTON, 5));
    448. }
    449.  
    450. //Mage class
    451. if(args[0].equalsIgnoreCase("3"))
    452. {
    453. //Price of the class.
    454. int price = 50;
    455. int mytokens = getConfig().getInt(player.getName() + ".tokens");
    456.  
    457. //Check if price is big enough.
    458. if(mytokens >= price)
    459. {
    460. getConfig().set(player.getName() + ".tokens", mytokens - price);
    461. player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    462. saveConfig();
    463.  
    464. //The class itself.
    465. Potion potion1 = new Potion(PotionType.INSTANT_DAMAGE, 1, true, true);
    466. ItemStack ptn_1 = potion1.toItemStack(10);
    467.  
    468. Potion potion2 = new Potion(PotionType.POISON, 2, true, true);
    469. ItemStack ptn_2 = potion2.toItemStack(5);
    470.  
    471. Potion potion3 = new Potion(PotionType.WEAKNESS, 2, true, true);
    472. ItemStack ptn_3 = potion3.toItemStack(5);
    473.  
    474. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a mage.");
    475.  
    476. player.getInventory().clear();
    477.  
    478. player.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET, 1));
    479. player.getInventory().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1));
    480. player.getInventory().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS, 1));
    481. player.getInventory().setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
    482.  
    483. player.getInventory().addItem(new ItemStack(Material.WOOD_HOE, 1));
    484. player.getInventory().addItem(new ItemStack(Material.APPLE, 5));
    485. player.getInventory().addItem(ptn_1);
    486. player.getInventory().addItem(ptn_2);
    487. player.getInventory().addItem(ptn_3);
    488.  
    489. }
    490. else
    491. {
    492. player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    493. }
    494.  
    495.  
    496. }
    497.  
    498. //Guardian class
    499. if(args[0].equalsIgnoreCase("4"))
    500. {
    501. //Price of the class.
    502. int price = 100;
    503. int mytokens = getConfig().getInt(player.getName() + ".tokens");
    504.  
    505. //Check if price is big enough.
    506. if(mytokens >= price)
    507. {
    508. getConfig().set(player.getName() + ".tokens", mytokens - price);
    509. player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    510. saveConfig();
    511.  
    512. //The class itself.
    513. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a guardian.");
    514.  
    515. player.getInventory().clear();
    516.  
    517. player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET, 1));
    518. player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE, 1));
    519. player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS, 1));
    520. player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS, 1));
    521.  
    522. player.getInventory().addItem(new ItemStack(Material.STONE_AXE, 1));
    523. player.getInventory().addItem(new ItemStack(Material.BREAD, 5));
    524.  
    525. }
    526. else
    527. {
    528. player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    529. }
    530.  
    531. }
    532.  
    533. //Assassin class
    534. if(args[0].equalsIgnoreCase("5"))
    535. {
    536. //Price of the class.
    537. int price = 150;
    538. int mytokens = getConfig().getInt(player.getName() + ".tokens");
    539.  
    540. //Check if price is big enough.
    541. if(mytokens >= price)
    542. {
    543. getConfig().set(player.getName() + ".tokens", mytokens - price);
    544. player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    545. saveConfig();
    546.  
    547. //The class itself.
    548. Potion potion1 = new Potion(PotionType.INVISIBILITY, 2);
    549. ItemStack ptn_1 = potion1.toItemStack(10);
    550.  
    551. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are an assassin.");
    552.  
    553. player.getInventory().clear();
    554.  
    555. player.getInventory().setHelmet(null);
    556. player.getInventory().setChestplate(null);
    557. player.getInventory().setLeggings(null);
    558. player.getInventory().setBoots(null);
    559.  
    560. player.getInventory().addItem(new ItemStack(Material.DIAMOND_SWORD, 1));
    561. player.getInventory().addItem(new ItemStack(ptn_1));
    562. player.getInventory().addItem(new ItemStack(Material.GOLDEN_CARROT, 3));
    563.  
    564. }
    565. else
    566. {
    567. player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    568. }
    569.  
    570. }
    571.  
    572. //Ender class
    573. if(args[0].equalsIgnoreCase("6"))
    574. {
    575.  
    576. //Price of the class.
    577. int price = 250;
    578. int mytokens = getConfig().getInt(player.getName() + ".tokens");
    579.  
    580. //Check if price is big enough.
    581. if(mytokens >= price)
    582. {
    583. getConfig().set(player.getName() + ".tokens", mytokens - price);
    584. player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    585. saveConfig();
    586.  
    587. //The class itself.
    588. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are an ender.");
    589.  
    590. player.getInventory().clear();
    591.  
    592. player.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET));
    593. player.getInventory().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
    594. player.getInventory().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
    595. player.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
    596.  
    597. player.getInventory().addItem(new ItemStack(Material.STONE_SPADE, 1));
    598. player.getInventory().addItem(new ItemStack(Material.ENDER_PEARL, 10));
    599. player.getInventory().addItem(new ItemStack(Material.COOKED_FISH, 5));
    600.  
    601. }
    602. else
    603. {
    604. player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    605. }
    606.  
    607. }
    608.  
    609. //Legend class
    610. if(args[0].equalsIgnoreCase("7"))
    611. {
    612. //Price of the class.
    613. int price = 350;
    614. int mytokens = getConfig().getInt(player.getName() + ".tokens");
    615.  
    616. //Check if price is big enough.
    617. if(mytokens >= price)
    618. {
    619. getConfig().set(player.getName() + ".tokens", mytokens - price);
    620. saveConfig();
    621. player.sendMessage(ChatColor.WHITE + "You now have " + mytokens + " tokens.");
    622.  
    623. //The class itself.
    624. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a legend.");
    625.  
    626. player.getInventory().clear();
    627.  
    628. player.getInventory().setHelmet(new ItemStack(Material.GOLD_HELMET));
    629. player.getInventory().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
    630. player.getInventory().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
    631. player.getInventory().setBoots(new ItemStack(Material.GOLD_BOOTS));
    632.  
    633. player.getInventory().addItem(new ItemStack(Material.GOLD_SWORD, 1));
    634. player.getInventory().addItem(new ItemStack(Material.APPLE, 5));
    635.  
    636. }
    637. else
    638. {
    639. player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    640. }
    641.  
    642.  
    643. }
    644.  
    645. //Cleric class
    646. if(args[0].equalsIgnoreCase("8"))
    647. {
    648. //Price of the class.
    649. int price = 400;
    650. int mytokens = getConfig().getInt(player.getName() + ".tokens");
    651.  
    652. //Check if price is big enough.
    653. if(mytokens >= price)
    654. {
    655. getConfig().set(player.getName() + ".tokens", mytokens - price);
    656. saveConfig();
    657. player.sendMessage(ChatColor.WHITE + "You now have " + mytokens + " tokens.");
    658.  
    659. //The class itself.
    660.  
    661. Potion potion1 = new Potion(PotionType.INSTANT_HEAL, 2, true, true);
    662. ItemStack ptn_1 = potion1.toItemStack(10);
    663.  
    664. Potion potion2 = new Potion(PotionType.REGEN, 2, true, true);
    665. ItemStack ptn_2 = potion2.toItemStack(10);
    666.  
    667. Potion potion3 = new Potion(PotionType.JUMP, 2, true, true);
    668. ItemStack ptn_3 = potion3.toItemStack(5);
    669.  
    670. Potion potion4 = new Potion(PotionType.SPEED, 2, true, true);
    671. ItemStack ptn_4 = potion4.toItemStack(5);
    672.  
    673. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a cleric.");
    674.  
    675. player.getInventory().clear();
    676.  
    677. player.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET, 1));
    678. player.getInventory().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
    679. player.getInventory().setLeggings(new ItemStack(Material.GOLD_LEGGINGS, 1));
    680. player.getInventory().setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
    681.  
    682. player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD, 1));
    683. player.getInventory().addItem(new ItemStack(ptn_1));
    684. player.getInventory().addItem(new ItemStack(ptn_2));
    685. player.getInventory().addItem(new ItemStack(ptn_3));
    686. player.getInventory().addItem(new ItemStack(ptn_4));
    687.  
    688. }
    689. else
    690. {
    691. player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    692. }
    693.  
    694. }
    695.  
    696. //Reaper class.
    697. if(args[0].equalsIgnoreCase("9"))
    698. {
    699. //Price of the class.
    700. int price = 500;
    701. int mytokens = getConfig().getInt(player.getName() + ".tokens");
    702.  
    703. //Check if price is big enough.
    704. if(mytokens >= price)
    705. {
    706. getConfig().set(player.getName() + ".tokens", mytokens - price);
    707. player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    708. saveConfig();
    709.  
    710. //The class itself.
    711. TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a reaper.");
    712.  
    713. player.getInventory().clear();
    714.  
    715. player.getInventory().setHelmet(new ItemStack(Material.PUMPKIN, 1));
    716. player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
    717. player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
    718. player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
    719.  
    720. player.getInventory().addItem(new ItemStack(Material.IRON_SWORD, 1));
    721. player.getInventory().addItem(new ItemStack(Material.IRON_AXE, 1));
    722. player.getInventory().addItem(new ItemStack(Material.FISHING_ROD, 1));
    723. player.getInventory().addItem(new ItemStack(Material.EGG, 10));
    724.  
    725. player.getInventory().addItem(new ItemStack(Material.COOKED_RABBIT, 5));
    726. }
    727. else
    728. {
    729. player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    730. }
    731.  
    732. }
    733.  
    734.  
    735. for (PotionEffect effect : player.getActivePotionEffects())
    736. {
    737. player.removePotionEffect(effect.getType());
    738. }
    739.  
    740. ((CraftPlayer)player).getHandle().getDataWatcher().watch(9, (byte) 0);
    741.  
    742. player.setFoodLevel(20);
    743. player.setHealth(20.0);
    744.  
    745. }
    746. catch(Exception ex)
    747. {
    748. player.sendMessage(ChatColor.BOLD + "Please choose your class: (/pvp <id>)");
    749. player.sendMessage(ChatColor.YELLOW + "[1] Warrior - Free");
    750. player.sendMessage(ChatColor.YELLOW + "[2] Archer - Free");
    751. player.sendMessage(ChatColor.YELLOW + "[3] Mage - 50 Tokens");
    752. player.sendMessage(ChatColor.YELLOW + "[4] Guardian - 100 Tokens");
    753. player.sendMessage(ChatColor.YELLOW + "[5] Assassin - 150 Tokens");
    754. player.sendMessage(ChatColor.YELLOW + "[6] Ender - 250 Tokens");
    755. player.sendMessage(ChatColor.YELLOW + "[7] Legend - 350 Tokens");
    756. player.sendMessage(ChatColor.YELLOW + "[8] Cleric - 400 Tokens");
    757. player.sendMessage(ChatColor.YELLOW + "[9] Reaper - 500 Tokens");
    758. player.sendMessage("" + ChatColor.DARK_RED + ChatColor.BOLD + "Warning, you will lose current items if you select a kit!");
    759. player.performCommand("tokens");
    760. }
    761.  
    762.  
    763.  
    764. return true;
    765. }
    766.  
    767.  
    768. if(cmd.getName().equalsIgnoreCase("getpos") && sender instanceof Player)
    769. {
    770. Player player = (Player) sender;
    771.  
    772. //Send player their current co-ordinates.
    773. player.sendMessage("X: " + player.getLocation().getX());
    774. player.sendMessage("Y: " + player.getLocation().getY());
    775. player.sendMessage("Z: " + player.getLocation().getZ());
    776. player.sendMessage("Yaw: " + player.getLocation().getYaw());
    777. player.sendMessage("Pitch: " + player.getLocation().getPitch());
    778.  
    779. return true;
    780. }
    781.  
    782. return false;
    783. }
    784.  
    785.  
    786.  
    787. }
    788.  
    789. /* LISTENER CLASS */
    790. package me.AFKGames;
    791.  
    792. import java.util.ArrayList;
    793. import java.util.Iterator;
    794. import java.util.List;
    795.  
    796. import net.minecraft.server.v1_8_R1.EnumClientCommand;
    797. import net.minecraft.server.v1_8_R1.PacketPlayInClientCommand;
    798.  
    799. import org.bukkit.Bukkit;
    800. import org.bukkit.ChatColor;
    801. import org.bukkit.Location;
    802. import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
    803. import org.bukkit.entity.Player;
    804. import org.bukkit.event.EventHandler;
    805. import org.bukkit.event.Listener;
    806. import org.bukkit.event.entity.EntityDeathEvent;
    807. import org.bukkit.event.entity.PlayerDeathEvent;
    808. import org.bukkit.event.player.AsyncPlayerChatEvent;
    809. import org.bukkit.event.player.PlayerEggThrowEvent;
    810. import org.bukkit.event.player.PlayerJoinEvent;
    811. import org.bukkit.event.player.PlayerQuitEvent;
    812. import org.bukkit.scheduler.BukkitScheduler;
    813.  
    814. public class ListenerClass implements Listener {
    815.  
    816. MainClass configGetter;
    817.  
    818. public List<String> swears = new ArrayList<String>();
    819. public List<Player> donators = new ArrayList<Player>();
    820. public List<Player> twitchers = new ArrayList<Player>();
    821. public List<Player> helpers = new ArrayList<Player>();
    822.  
    823. public List<Player> getRoomList() {
    824. return this.helpers;
    825. }
    826.  
    827. public void UpdateSwears()
    828. {
    829. swears.add("fuck");
    830. swears.add("shit");
    831. swears.add("dick");
    832. swears.add("penis");
    833. swears.add("vagina");
    834. swears.add("noob");
    835. swears.add("nigga");
    836. swears.add("nigger");
    837. swears.add("crap");
    838. swears.add("omfg");
    839. swears.add("stfu");
    840. swears.add("gay");
    841. swears.add("lezbo");
    842. swears.add("lezbian");
    843. swears.add("slave");
    844. swears.add("n00b");
    845. swears.add("n.o.o.b");
    846. swears.add("n o o b");
    847. }
    848.  
    849. @SuppressWarnings("deprecation")
    850. public void UpdateDonators()
    851. {
    852. donators.add(Bukkit.getPlayerExact("purplegangzter"));
    853. }
    854.  
    855. @SuppressWarnings("deprecation")
    856. public void UpdateTwitchers()
    857. {
    858. twitchers.add(Bukkit.getPlayerExact("xNoiisy"));
    859. twitchers.add(Bukkit.getPlayerExact("xAlex_HD"));
    860. twitchers.add(Bukkit.getPlayerExact("BenJaminHD3"));
    861. twitchers.add(Bukkit.getPlayerExact("Smoothness"));
    862. }
    863.  
    864. @SuppressWarnings("deprecation")
    865. public void UpdateHelpers()
    866. {
    867. helpers.add(Bukkit.getPlayerExact("577littleman"));
    868. }
    869.  
    870. public ListenerClass(MainClass plugin)
    871. {
    872. plugin.getServer().getPluginManager().registerEvents(this, plugin);
    873. configGetter = plugin;
    874.  
    875. BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
    876. scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {
    877. @Override
    878. public void run()
    879. {
    880. UpdateSwears();
    881. UpdateDonators();
    882. UpdateTwitchers();
    883. UpdateHelpers();
    884. }
    885.  
    886. }, 0L, 100L);
    887.  
    888. }
    889.  
    890. @EventHandler
    891. public void onPlayerJoin(PlayerJoinEvent e)
    892. {
    893. Player player = e.getPlayer();
    894. e.setJoinMessage(ChatColor.GREEN + "+ " + player.getName() + " joined the fight!");
    895. TitleSender.sendTitle(player, ChatColor.AQUA + "AFK Games Network", ChatColor.WHITE + "Please login/register to play!");
    896. player.teleport(new Location(Bukkit.getWorld("world"), (double)1056.865, (double)65.0, (double)984.931, (float)-269.6558, (float)-0.7958078));
    897.  
    898. ((CraftPlayer)player).getHandle().getDataWatcher().watch(9, (byte) 0);
    899.  
    900. player.setFoodLevel(20);
    901. player.setHealth(20.0);
    902. }
    903.  
    904. @EventHandler
    905. public void onPlayerQuit(PlayerQuitEvent e)
    906. {
    907. Player player = e.getPlayer();
    908. e.setQuitMessage(ChatColor.RED + "- " + player.getName() + " left the fight!");
    909. }
    910.  
    911. @EventHandler
    912. public void onEntityDeath(EntityDeathEvent e)
    913. {
    914. Player damaged = (Player) e.getEntity();
    915.  
    916. try
    917. {
    918. TitleSender.sendTitle(damaged, "", "" + ChatColor.RED + ChatColor.RED + "You have been killed!");
    919. }
    920. catch(Exception exc)
    921. {
    922. exc.getCause();
    923. }
    924. }
    925.  
    926. @EventHandler
    927. public void onPlayerDeath(PlayerDeathEvent e)
    928. {
    929. e.setDeathMessage(null);
    930.  
    931. Player damaged = (Player) e.getEntity();
    932. Player damager = (Player) e.getEntity().getKiller();
    933.  
    934. damaged.getInventory().clear();
    935. damaged.getInventory().setHelmet(null);
    936. damaged.getInventory().setChestplate(null);
    937. damaged.getInventory().setLeggings(null);
    938. damaged.getInventory().setBoots(null);
    939.  
    940. ((CraftPlayer)damaged).getHandle().playerConnection.a(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN));
    941.  
    942. if(damaged != damager)
    943. {
    944. int times = configGetter.getConfig().getInt(damager.getName() + ".tokens");
    945. times += 10;
    946. configGetter.getConfig().set(damager.getName() + ".tokens", times);
    947. damager.sendMessage(ChatColor.GREEN + "You have earned 10 tokens.");
    948. configGetter.saveConfig();
    949. damager.sendMessage(ChatColor.WHITE + "You now have " + configGetter.getConfig().getInt(damager.getName() + ".tokens") + " tokens.");
    950. }
    951.  
    952. }
    953.  
    954. @EventHandler
    955. public void chatFormat(AsyncPlayerChatEvent event)
    956. {
    957. Player p = event.getPlayer();
    958.  
    959. if(!p.isOp())
    960. {
    961. //URL's not to send in chat.
    962. if(event.getMessage().contains("http://") || event.getMessage().contains("https://") || event.getMessage().contains("www."))
    963. {
    964. p.sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You can not send URL's in the chat!");
    965. event.setCancelled(true);
    966. }
    967.  
    968. for (Iterator<String> itr = swears.iterator(); itr.hasNext(); )
    969. {
    970. String item = itr.next();
    971.  
    972. if(event.getMessage().toLowerCase().contains(item))
    973. {
    974. p.sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You can not swear in the chat!");
    975. event.setCancelled(true);
    976. }
    977. }
    978. }
    979.  
    980.  
    981. //Replace url.
    982. String u = event.getMessage();
    983. String ul = u.replace("$url", "[URL='http://afkgamesnetwork.freeforums.org/'][U]http://afkgamesnetwork.freeforums.org[/U][/URL]");
    984. event.setMessage(ul);
    985.  
    986. //Replace colour codes.
    987. if(p.isOp())
    988. {
    989. String t = event.getMessage();
    990. String tm = ChatColor.translateAlternateColorCodes('&', t);
    991. event.setMessage(tm);
    992. }
    993.  
    994. //Admin rank.
    995. if(p.isOp() && !p.getDisplayName().equalsIgnoreCase("AFK_Games"))
    996. {
    997. event.setFormat(ChatColor.BLUE + "[Admin] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    998. }
    999. else
    1000. {
    1001. //Owner rank
    1002. if(p.isOp() && p.getDisplayName().equalsIgnoreCase("AFK_Games"))
    1003. {
    1004. event.setFormat(ChatColor.GREEN + "[Owner] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    1005. }
    1006. else
    1007. {
    1008. if(donators.contains(p))
    1009. {
    1010. //Normal default guest rank
    1011. event.setFormat(ChatColor.YELLOW + "[Donator] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    1012. }
    1013. else
    1014. {
    1015. if(helpers.contains(p))
    1016. {
    1017. //Normal default guest rank
    1018. event.setFormat(ChatColor.AQUA + "[Helper] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    1019. }
    1020. else
    1021. {
    1022. if(twitchers.contains(p))
    1023. {
    1024. //Normal default guest rank
    1025. event.setFormat(ChatColor.DARK_PURPLE + "[Twitcher] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    1026. }
    1027. else
    1028. {
    1029. //Normal default guest rank
    1030. event.setFormat(ChatColor.WHITE + "[Guest] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    1031. }
    1032. }
    1033. }
    1034.  
    1035. }
    1036. }
    1037.  
    1038.  
    1039. }
    1040.  
    1041. @EventHandler
    1042. public void onEggThrown(PlayerEggThrowEvent e)
    1043. {
    1044. e.setHatching(false);
    1045.  
    1046. if(e.getEgg().getLastDamageCause() instanceof Player)
    1047. {
    1048. for(Player p: Bukkit.getServer().getOnlinePlayers())
    1049. {
    1050. if(e.getEgg().getLastDamageCause() == p)
    1051. {
    1052. p.damage((double)2);
    1053. }
    1054. }
    1055. }
    1056.  
    1057. }
    1058.  
    1059. }[/I]
     
    Last edited by a moderator: Apr 18, 2015
  2. Moved to Bukkit Alternates.
     
  3. Offline

    teej107

    @AFK Games Put your code in code tags please. I'm not reading your code. If a plugin fails to load, an error will show in the console or you've put your plugin in the wrong location.
     
  4. Offline

    BashyDaBest

    @AFK Games Like @teej107 said, put it in code tags and try to learn how to use multiple classes! All your commands are jammed into one class.
     
  5. Offline

    AFK Games

    Hello, I recently updated my custom plugin and its not showing in /plugins so...
    heres my code:

    If you could also suggest any usual problems that would be great thanks, sorry :(
    Code:
     /* MAIN CLASS */
    package me.AFKGames;
    
    import java.util.List;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.OfflinePlayer;
    import org.bukkit.World;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
    import org.bukkit.entity.Arrow;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Item;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.Potion;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionType;
    import org.bukkit.scheduler.BukkitScheduler;
    
    public class MainClass extends JavaPlugin {
    
    @Override
    public void onEnable()
    {
    new ListenerClass(this);
    this.getConfig().options().copyDefaults(true);
    saveConfig();
    
    //Remove ground items every 8 minutes.
    BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
    scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
    @Override
    public void run()
    {
    for(Player p: Bukkit.getOnlinePlayers())
    {
    TitleSender.sendActionBar(p, "" + ChatColor.RED + ChatColor.BOLD + "Removed all ground items.");
    TitleSender.sendTitle(p, ChatColor.GREEN + "Free Tokens", ChatColor.GREEN + "Thanks for playing here.");
    
    int times = getConfig().getInt(p.getName() + ".tokens");
    times += 50;
    getConfig().set(p.getName() + ".tokens", times);
    p.sendMessage(ChatColor.GREEN + "You have earned 50 tokens.");
    saveConfig();
    p.sendMessage(ChatColor.WHITE + "You now have " + getConfig().getInt(p.getName() + ".tokens") + " tokens.");
    
    }
    
    World world = getServer().getWorld("world");
    List<Entity> entList = world.getEntities();
    for(Entity current : entList)
    {
    if (current instanceof Item || current instanceof Arrow)
    {
    current.remove();
    }
    }
    
    }
    
    }, 0L, 8000L);
    
    ListenerClass ls = new ListenerClass(this);
    ls.UpdateDonators();
    ls.UpdateHelpers();
    ls.UpdateSwears();
    ls.UpdateTwitchers();
    
    }
    
    @Override
    public void onDisable()
    {
    saveConfig();
    }
    
    public static ListenerClass listen = new ListenerClass(new MainClass());
    
    @SuppressWarnings("deprecation")
    public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args)
    {
    
    //Moderator commands!
    if(cmd.getName().equalsIgnoreCase("mod") && sender instanceof Player)
    {
    
    Player player = (Player) sender;
    
    if(!listen.getRoomList().contains(player) || !player.isOp())
    {
    player.sendMessage(ChatColor.RED + "Only assigned for staff use only!");
    return true;
    }
    
    if(args.length == 0 || args.length == 1)
    {
    player.sendMessage(ChatColor.RED + "Usage: /mod kick <player>");
    player.sendMessage(ChatColor.RED + "Usage: /mod ban <player>");
    player.sendMessage(ChatColor.RED + "Usage: /mod unban <player>");
    player.sendMessage(ChatColor.RED + "Usage: /mod warn <player>");
    return true;
    }
    
    if(args[0].equalsIgnoreCase("kick"))
    {
    Player victim = Bukkit.getPlayerExact(args[1]);
    
    if(victim == null)
    {
    player.sendMessage(ChatColor.RED + "Could not find player " + args[1]);
    return true;
    }
    
    if(victim.isOp())
    {
    player.sendMessage(ChatColor.RED + "You can not kick an operator!");
    return true;
    }
    
    if(victim == player)
    {
    player.sendMessage(ChatColor.RED + "You can not kick yourself!");
    return true;
    }
    
    player.sendMessage(ChatColor.RED + "You kicked " + ChatColor.GOLD + victim.getName());
    victim.kickPlayer(ChatColor.RED + "Kicked by " + player.getName());
    
    }
    
    if(args[0].equalsIgnoreCase("ban"))
    {
    Player victim = Bukkit.getPlayerExact(args[1]);
    
    if(victim == null)
    {
    player.sendMessage(ChatColor.RED + "Could not find player " + args[1]);
    return true;
    }
    
    if(victim.isOp())
    {
    player.sendMessage(ChatColor.RED + "You can not ban an operator!");
    return true;
    }
    
    if(victim == player)
    {
    player.sendMessage(ChatColor.RED + "You can not ban yourself!");
    return true;
    }
    
    player.sendMessage(ChatColor.RED + "You banned " + ChatColor.GOLD + victim.getName());
    victim.kickPlayer(ChatColor.RED + "Banned by " + player.getName());
    victim.setBanned(true);
    
    }
    
    if(args[0].equalsIgnoreCase("unban"))
    {
    OfflinePlayer target = player.getServer().getOfflinePlayer(args[1]);
    
    if(target == player)
    {
    player.sendMessage(ChatColor.RED + "You can not unban yourself!");
    return true;
    }
    
    if(!target.isBanned())
    {
    player.sendMessage(ChatColor.RED + "Player is not banned!");
    return true;
    }
    
    player.sendMessage(ChatColor.RED + "You unbanned " + ChatColor.GOLD + target.getName());
    target.setBanned(false);
    
    }
    
    if(args[0].equalsIgnoreCase("warn"))
    {
    Player victim = Bukkit.getPlayerExact(args[1]);
    
    if(victim == player)
    {
    player.sendMessage(ChatColor.RED + "You can not warn yourself!");
    return true;
    }
    player.sendMessage(ChatColor.RED + "You warned " + ChatColor.GOLD + victim.getName());
    victim.sendMessage(ChatColor.RED + "You have been warned by " + ChatColor.GOLD + player.getName());
    
    }
    
    
    return true;
    }
    
    
    
    if(cmd.getName().equalsIgnoreCase("donate") && sender instanceof Player)
    {
    Player player = (Player) sender;
    player.sendMessage("§l§m@------§r- §r§lDONATE §l§m--------§r§l@");
    player.sendMessage("§6§lhttp://goo.gl/df7Qj8");
    player.sendMessage("§l§m@-----------------§r§l@");
    return true;
    }
    
    if(cmd.getName().equalsIgnoreCase("vote") && sender instanceof Player)
    {
    Player player = (Player) sender;
    player.sendMessage("§l§m@------§r- §r§lVOTE §l§m--------§r§l@");
    player.sendMessage("§6§lhttp://goo.gl/KU7tJs");
    player.sendMessage("§l§m@-----------------§r§l@");
    return true;
    }
    
    //Mob frenzy
    if(cmd.getName().equalsIgnoreCase("mf") && sender instanceof Player)
    {
    Player player = (Player) sender;
    player.teleport(new Location(Bukkit.getWorld("world"), (double)1000.169, (double)74.0, (double)1013.026, (float)-39.7041, (float)1.0102539));
    return true;
    }
    
    
    /* ARENA 1 */
    
    if(cmd.getName().equalsIgnoreCase("a1") && sender instanceof Player)
    {
    
    Player player = (Player) sender;
    
    player.teleport(new Location(Bukkit.getWorld("world"), (double)1035.52139, (double)67.0, (double)974.482, (float)-178.82104, (float)2.3532715));
    TitleSender.sendTitle(player, ChatColor.DARK_GRAY + "Castle", ChatColor.YELLOW + "Welcome to Arena 1");
    
    return true;
    
    }
    
    /* ARENA 2 */
    if(cmd.getName().equalsIgnoreCase("a2") && sender instanceof Player)
    {
    
    Player player = (Player) sender;
    
    player.teleport(new Location(Bukkit.getWorld("world"), (double)1071.26, (double)73.0, (double)1038.139, (float)-222.877, (float)5.26));
    TitleSender.sendTitle(player, ChatColor.RED + "Nether", ChatColor.YELLOW + "Welcome to Arena 2");
    
    return true;
    
    }
    
    /* ARENA 3 */
    if(cmd.getName().equalsIgnoreCase("a3") && sender instanceof Player)
    {
    
    Player player = (Player) sender;
    
    player.teleport(new Location(Bukkit.getWorld("world"), (double)967.014, (double)69.0, (double)995.165, (float)-180.281, (float)0.111));
    TitleSender.sendTitle(player, ChatColor.AQUA + "Ice Age", ChatColor.YELLOW + "Welcome to Arena 3");
    
    return true;
    
    }
    
    
    /* REST OF CODE */
    if(cmd.getName().equalsIgnoreCase("st") && sender instanceof Player)
    {
    Player op = (Player) sender;
    
    if(op.isOp())
    {
    Player player;
    
    try
    {
    player = Bukkit.getServer().getPlayerExact(args[0]);
    }
    catch(Exception ex)
    {
    op.sendMessage("Could not find player, use the correct syntax!");
    return false;
    }
    
    if(getConfig().getInt(player.getName() + ".tokens") == 0)
    {
    getConfig().set(player.getName() + ".tokens", Integer.parseInt(args[1]));
    saveConfig();
    op.sendMessage("Set " + args[0] + "'s tokens to: " + Integer.parseInt(args[1]));
    }
    else
    {
    getConfig().set(player.getName() + ".tokens", Integer.parseInt(args[1]));
    saveConfig();
    op.sendMessage("Set " + args[0] + "'s tokens to: " + Integer.parseInt(args[1]));
    }
    
    
    return true;
    }
    else
    {
    op.sendMessage("Only reserved for operators to use!");
    return false;
    }
    
    }
    
    if(cmd.getName().equalsIgnoreCase("tokens") && sender instanceof Player)
    {
    Player player = (Player) sender;
    
    if(getConfig().getInt(player.getName() + ".tokens") == 0)
    {
    player.sendMessage(ChatColor.WHITE + "You have no tokens! :(");
    }
    else
    {
    player.sendMessage(ChatColor.WHITE + "You have " + getConfig().getInt(player.getName() + ".tokens") + " tokens.");
    }
    
    return true;
    
    }
    
    if(cmd.getName().equalsIgnoreCase("hub") && sender instanceof Player)
    {
    Player player = (Player) sender;
    
    player.sendMessage("" + ChatColor.AQUA + ChatColor.BOLD + "Teleported to the main hub.");
    player.teleport(new Location(Bukkit.getWorld("world"), (double)1056.865, (double)65.0, (double)984.931, (float)-269.6558, (float)-0.7958078));
    
    for (PotionEffect effect : player.getActivePotionEffects())
    {
    player.removePotionEffect(effect.getType());
    }
    
    ((CraftPlayer)player).getHandle().getDataWatcher().watch(9, (byte) 0);
    
    player.setFoodLevel(20);
    player.setHealth(20.0);
    
    return true;
    }
    
    if(cmd.getName().equalsIgnoreCase("news") && sender instanceof Player)
    {
    Player player = (Player) sender;
    if(player.isOp())
    {
    String myString = "";
    
    for(int i = 0; i < args.length; i++)
    {
    String arg = args + " ";
    myString = myString + arg;
    }
    
    myString = myString.replace("'", "`");
    
    for(Player p : Bukkit.getOnlinePlayers())
    {
    myString = myString.replace("$name", p.getName());
    myString = myString.replace("$world", p.getWorld().getName());
    }
    
    myString = myString.replace("&0", "" + ChatColor.BLACK);
    myString = myString.replace("&1", "" + ChatColor.DARK_BLUE);
    myString = myString.replace("&2", "" + ChatColor.DARK_GREEN);
    myString = myString.replace("&3", "" + ChatColor.DARK_AQUA);
    myString = myString.replace("&4", "" + ChatColor.DARK_RED);
    myString = myString.replace("&5", "" + ChatColor.DARK_PURPLE);
    myString = myString.replace("&6", "" + ChatColor.GOLD);
    myString = myString.replace("&7", "" + ChatColor.GRAY);
    myString = myString.replace("&8", "" + ChatColor.DARK_GRAY);
    myString = myString.replace("&9", "" + ChatColor.BLUE);
    myString = myString.replace("&a", "" + ChatColor.GREEN);
    myString = myString.replace("&b", "" + ChatColor.AQUA);
    myString = myString.replace("&c", "" + ChatColor.RED);
    myString = myString.replace("&d", "" + ChatColor.LIGHT_PURPLE);
    myString = myString.replace("&e", "" + ChatColor.YELLOW);
    myString = myString.replace("&f", "" + ChatColor.WHITE);
    
    myString = myString.replace("&k", "" + ChatColor.MAGIC);
    myString = myString.replace("&l", "" + ChatColor.BOLD);
    myString = myString.replace("&m", "" + ChatColor.STRIKETHROUGH);
    myString = myString.replace("&n", "" + ChatColor.UNDERLINE);
    myString = myString.replace("&o", "" + ChatColor.ITALIC);
    myString = myString.replace("&r", "" + ChatColor.RESET);
    
    
    for(Player p: player.getServer().getOnlinePlayers())
    {
    TitleSender.sendTitle(p, ChatColor.RED + "Important News", myString);
    }
    }
    
    return true;
    }
    
    if(cmd.getName().equalsIgnoreCase("pvp") && sender instanceof Player)
    {
    Player player = (Player) sender;
    
    try
    {
    
    //Warrior class
    if(args[0].equalsIgnoreCase("1"))
    {
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a warrior.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET, 1));
    player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
    player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
    player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
    
    player.getInventory().addItem(new ItemStack(Material.IRON_SWORD, 1));
    player.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 5));
    }
    
    //Archer class
    if(args[0].equalsIgnoreCase("2"))
    {
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are an archer.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET, 1));
    player.getInventory().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1));
    player.getInventory().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1));
    player.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS, 1));
    
    player.getInventory().addItem(new ItemStack(Material.WOOD_AXE, 1));
    player.getInventory().addItem(new ItemStack(Material.BOW, 1));
    player.getInventory().addItem(new ItemStack(Material.ARROW, 30));
    player.getInventory().addItem(new ItemStack(Material.COOKED_MUTTON, 5));
    }
    
    //Mage class
    if(args[0].equalsIgnoreCase("3"))
    {
    //Price of the class.
    int price = 50;
    int mytokens = getConfig().getInt(player.getName() + ".tokens");
    
    //Check if price is big enough.
    if(mytokens >= price)
    {
    getConfig().set(player.getName() + ".tokens", mytokens - price);
    player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    saveConfig();
    
    //The class itself.
    Potion potion1 = new Potion(PotionType.INSTANT_DAMAGE, 1, true, true);
    ItemStack ptn_1 = potion1.toItemStack(10);
    
    Potion potion2 = new Potion(PotionType.POISON, 2, true, true);
    ItemStack ptn_2 = potion2.toItemStack(5);
    
    Potion potion3 = new Potion(PotionType.WEAKNESS, 2, true, true);
    ItemStack ptn_3 = potion3.toItemStack(5);
    
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a mage.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET, 1));
    player.getInventory().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1));
    player.getInventory().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS, 1));
    player.getInventory().setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
    
    player.getInventory().addItem(new ItemStack(Material.WOOD_HOE, 1));
    player.getInventory().addItem(new ItemStack(Material.APPLE, 5));
    player.getInventory().addItem(ptn_1);
    player.getInventory().addItem(ptn_2);
    player.getInventory().addItem(ptn_3);
    
    }
    else
    {
    player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    }
    
    
    }
    
    //Guardian class
    if(args[0].equalsIgnoreCase("4"))
    {
    //Price of the class.
    int price = 100;
    int mytokens = getConfig().getInt(player.getName() + ".tokens");
    
    //Check if price is big enough.
    if(mytokens >= price)
    {
    getConfig().set(player.getName() + ".tokens", mytokens - price);
    player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    saveConfig();
    
    //The class itself.
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a guardian.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET, 1));
    player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE, 1));
    player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS, 1));
    player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS, 1));
    
    player.getInventory().addItem(new ItemStack(Material.STONE_AXE, 1));
    player.getInventory().addItem(new ItemStack(Material.BREAD, 5));
    
    }
    else
    {
    player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    }
    
    }
    
    //Assassin class
    if(args[0].equalsIgnoreCase("5"))
    {
    //Price of the class.
    int price = 150;
    int mytokens = getConfig().getInt(player.getName() + ".tokens");
    
    //Check if price is big enough.
    if(mytokens >= price)
    {
    getConfig().set(player.getName() + ".tokens", mytokens - price);
    player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    saveConfig();
    
    //The class itself.
    Potion potion1 = new Potion(PotionType.INVISIBILITY, 2);
    ItemStack ptn_1 = potion1.toItemStack(10);
    
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are an assassin.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(null);
    player.getInventory().setChestplate(null);
    player.getInventory().setLeggings(null);
    player.getInventory().setBoots(null);
    
    player.getInventory().addItem(new ItemStack(Material.DIAMOND_SWORD, 1));
    player.getInventory().addItem(new ItemStack(ptn_1));
    player.getInventory().addItem(new ItemStack(Material.GOLDEN_CARROT, 3));
    
    }
    else
    {
    player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    }
    
    }
    
    //Ender class
    if(args[0].equalsIgnoreCase("6"))
    {
    
    //Price of the class.
    int price = 250;
    int mytokens = getConfig().getInt(player.getName() + ".tokens");
    
    //Check if price is big enough.
    if(mytokens >= price)
    {
    getConfig().set(player.getName() + ".tokens", mytokens - price);
    player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    saveConfig();
    
    //The class itself.
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are an ender.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET));
    player.getInventory().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
    player.getInventory().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
    player.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
    
    player.getInventory().addItem(new ItemStack(Material.STONE_SPADE, 1));
    player.getInventory().addItem(new ItemStack(Material.ENDER_PEARL, 10));
    player.getInventory().addItem(new ItemStack(Material.COOKED_FISH, 5));
    
    }
    else
    {
    player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    }
    
    }
    
    //Legend class
    if(args[0].equalsIgnoreCase("7"))
    {
    //Price of the class.
    int price = 350;
    int mytokens = getConfig().getInt(player.getName() + ".tokens");
    
    //Check if price is big enough.
    if(mytokens >= price)
    {
    getConfig().set(player.getName() + ".tokens", mytokens - price);
    saveConfig();
    player.sendMessage(ChatColor.WHITE + "You now have " + mytokens + " tokens.");
    
    //The class itself.
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a legend.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.GOLD_HELMET));
    player.getInventory().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
    player.getInventory().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
    player.getInventory().setBoots(new ItemStack(Material.GOLD_BOOTS));
    
    player.getInventory().addItem(new ItemStack(Material.GOLD_SWORD, 1));
    player.getInventory().addItem(new ItemStack(Material.APPLE, 5));
    
    }
    else
    {
    player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    }
    
    
    }
    
    //Cleric class
    if(args[0].equalsIgnoreCase("8"))
    {
    //Price of the class.
    int price = 400;
    int mytokens = getConfig().getInt(player.getName() + ".tokens");
    
    //Check if price is big enough.
    if(mytokens >= price)
    {
    getConfig().set(player.getName() + ".tokens", mytokens - price);
    saveConfig();
    player.sendMessage(ChatColor.WHITE + "You now have " + mytokens + " tokens.");
    
    //The class itself.
    
    Potion potion1 = new Potion(PotionType.INSTANT_HEAL, 2, true, true);
    ItemStack ptn_1 = potion1.toItemStack(10);
    
    Potion potion2 = new Potion(PotionType.REGEN, 2, true, true);
    ItemStack ptn_2 = potion2.toItemStack(10);
    
    Potion potion3 = new Potion(PotionType.JUMP, 2, true, true);
    ItemStack ptn_3 = potion3.toItemStack(5);
    
    Potion potion4 = new Potion(PotionType.SPEED, 2, true, true);
    ItemStack ptn_4 = potion4.toItemStack(5);
    
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a cleric.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET, 1));
    player.getInventory().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
    player.getInventory().setLeggings(new ItemStack(Material.GOLD_LEGGINGS, 1));
    player.getInventory().setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
    
    player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD, 1));
    player.getInventory().addItem(new ItemStack(ptn_1));
    player.getInventory().addItem(new ItemStack(ptn_2));
    player.getInventory().addItem(new ItemStack(ptn_3));
    player.getInventory().addItem(new ItemStack(ptn_4));
    
    }
    else
    {
    player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    }
    
    }
    
    //Reaper class.
    if(args[0].equalsIgnoreCase("9"))
    {
    //Price of the class.
    int price = 500;
    int mytokens = getConfig().getInt(player.getName() + ".tokens");
    
    //Check if price is big enough.
    if(mytokens >= price)
    {
    getConfig().set(player.getName() + ".tokens", mytokens - price);
    player.sendMessage(ChatColor.GREEN + "You spent " + price + " tokens.");
    saveConfig();
    
    //The class itself.
    TitleSender.sendTitle(player, ChatColor.DARK_PURPLE + "Player VS Player", ChatColor.WHITE + "You are a reaper.");
    
    player.getInventory().clear();
    
    player.getInventory().setHelmet(new ItemStack(Material.PUMPKIN, 1));
    player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
    player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
    player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
    
    player.getInventory().addItem(new ItemStack(Material.IRON_SWORD, 1));
    player.getInventory().addItem(new ItemStack(Material.IRON_AXE, 1));
    player.getInventory().addItem(new ItemStack(Material.FISHING_ROD, 1));
    player.getInventory().addItem(new ItemStack(Material.EGG, 10));
    
    player.getInventory().addItem(new ItemStack(Material.COOKED_RABBIT, 5));
    }
    else
    {
    player.sendMessage(ChatColor.RED + "You do not have enough tokens.");
    }
    
    }
    
    
    for (PotionEffect effect : player.getActivePotionEffects())
    {
    player.removePotionEffect(effect.getType());
    }
    
    ((CraftPlayer)player).getHandle().getDataWatcher().watch(9, (byte) 0);
    
    player.setFoodLevel(20);
    player.setHealth(20.0);
    
    }
    catch(Exception ex)
    {
    player.sendMessage(ChatColor.BOLD + "Please choose your class: (/pvp <id>)");
    player.sendMessage(ChatColor.YELLOW + "[1] Warrior - Free");
    player.sendMessage(ChatColor.YELLOW + "[2] Archer - Free");
    player.sendMessage(ChatColor.YELLOW + "[3] Mage - 50 Tokens");
    player.sendMessage(ChatColor.YELLOW + "[4] Guardian - 100 Tokens");
    player.sendMessage(ChatColor.YELLOW + "[5] Assassin - 150 Tokens");
    player.sendMessage(ChatColor.YELLOW + "[6] Ender - 250 Tokens");
    player.sendMessage(ChatColor.YELLOW + "[7] Legend - 350 Tokens");
    player.sendMessage(ChatColor.YELLOW + "[8] Cleric - 400 Tokens");
    player.sendMessage(ChatColor.YELLOW + "[9] Reaper - 500 Tokens");
    player.sendMessage("" + ChatColor.DARK_RED + ChatColor.BOLD + "Warning, you will lose current items if you select a kit!");
    player.performCommand("tokens");
    }
    
    
    
    return true;
    }
    
    
    if(cmd.getName().equalsIgnoreCase("getpos") && sender instanceof Player)
    {
    Player player = (Player) sender;
    
    //Send player their current co-ordinates.
    player.sendMessage("X: " + player.getLocation().getX());
    player.sendMessage("Y: " + player.getLocation().getY());
    player.sendMessage("Z: " + player.getLocation().getZ());
    player.sendMessage("Yaw: " + player.getLocation().getYaw());
    player.sendMessage("Pitch: " + player.getLocation().getPitch());
    
    return true;
    }
    
    return false;
    }
    
    
    
    }
    
    Code:
    /* LISTENER CLASS */
    package me.AFKGames;
    
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    
    import net.minecraft.server.v1_8_R1.EnumClientCommand;
    import net.minecraft.server.v1_8_R1.PacketPlayInClientCommand;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDeathEvent;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.event.player.AsyncPlayerChatEvent;
    import org.bukkit.event.player.PlayerEggThrowEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.event.player.PlayerQuitEvent;
    import org.bukkit.scheduler.BukkitScheduler;
    
    public class ListenerClass implements Listener {
    
    MainClass configGetter;
    
    public List<String> swears = new ArrayList<String>();
    public List<Player> donators = new ArrayList<Player>();
    public List<Player> twitchers = new ArrayList<Player>();
    public List<Player> helpers = new ArrayList<Player>();
    
    public List<Player> getRoomList() {
    return this.helpers;
    }
    
    public void UpdateSwears()
    {
    swears.add("fuck");
    swears.add("shit");
    swears.add("dick");
    swears.add("penis");
    swears.add("vagina");
    swears.add("noob");
    swears.add("nigga");
    swears.add("nigger");
    swears.add("crap");
    swears.add("omfg");
    swears.add("stfu");
    swears.add("gay");
    swears.add("lezbo");
    swears.add("lezbian");
    swears.add("slave");
    swears.add("n00b");
    swears.add("n.o.o.b");
    swears.add("n o o b");
    }
    
    @SuppressWarnings("deprecation")
    public void UpdateDonators()
    {
    donators.add(Bukkit.getPlayerExact("purplegangzter"));
    }
    
    @SuppressWarnings("deprecation")
    public void UpdateTwitchers()
    {
    twitchers.add(Bukkit.getPlayerExact("xNoiisy"));
    twitchers.add(Bukkit.getPlayerExact("xAlex_HD"));
    twitchers.add(Bukkit.getPlayerExact("BenJaminHD3"));
    twitchers.add(Bukkit.getPlayerExact("Smoothness"));
    }
    
    @SuppressWarnings("deprecation")
    public void UpdateHelpers()
    {
    helpers.add(Bukkit.getPlayerExact("577littleman"));
    }
    
    public ListenerClass(MainClass plugin)
    {
    plugin.getServer().getPluginManager().registerEvents(this, plugin);
    configGetter = plugin;
    
    BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
    scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() {
    @Override
    public void run()
    {
    UpdateSwears();
    UpdateDonators();
    UpdateTwitchers();
    UpdateHelpers();
    }
    
    }, 0L, 100L);
    
    }
    
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e)
    {
    Player player = e.getPlayer();
    e.setJoinMessage(ChatColor.GREEN + "+ " + player.getName() + " joined the fight!");
    TitleSender.sendTitle(player, ChatColor.AQUA + "AFK Games Network", ChatColor.WHITE + "Please login/register to play!");
    player.teleport(new Location(Bukkit.getWorld("world"), (double)1056.865, (double)65.0, (double)984.931, (float)-269.6558, (float)-0.7958078));
    
    ((CraftPlayer)player).getHandle().getDataWatcher().watch(9, (byte) 0);
    
    player.setFoodLevel(20);
    player.setHealth(20.0);
    }
    
    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent e)
    {
    Player player = e.getPlayer();
    e.setQuitMessage(ChatColor.RED + "- " + player.getName() + " left the fight!");
    }
    
    @EventHandler
    public void onEntityDeath(EntityDeathEvent e)
    {
    Player damaged = (Player) e.getEntity();
    
    try
    {
    TitleSender.sendTitle(damaged, "", "" + ChatColor.RED + ChatColor.RED + "You have been killed!");
    }
    catch(Exception exc)
    {
    exc.getCause();
    }
    }
    
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e)
    {
    e.setDeathMessage(null);
    
    Player damaged = (Player) e.getEntity();
    Player damager = (Player) e.getEntity().getKiller();
    
    damaged.getInventory().clear();
    damaged.getInventory().setHelmet(null);
    damaged.getInventory().setChestplate(null);
    damaged.getInventory().setLeggings(null);
    damaged.getInventory().setBoots(null);
    
    ((CraftPlayer)damaged).getHandle().playerConnection.a(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN));
    
    if(damaged != damager)
    {
    int times = configGetter.getConfig().getInt(damager.getName() + ".tokens");
    times += 10;
    configGetter.getConfig().set(damager.getName() + ".tokens", times);
    damager.sendMessage(ChatColor.GREEN + "You have earned 10 tokens.");
    configGetter.saveConfig();
    damager.sendMessage(ChatColor.WHITE + "You now have " + configGetter.getConfig().getInt(damager.getName() + ".tokens") + " tokens.");
    }
    
    }
    
    @EventHandler
    public void chatFormat(AsyncPlayerChatEvent event)
    {
    Player p = event.getPlayer();
    
    if(!p.isOp())
    {
    //URL's not to send in chat.
    if(event.getMessage().contains("http://") || event.getMessage().contains("https://") || event.getMessage().contains("www."))
    {
    p.sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You can not send URL's in the chat!");
    event.setCancelled(true);
    }
    
    for (Iterator<String> itr = swears.iterator(); itr.hasNext(); )
    {
    String item = itr.next();
    
    if(event.getMessage().toLowerCase().contains(item))
    {
    p.sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You can not swear in the chat!");
    event.setCancelled(true);
    }
    }
    }
    
    
    //Replace url.
    String u = event.getMessage();
    String ul = u.replace("$url", "http://afkgamesnetwork.freeforums.org");
    event.setMessage(ul);
    
    //Replace colour codes.
    if(p.isOp())
    {
    String t = event.getMessage();
    String tm = ChatColor.translateAlternateColorCodes('&', t);
    event.setMessage(tm);
    }
    
    //Admin rank.
    if(p.isOp() && !p.getDisplayName().equalsIgnoreCase("AFK_Games"))
    {
    event.setFormat(ChatColor.BLUE + "[Admin] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    }
    else
    {
    //Owner rank
    if(p.isOp() && p.getDisplayName().equalsIgnoreCase("AFK_Games"))
    {
    event.setFormat(ChatColor.GREEN + "[Owner] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    }
    else
    {
    if(donators.contains(p))
    {
    //Normal default guest rank
    event.setFormat(ChatColor.YELLOW + "[Donator] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    }
    else
    {
    if(helpers.contains(p))
    {
    //Normal default guest rank
    event.setFormat(ChatColor.AQUA + "[Helper] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    }
    else
    {
    if(twitchers.contains(p))
    {
    //Normal default guest rank
    event.setFormat(ChatColor.DARK_PURPLE + "[Twitcher] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    }
    else
    {
    //Normal default guest rank
    event.setFormat(ChatColor.WHITE + "[Guest] " + p.getDisplayName() + ChatColor.WHITE + ChatColor.BOLD + " » " + ChatColor.WHITE + event.getMessage());
    }
    }
    }
    
    }
    }
    
    
    }
    
    @EventHandler
    public void onEggThrown(PlayerEggThrowEvent e)
    {
    e.setHatching(false);
    
    if(e.getEgg().getLastDamageCause() instanceof Player)
    {
    for(Player p: Bukkit.getServer().getOnlinePlayers())
    {
    if(e.getEgg().getLastDamageCause() == p)
    {
    p.damage((double)2);
    }
    }
    }
    
    }
    
    }
    
     
  6. @AFK Games That plugin really isn't very customisable, it would be much easier to make a config for swears and twitchers. Then you can just add to a list rather than editting the plugin, recompiling, adding to the server and reloading.
     
  7. Offline

    teej107

     
  8. Offline

    AFK Games

    Here is the console error message, it wont load the plugin for some weird reason, I have tried renaming the class and made a new project and still does the same thing. ???

    Code:
    18.04 18:33:31 [Server] INFO ... 20 more
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at java.lang.Class.forName(Class.java:344) ~[?:1.8.0_31]
    18.04 18:33:31 [Server] INFO at java.lang.Class.forName0(Native Method) ~[?:1.8.0_31]
    18.04 18:33:31 [Server] INFO at me.AFKGames.Main.<clinit>(Main.java:82) ~[?:?]
    18.04 18:33:31 [Server] INFO at me.AFKGames.ListenerClass.<init>(ListenerClass.java:83) ~[?:?]
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.SimplePluginManager.registerEvents(SimplePluginManager.java:523) ~[craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO Caused by: org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register me.AFKGames.ListenerClass@6f7b6406 while not enabled
    18.04 18:33:31 [Server] INFO ... 20 more
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at java.lang.Class.forName(Class.java:344) ~[?:1.8.0_31]
    18.04 18:33:31 [Server] INFO at java.lang.Class.forName0(Native Method) ~[?:1.8.0_31]
    18.04 18:33:31 [Server] INFO Caused by: java.lang.ExceptionInInitializerError
    18.04 18:33:31 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.8.0_31]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:517) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:609) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:284) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:656) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_31]
    18.04 18:33:31 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_31]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(SourceFile:9) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(SourceFile:37) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:919) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerConnection.java:1058) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:625) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:140) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.Bukkit.reload(Bukkit.java:543) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.craftbukkit.v1_8_R1.CraftServer.reload(CraftServer.java:723) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugins(CraftServer.java:288) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit-BT35_1.8_04.17.jar:git-Bukkit-7019900]
    18.04 18:33:31 [Server] INFO org.bukkit.plugin.InvalidPluginException: java.lang.ExceptionInInitializerError
    18.04 18:33:31 [Server] ERROR Could not load 'plugins/NetworkProject.jar' in folder 'plugins'
     
  9. Offline

    Lightspeed

    Do you have 2or more classes that extends JavaPlugin?
     
  10. Offline

    AFK Games

    I do not have 2 or more classes that extends javaplugin, I have 3 classes, main = javaplugin, lisnterclass = listener , titlesender = normal class

    Is there any other usual problems I could have? like with the plugin.yml?
    Here is my plugin.yml: BTW I renamed the project from HubCommand to NetworkProject

    Code:
    name: NetworkProject
    main: me.AFKGames.Main
    version: 1.2
    commands:
       mod:
          description: Moderate the server!
          usage: /<command>
       vote:
          description: Vote for the server!
          usage: /<command>
       donate:
          description: Donate to the server!
          usage: /<command>
       mf:
          description: Go to mob frenzy!
          usage: /<command>
       a1:
          description: Go to arena 1!
          usage: /<command>
       a2:
          description: Go to arena 2!
          usage: /<command>
       a3:
          description: Go to arena 3!
          usage: /<command>
       st:
          description: Set tokens for <player> <amount>
          usage: /<command>
       hub:
          description: Go to the main hub.
          usage: /<command>
       news:
          description: Shows welcome message.
          usage: /<command>
       pvp:
          description: Go the the pvp arena.
          usage: /<command>
       tokens:
          description: Check your token amount!
          usage: /<command>
       getpos:
          description: Get your current position
          usage: /<command>
     
    Last edited by a moderator: Apr 19, 2015
  11. Offline

    Xerox262

    In your plugin.yml

    package: me.AFKGames.Main

    Should be

    package: me.AFKGames.MainClass
     
  12. Offline

    TheMrJezza

    @AFK Games Like Xerox262 said in your main class it says its 'MainClass'
    Code:
    public class MainClass extends JavaPlugin {
    but in your plugin.yml, the "main:' parts says 'me.AFKGames.Main' the last word after the . should match the class name

    so your plugin.yml should be
    Code:
    name: NetworkProject
    main: me.AFKGames.MainClass
    version: 1.2
    commands:
       mod:
          description: Moderate the server!
          usage: /<command>
       vote:
          description: Vote for the server!
          usage: /<command>
       donate:
          description: Donate to the server!
          usage: /<command>
       mf:
          description: Go to mob frenzy!
          usage: /<command>
       a1:
          description: Go to arena 1!
          usage: /<command>
       a2:
          description: Go to arena 2!
          usage: /<command>
       a3:
          description: Go to arena 3!
          usage: /<command>
       st:
          description: Set tokens for <player> <amount>
          usage: /<command>
       hub:
          description: Go to the main hub.
          usage: /<command>
       news:
          description: Shows welcome message.
          usage: /<command>
       pvp:
          description: Go the the pvp arena.
          usage: /<command>
       tokens:
          description: Check your token amount!
          usage: /<command>
       getpos:
          description: Get your current position
          usage: /<command>
    100% credit goes to Xerox262 for this.
     
Thread Status:
Not open for further replies.

Share This Page