Guest User

Untitled

a guest
May 15th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. public class Join implements Listener {
  2.  
  3. private hungergames plugin;
  4.  
  5. public Join(hungergames plugin) {
  6. plugin.getServer().getPluginManager().registerEvents(this, plugin);
  7. this.plugin = plugin;
  8. }
  9.  
  10. @EventHandler
  11. public void onPlayerJoin(PlayerJoinEvent e) {
  12. Player p = e.getPlayer();
  13.  
  14. if (VariableManager.getInstance().canAttack() == true && p.hasPermission("hungergames.admin")) {
  15. e.setJoinMessage("");
  16. plugin.adminMode(p);
  17. p.sendMessage(ChatColor.LIGHT_PURPLE + "Oled ADMIN mängumoodis, kuna mäng on juba alanud!");
  18. }
  19. else {
  20. e.setJoinMessage(p.getName() + " liitus mänguga!");
  21. if (!(p.getGameMode() == GameMode.SURVIVAL)) {
  22. p.setGameMode(GameMode.SURVIVAL);
  23. }
  24. }
  25.  
  26. for (PotionEffect effect : p.getActivePotionEffects()) {
  27. p.removePotionEffect(effect.getType());
  28. }
  29.  
  30. for (Player player : Bukkit.getServer().getOnlinePlayers()) {
  31. for (Player target : Bukkit.getServer().getOnlinePlayers()){
  32. if(!player.canSee(target)){
  33. target.showPlayer(player);
  34. }
  35. }
  36. }
  37.  
  38. p.setPlayerListName(p.getName());
  39. p.getInventory().clear();
  40. p.getInventory().setHelmet(null);
  41. p.getInventory().setChestplate(null);
  42. p.getInventory().setLeggings(null);
  43. p.getInventory().setBoots(null);
  44. p.setLevel(0);
  45. p.setExp(0.0F);
  46. p.setHealth(20);
  47. p.setFoodLevel(20);
  48. p.setSaturation(0.0F);
  49. p.setAllowFlight(false);
  50.  
  51. if (VariableManager.getInstance().canAttack() == false) {
  52. String yourkits = showKits.yourKits(p);
  53. String otherkits = showKits.otherKits(p);
  54. p.sendMessage(ChatColor.GOLD + "Tere tulemast Hunger Games serverisse");
  55. p.sendMessage(yourkits);
  56. p.sendMessage(otherkits);
  57. p.sendMessage(ChatColor.RED + "Varustuse valimiseks kirjuta /kit varustusenimi");
  58. }
  59.  
  60. if (VariableManager.getInstance().isStarted() == false) {
  61. if (plugin.autostart == true && plugin.getTruePlayersLeft() >= plugin.players_needed) {
  62. plugin.countdown();
  63. }
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment