Package de.jvstvshd.necrify.api.template
Interface NecrifyTemplate
- All Known Implementing Classes:
MinecraftTemplate
public interface NecrifyTemplate
A template is a set of
stages that are used to unify punishments so that for every same
reason of punishing the same punishment is issued with the option to stage this. For example, if some player is cheating,
they can be banned at the first occasion for 30 days and after that permanently if they chose to cheat yet again.
It is also possible to set up different types of punishments for the same template, so as for example one could be muted for using inappropriate language and then banned for the same reason in the next stage.
Stages are uniquely identified by their name.
- Since:
- 1.2.3
- See Also:
-
Method Summary
Modifier and TypeMethodDescription@NotNull CompletableFuture<Void> addStage(NecrifyTemplateStage stage) Adds a new stage to this template.delete()Deletes this template.@NotNull NecrifyTemplateStagegetStage(int index) Attempts to return the stage corresponding with the given index.@NotNull Stringname()The unique name of this template used to identify it.removeStage(int index) Removes the stage at the specified index from this template.@NotNull Collection<NecrifyTemplateStage> stages()
-
Method Details
-
name
The unique name of this template used to identify it.- Returns:
- the name of this template
-
stages
- Returns:
- a list of all stages compromised within this template
-
getStage
Attempts to return the stage corresponding with the given index. If the index is out of bounds or there exist no stages, an exception is thrown.- Parameters:
index- the index of the stage- Returns:
- the stage at the given index
- Throws:
NoSuchElementException- if there are no stagesIndexOutOfBoundsException- if the index is out of bounds
-
addStage
Adds a new stage to this template.- Parameters:
stage- the stage to add- Returns:
- a
CompletableFuturefinishing either successfully or with an error but with no result value
-
delete
CompletableFuture<Integer> delete()Deletes this template. This will remove all stages added to this template.- Returns:
- a
CompletableFuturefinishing either successfully or with an error but with no result value
-
removeStage
Removes the stage at the specified index from this template.- Parameters:
index- the index of the stage to be removed- Returns:
- the removed stage that was previously located at the specified index
- Throws:
IndexOutOfBoundsException- if the specified index is invalid or out of bounds
-