Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.lisenochek.fgmrealistic.statusBar;
- import com.sk89q.worldguard.bukkit.WGBukkit;
- import com.sk89q.worldguard.protection.regions.ProtectedRegion;
- import org.bukkit.Bukkit;
- import org.bukkit.World;
- import org.bukkit.entity.Player;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import ru.lisenochek.fgmrealistic.crate.CrateList;
- import ru.lisenochek.fgmrealistic.diseases.DiseaseClass;
- import ru.lisenochek.fgmrealistic.utils.C;
- import ru.lisenochek.fgmrealistic.utils.TitlePackage;
- public class GetEvents {
- public static World nether = Bukkit.getWorld("Realistic_nether");
- public static World end = Bukkit.getWorld("Realistic_the_end");
- public static int crateTime = 1200;
- public static int unDiseaseTime = 3600;
- public static int getCrateTime() {
- --crateTime;
- if (crateTime == 0) {
- getCrateDrop();
- crateTime = 1200;
- }
- return crateTime;
- }
- public static int getUndiseaseTime() {
- --unDiseaseTime;
- if (unDiseaseTime == 0) {
- getGU();
- unDiseaseTime = 3600;
- }
- return unDiseaseTime;
- }
- public static String getCrateTimeForStatusBar() {
- if (crateTime % 60 < 10) return crateTime / 60 + ":0" + crateTime % 60;
- else return crateTime / 60 + ":" + crateTime % 60;
- }
- public static String getUndiseaseTimeForStatusBar() {
- if (unDiseaseTime % 60 < 10) return unDiseaseTime / 60 + ":0" + unDiseaseTime % 60;
- else return unDiseaseTime / 60 + ":" + unDiseaseTime % 60;
- }
- private static void getCrateDrop() {
- for (Player p : Bukkit.getOnlinePlayers()) {
- if (p.getWorld() != nether || p.getWorld() != end) return;
- for (ProtectedRegion reg : WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation())) if (reg.getId().equalsIgnoreCase("realistic")) return;
- CrateList.getCommonCrate(p, p.getLocation());
- new TitlePackage(C.c("&6Я увидел самолет, сбросивший ящик!"), C.c("&aОн упал где-то рядом со мной!")).sendPlayer(p);
- }
- }
- private static void getGU() {
- for (Player p : Bukkit.getOnlinePlayers()) {
- if (p.getWorld() != nether || p.getWorld() != end) return;
- DiseaseClass.playerList.get(p.getName()).removeBlood();
- DiseaseClass.playerList.get(p.getName()).removeBrokenBones();
- p.setWalkSpeed(0.2f);
- p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 100));
- new TitlePackage(C.c("&6Я увидел много самолетов!"), C.c("&aЯ чувствую, как мои раны заживают!")).sendPlayer(p);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement