Advertisement
Lisenochek

Untitled

Jan 29th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 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.DiseaseClass;
  12. import ru.lisenochek.fgmrealistic.utils.C;
  13. import ru.lisenochek.fgmrealistic.utils.TitlePackage;
  14.  
  15. public class GetEvents {
  16.  
  17.  
  18. public static World nether = Bukkit.getWorld("Realistic_nether");
  19. public static World end = Bukkit.getWorld("Realistic_the_end");
  20. public static int crateTime = 1200;
  21. public static int unDiseaseTime = 3600;
  22.  
  23. public static int getCrateTime() {
  24.  
  25. --crateTime;
  26.  
  27. if (crateTime == 0) {
  28. getCrateDrop();
  29. crateTime = 1200;
  30. }
  31.  
  32. return crateTime;
  33. }
  34.  
  35. public static int getUndiseaseTime() {
  36.  
  37. --unDiseaseTime;
  38.  
  39. if (unDiseaseTime == 0) {
  40. getGU();
  41. unDiseaseTime = 3600;
  42. }
  43.  
  44. return unDiseaseTime;
  45. }
  46.  
  47. public static String getCrateTimeForStatusBar() {
  48. if (crateTime % 60 < 10) return crateTime / 60 + ":0" + crateTime % 60;
  49. else return crateTime / 60 + ":" + crateTime % 60;
  50. }
  51.  
  52. public static String getUndiseaseTimeForStatusBar() {
  53. if (unDiseaseTime % 60 < 10) return unDiseaseTime / 60 + ":0" + unDiseaseTime % 60;
  54. else return unDiseaseTime / 60 + ":" + unDiseaseTime % 60;
  55. }
  56.  
  57. private static void getCrateDrop() {
  58.  
  59. for (Player p : Bukkit.getOnlinePlayers()) {
  60.  
  61. if (p.getWorld() != nether || p.getWorld() != end) return;
  62. for (ProtectedRegion reg : WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation())) if (reg.getId().equalsIgnoreCase("realistic")) return;
  63.  
  64. CrateList.getCommonCrate(p, p.getLocation());
  65.  
  66. new TitlePackage(C.c("&6Я увидел самолет, сбросивший ящик!"), C.c("&aОн упал где-то рядом со мной!")).sendPlayer(p);
  67. }
  68. }
  69.  
  70. private static void getGU() {
  71.  
  72. for (Player p : Bukkit.getOnlinePlayers()) {
  73.  
  74. if (p.getWorld() != nether || p.getWorld() != end) return;
  75.  
  76. DiseaseClass.playerList.get(p.getName()).removeBlood();
  77. DiseaseClass.playerList.get(p.getName()).removeBrokenBones();
  78.  
  79. p.setWalkSpeed(0.2f);
  80. p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 100));
  81.  
  82. new TitlePackage(C.c("&6Я увидел много самолетов!"), C.c("&aЯ чувствую, как мои раны заживают!")).sendPlayer(p);
  83. }
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement