private void addLightlevelEffects(Game game) { for (Map.Entry<UUID, String> e : game.playerstate.entrySet()) { UUID playern = e.getKey(); if (game.playerteam.get(playern).equals(team.getName())) { Player player = Bukkit.getPlayer(playern); if (player != null) { int light = player.getLocation().getBlock().getLightLevel(); // above for (int i = light - 1; i >= 0; i--) { PotionEffectType effect = PotionEffectType.getById(effectAbove[i][0]); int level = effectAbove[i][1]; if (effect != null) if (!PlayerHandler.hasHigherPotionEffect(player, effect, level)) { player.addPotionEffect(new PotionEffect(effect, 3 * 20, level), true); } } // below for (int i = light + 1; i < 16; i++) { PotionEffectType effect = PotionEffectType.getById(effectBelow[i][0]); int level = effectBelow[i][1]; if (effect != null) if (!PlayerHandler.hasHigherPotionEffect(player, effect, level)) { player.addPotionEffect(new PotionEffect(effect, 3 * 20, level), true); } } } } } }
private void addDaytimeEffect(Game game, PotionEffectType id, int level) { for (Map.Entry<UUID, String> e : game.playerstate.entrySet()) { UUID playern = e.getKey(); if (game.playerteam.get(playern).equals(team.getName())) { Player player = Bukkit.getPlayer(playern); if (player != null) { if (!PlayerHandler.hasHigherPotionEffect(player, id, level)) { player.addPotionEffect(new PotionEffect(id, 3 * 20, level), true); } } } } }