Template
Templates are another fundamental component of CloudNet. They determine how Services of a Task are assembled and which files the services use.
By default, templates are created in the local/templates directory of the CloudNet installation. A template
always consists of multiple folders. This structure can be represented as follows:
cloudnet
└── local
└── templates
├── Proxy
│ └── default
├── Lobby
│ ├── default
│ └── winter_lobby
└── AntiCheat
├── spigot-legacy
└── spigot-modern
Prefix
The prefix of a template is the first of the two parts. The prefix allows similar or related
templates to be grouped and thus separated from other templates. In the example above, Proxy, Lobby
and AntiCheat are the prefixes of the respective templates.
Name
The name of a template is the second part. The name completes the template definition. In the example above,
default, winter_lobby, spigot-legacy and spigot-modern are the names of the templates.
Within CloudNet commands, templates are usually specified in the following format prefix/name, as this is a
unique name for all templates.
Storage
The storage indicates which TemplateStorage (LINK HERE) the template comes from. By default, the template
storage local (LINK) is used. This represents the local file system and is located by default
in local/templates.
Priority
The Priority option allows you to specify in which order the templates should be copied to a service. A low priority means that the template is copied first and templates with a higher priority are copied to the service afterwards. Effectively, this means that templates with a higher priority can overwrite files from templates with a lower priority.
AlwaysCopyToStaticServices
The AlwaysCopyToStaticServices option allows you to determine whether a template should also be
copied to static services. By default, templates are only copied on the first
start of these static services and then not used further. If you enable the alwaysCopyToStaticServices
option for a template, it will be copied every time the static service starts.
If the template contains files that are already contained in the static service, those of the service will be overwritten.
How are my templates copied?
When a new service starts, all templates are collected based on the Tasks and based on the Groups. Then the templates are ordered based on the priorities so that they are copied in the correct order.
Finally, all files and folders from local/templates/<prefix>/<name> are copied to the service.