Klasse BanTemplate

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

public class BanTemplate extends Object
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
  • 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 key
      name - The display name
      description - The description
      autoIpBan - Whether this template auto IP bans
      defaultReason - The default reason
      escalation - The escalation configuration (can be null)
      durations - The list of duration levels
  • Methodendetails

    • getKey

      @NotNull public @NotNull String getKey()
      Gets the unique identifier key for this template.
      Gibt zurück:
      The template key (e.g., "cheating", "griefing")
    • getName

      @NotNull public @NotNull String getName()
      Gets the display name of this template.
      Gibt zurück:
      The display name
    • getDescription

      @NotNull public @NotNull String 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:
      true if this template auto IP bans, false for regular bans
    • getDefaultReason

      @NotNull public @NotNull String getDefaultReason()
      Gets the default reason for bans using this template.
      Gibt zurück:
      The default reason
    • getEscalation

      @Nullable public @Nullable EscalationConfig getEscalation()
      Gets the escalation configuration.
      Gibt zurück:
      The escalation configuration, or null if escalation is disabled
    • getDurations

      @NotNull public @NotNull List<DurationLevel> 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

      @Nullable public @Nullable DurationLevel getDurationLevel(int offenseLevel)
      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 null if 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

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