Class ServiceTemplate.Builder
java.lang.Object
eu.cloudnetservice.driver.service.ServiceTemplate.Builder
- Enclosing class:
ServiceTemplate
A builder for a template storage.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalwaysCopyToStaticServices(boolean alwaysCopyToStaticServices) Sets the if the template should always get copied onto static services.build()Builds the service template based on this builder.Sets the name of the template.Sets the prefix of the template.priority(int priority) Sets the priority of the template.Sets the storage of the template.
-
Field Details
-
name
-
prefix
-
storage
-
priority
private int priority -
alwaysCopyToStaticServices
private boolean alwaysCopyToStaticServices
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Sets the name of the template. The name is the main identification point of the template and can be for example 2x2 if you want to name a map for 4 players.- Parameters:
name- the name of the template.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given name is null.
-
prefix
Sets the prefix of the template. This can be used to group templates together, for example all templates for BedWars. The names of the templates would be the map sized (for example 2x2 or 3x3), grouped by the prefix of the template, BedWars.- Parameters:
prefix- the prefix of the template.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given prefix is null.
-
storage
Sets the storage of the template. No check is made if the storage given to this method actually exists.- Parameters:
storage- the storage of the template.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given storage name is null.
-
priority
Sets the priority of the template. The priority is used to control the order in which templates get loaded onto a service to prevent for example accidental overrides of files which are located in multiple templates. The template with the highest priority will be loaded at the end.- Parameters:
priority- the priority of the template.- Returns:
- the same instance as used to call the method, for chaining.
-
alwaysCopyToStaticServices
@NonNull public @NonNull ServiceTemplate.Builder alwaysCopyToStaticServices(boolean alwaysCopyToStaticServices) Sets the if the template should always get copied onto static services. By default, all templates will only get copied once at the initial startup of the static service.- Parameters:
alwaysCopyToStaticServices- if the template should always be copied onto static services.- Returns:
- the same instance as used to call the method, for chaining.
-
build
Builds the service template based on this builder.- Returns:
- the created service template.
- Throws:
NullPointerException- if no name or prefix was given.
-