Package me.kzlyth.api.template.ban
Klasse BanTemplate
java.lang.Object
me.kzlyth.api.template.ban.BanTemplate
Represents a ban template (custom ban configuration) in Zenith-Mod.
Ban templates provide pre-configured ban settings including duration levels, escalation rules, and default reasons. Templates support automatic escalation where ban durations increase with repeat offenses.
Example:
BanTemplateAPI templateAPI = api.getBanTemplateAPI();
BanTemplate template = templateAPI.getTemplate("cheating").join();
if (template != null) {
getLogger().info("Template: " + template.getName());
getLogger().info("Description: " + template.getDescription());
getLogger().info("Auto IP ban: " + template.isAutoIpBan());
getLogger().info("Default reason: " + template.getDefaultReason());
if (template.getEscalation() != null) {
getLogger().info("Escalation enabled: " + template.getEscalation().isEnabled());
}
getLogger().info("Duration levels: " + template.getDurations().size());
}
- Seit:
- 1.2.3
- Autor:
- Zenith-Studios
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungBanTemplate(@NotNull String key, @NotNull String name, @NotNull String description, boolean autoIpBan, @NotNull String defaultReason, @Nullable EscalationConfig escalation, @NotNull List<DurationLevel> durations) Constructs a new BanTemplate object. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibung@NotNull StringGets the default reason for bans using this template.@NotNull StringGets the description of this template.@Nullable DurationLevelgetDurationLevel(int offenseLevel) Gets the duration level for a specific offense level.@NotNull List<DurationLevel> Gets the list of duration levels for this template.@Nullable EscalationConfigGets the escalation configuration.@NotNull StringgetKey()Gets the unique identifier key for this template.intGets the maximum offense level configured for this template.@NotNull StringgetName()Gets the display name of this template.booleanChecks if this template automatically IP bans.toString()
-
Konstruktordetails
-
BanTemplate
public BanTemplate(@NotNull @NotNull String key, @NotNull @NotNull String name, @NotNull @NotNull String description, boolean autoIpBan, @NotNull @NotNull String defaultReason, @Nullable @Nullable EscalationConfig escalation, @NotNull @NotNull List<DurationLevel> durations) Constructs a new BanTemplate object.- Parameter:
key- The unique identifier keyname- The display namedescription- The descriptionautoIpBan- Whether this template auto IP bansdefaultReason- The default reasonescalation- The escalation configuration (can be null)durations- The list of duration levels
-
-
Methodendetails
-
getKey
Gets the unique identifier key for this template.- Gibt zurück:
- The template key (e.g., "cheating", "griefing")
-
getName
Gets the display name of this template.- Gibt zurück:
- The display name
-
getDescription
Gets the description of this template.- Gibt zurück:
- The description
-
isAutoIpBan
public boolean isAutoIpBan()Checks if this template automatically IP bans.- Gibt zurück:
trueif this template auto IP bans,falsefor regular bans
-
getDefaultReason
Gets the default reason for bans using this template.- Gibt zurück:
- The default reason
-
getEscalation
Gets the escalation configuration.- Gibt zurück:
- The escalation configuration, or
nullif escalation is disabled
-
getDurations
Gets the list of duration levels for this template.Each duration level corresponds to a specific offense level and defines the ban duration and reason suffix that will be applied.
- Gibt zurück:
- The list of duration levels
-
getDurationLevel
Gets the duration level for a specific offense level.Returns the duration level that matches the specified offense level. If no exact match is found, returns the highest level or the first level.
- Parameter:
offenseLevel- The offense level (1 = first offense, 2 = second offense, etc.)- Gibt zurück:
- The duration level, or
nullif no durations are configured
-
getMaxOffenseLevel
public int getMaxOffenseLevel()Gets the maximum offense level configured for this template.- Gibt zurück:
- The maximum offense level, or 1 if no durations are configured
-
toString
-