コード例 #1
0
  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);
              }
          }
        }
      }
    }
  }
コード例 #2
0
  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);
          }
        }
      }
    }
  }
コード例 #3
0
  public void killEffects(Game game) {
    if (killEffectParticles.equals("")) return;

    for (Map.Entry<UUID, String> e : game.playerstate.entrySet()) {
      UUID playern = e.getKey();
      Player player = Bukkit.getPlayer(playern);

      if (player != null) {
        if (game.playerteam.get(playern).equals(team.getName())) {
          if (game.getCustomCooldown(playern, "effects_kill") >= 0) {
            spawnParticle(game, player, killEffectParticles);
          }
        }
      }
    }
  }