@Override
  public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
    // Get remaining enderpearl cooldown for the player.
    double remaining = 0;
    if (event.getPlayer() != null) {
      User user = plugin.getOrCreateUser(event.getPlayer().getUniqueId());
      remaining = ((double) DurationUtils.calculateRemaining(user.getEnderpearlCooldown())) / 1000;
    }

    // Return inactive if there is no cooldown remaining.
    if (remaining < 0) {
      return "Inactive";
    }

    // Return the cooldown in a compact time format.
    return timeFormat.format(remaining);
  }
예제 #2
0
 public FactionMapListener(FBasics plugin) {
   settings = plugin.getSettings().getAntiGlitchSettings();
   Bukkit.getPluginManager().registerEvents(this, plugin);
 }