Advertisement
Lisenochek

Untitled

Jan 30th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. package ru.lisenochek.fgmrealistic.statusBar;
  2.  
  3. import com.sk89q.worldguard.bukkit.WGBukkit;
  4. import com.sk89q.worldguard.protection.regions.ProtectedRegion;
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.World;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.potion.PotionEffect;
  9. import org.bukkit.potion.PotionEffectType;
  10. import ru.lisenochek.fgmrealistic.crate.CrateList;
  11. import ru.lisenochek.fgmrealistic.diseases.DiseaseManager;
  12. import ru.lisenochek.fgmrealistic.utils.C;
  13. import ru.lisenochek.fgmrealistic.utils.GetLogger;
  14. import ru.lisenochek.fgmrealistic.utils.TitlePackage;
  15.  
  16. public class GetEvents {
  17.  
  18.  
  19. public static World nether = Bukkit.getWorld("Realistic_nether");
  20. public static World end = Bukkit.getWorld("Realistic_the_end");
  21. public static int crateTime = 1200;
  22. public static int unDiseaseTime = 3600;
  23.  
  24. public static int getCrateTime() {
  25.  
  26. --crateTime;
  27.  
  28. if (crateTime == 0) {
  29. getCrateDrop();
  30. crateTime = 1200;
  31. }
  32.  
  33. return crateTime;
  34. }
  35.  
  36. public static int getUndiseaseTime() {
  37.  
  38. --unDiseaseTime;
  39.  
  40. if (unDiseaseTime == 0) {
  41. getGU();
  42. unDiseaseTime = 3600;
  43. }
  44.  
  45. return unDiseaseTime;
  46. }
  47.  
  48. public static String getCrateTimeForStatusBar() {
  49. if (crateTime % 60 < 10) return crateTime / 60 + ":0" + crateTime % 60;
  50. else return crateTime / 60 + ":" + crateTime % 60;
  51. }
  52.  
  53. public static String getUndiseaseTimeForStatusBar() {
  54. if (unDiseaseTime % 60 < 10) return unDiseaseTime / 60 + ":0" + unDiseaseTime % 60;
  55. else return unDiseaseTime / 60 + ":" + unDiseaseTime % 60;
  56. }
  57.  
  58. private static void getCrateDrop() {
  59.  
  60. GetLogger.log("Статистика выпадения ящиков за последние 20 минут.");
  61. GetLogger.log("Игроков всего на сервере: " + Bukkit.getOnlinePlayers().size());
  62. GetLogger.log("Игроки, которые попали под раздачу:");
  63.  
  64. for (Player p : Bukkit.getOnlinePlayers()) {
  65.  
  66. if (p.getWorld() == nether || p.getWorld() == end) return;
  67. for (ProtectedRegion reg : WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation())) if (reg.getId().equalsIgnoreCase("realistic")) return;
  68.  
  69. CrateList.getCommonCrate(p, p.getLocation());
  70.  
  71. new TitlePackage(C.c("&6Я увидел самолет, сбросивший ящик!"), C.c("&aОн упал где-то рядом со мной!")).sendPlayer(p);
  72. GetLogger.log(p.getName());
  73. }
  74. }
  75.  
  76. private static void getGU() {
  77.  
  78. GetLogger.log("Статистика всемирного очищения за последние 60 минут.");
  79. GetLogger.log("Игроков всего на сервере: " + Bukkit.getOnlinePlayers().size());
  80. GetLogger.log("Игроки, которые попали под раздачу:");
  81.  
  82. for (Player p : Bukkit.getOnlinePlayers()) {
  83.  
  84. if (p.getWorld() == nether || p.getWorld() == end) return;
  85. if (DiseaseManager.hasBlood(p)) DiseaseManager.removeBlood(p);
  86. if (DiseaseManager.hasBrokenBones(p)) DiseaseManager.removeBrokenBones(p);
  87. if (DiseaseManager.hasDiseaseX(p)) DiseaseManager.removeDiseaseX(p);
  88.  
  89. p.setWalkSpeed(0.2f);
  90. p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 100));
  91.  
  92. new TitlePackage(C.c("&6Я увидел много самолетов!"), C.c("&aЯ чувствую, как мои раны заживают!")).sendPlayer(p);
  93. GetLogger.log(p.getName());
  94. }
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement