Package me.kzlyth.api.template.ban
Klasse TemplateResult
java.lang.Object
me.kzlyth.api.template.ban.TemplateResult
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
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungTemplateResult(@NotNull String reason, long durationSeconds, @NotNull String formattedDuration, int offenseLevel, boolean permanent, int caseId) Constructs a new TemplateResult object. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungintGets the case ID that would be assigned.longGets the duration in seconds.@NotNull StringGets the formatted duration string.intGets the offense level.@NotNull StringGets the final reason that would be used.booleanChecks if this ban would be permanent.toString()
-
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 reasondurationSeconds- The duration in secondsformattedDuration- The formatted duration stringoffenseLevel- The offense levelpermanent- Whether this ban would be permanentcaseId- The case ID (0 if not yet assigned)
-
-
Methodendetails
-
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
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:
trueif permanent,falseotherwise
-
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
-