Klasse TemplateResult

java.lang.Object
me.kzlyth.api.template.ban.TemplateResult

public class TemplateResult extends Object
Represents the result of calculating a ban template for a player.

This contains the calculated ban duration, reason (with escalation suffix), offense level, and other information that would be applied if the player were banned using this template.

Example:


 BanTemplateAPI templateAPI = api.getBanTemplateAPI();
 TemplateResult result = templateAPI.getTemplateResult(uuid, "cheating", null).join();
 if (result != null) {
     getLogger().info("Would ban for: " + result.getFormattedDuration());
     getLogger().info("Final reason: " + result.getReason());
     getLogger().info("Offense level: " + result.getOffenseLevel());
     getLogger().info("Is permanent: " + result.isPermanent());
     getLogger().info("Duration in seconds: " + result.getDurationSeconds());
 }
 
Seit:
1.2.3
Autor:
Zenith-Studios
  • Konstruktordetails

    • TemplateResult

      public TemplateResult(@NotNull @NotNull String reason, long durationSeconds, @NotNull @NotNull String formattedDuration, int offenseLevel, boolean permanent, int caseId)
      Constructs a new TemplateResult object.
      Parameter:
      reason - The final reason
      durationSeconds - The duration in seconds
      formattedDuration - The formatted duration string
      offenseLevel - The offense level
      permanent - Whether this ban would be permanent
      caseId - The case ID (0 if not yet assigned)
  • Methodendetails

    • getReason

      @NotNull public @NotNull String getReason()
      Gets the final reason that would be used.

      This includes the escalation suffix if applicable (e.g., " (1st Offense)").

      Gibt zurück:
      The final reason
    • getDurationSeconds

      public long getDurationSeconds()
      Gets the duration in seconds.

      Returns 0 or -1 for permanent bans, or the number of seconds for temporary bans.

      Gibt zurück:
      The duration in seconds
    • getFormattedDuration

      @NotNull public @NotNull String getFormattedDuration()
      Gets the formatted duration string.

      Returns a human-readable duration string (e.g., "7d", "2h", "Permanent").

      Gibt zurück:
      The formatted duration string
    • getOffenseLevel

      public int getOffenseLevel()
      Gets the offense level.

      Returns 1 for first offense, 2 for second offense, etc.

      Gibt zurück:
      The offense level
    • isPermanent

      public boolean isPermanent()
      Checks if this ban would be permanent.
      Gibt zurück:
      true if permanent, false otherwise
    • getCaseId

      public int getCaseId()
      Gets the case ID that would be assigned.

      Returns 0 if the case ID is not yet known (calculation only).

      Gibt zurück:
      The case ID, or 0 if not yet assigned
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object