Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.realistic.timers;
- import java.util.Random;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.entity.Player;
- import com.realistic.api.API;
- import com.realistic.api.MessageManager;
- import com.realistic.api.MessageManager.MsgType;
- import com.realistic.config.configMessage;
- import com.realistic.list.MinecraftList;
- public class Disease_colding implements Runnable {
- private API plugin;
- private MinecraftList ml;
- private configMessage cm;
- private final Random r = new Random();
- public Disease_colding(API plugin) {
- this.plugin = plugin;
- }
- public Disease_colding(MinecraftList ml) {
- this.ml = ml;
- }
- @Override
- public void run() {
- for (Player p : Bukkit.getOnlinePlayers()) {
- if (!this.ml.WLWorlds.contains(p.getWorld().getName())) {
- return;
- }
- if (p.getGameMode() == GameMode.CREATIVE) {
- return;
- }
- if (p.getWorld().hasStorm() && p.isDead()) {
- return;
- }
- if (!p.getWorld().hasStorm()) {
- continue;
- }
- if (p.getInventory().getChestplate() != null || p.getInventory().getHelmet() != null
- || p.getInventory().getLeggings() != null || p.getInventory().getBoots() != null) {
- continue;
- }
- Location loc = p.getLocation();
- if (loc.getWorld().getHighestBlockYAt(loc) > loc.getBlockY()) {
- continue;
- }
- if (r.nextInt(10000) <= 100) {
- if (!ml.Disease_Pneumonia.containsKey(p.getName()) || !ml.Disease_Cold.containsKey(p.getName())) {
- ml.Disease_Pneumonia.put(p.getPlayer().getName(), true);
- }
- }
- if (r.nextInt(10000) <= 10000) {
- if (!ml.Disease_Cold.containsKey(p.getName()) || !ml.Disease_Pneumonia.containsKey(p.getName())) {
- ml.Disease_Cold.put(p.getPlayer().getName(), true);
- }
- }
- if (!ml.Disease_Cold.containsKey(p.getPlayer().getName())
- && !ml.Disease_Pneumonia.containsKey(p.getPlayer().getName())) {
- MessageManager.getManager().msg(p, MsgType.INFORMATION, cm.messageConfig.getString("cold_message"));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement