Skip to content

15. Resource Files ​

Resource files live in each module's src/main/resources/. They are bundled into the shadow jar at build time.

15.1 Paper Resources (paper/src/main/resources/) ​

FilePurpose
paper-plugin.ymlThe descriptor of the plugin: the loader, the dependencies and the api version.
config.ymlThe default configuration. Copied to the data folder when it is not there yet.
data.ymlThe data of the server: the uuid of the server. Written by the plugin on every start.
logback.xmlThe logger of the plugin.

There is no messages.yml in the resources: the messages are generated on the first start from the defaults of the plugin, so that the file always holds every key of this version.

paper-plugin.yml ​

yaml
name: AppelToolsPaper
version: '${version}'
description: '${description}'
main: me.Maussee.AppelTools.paper.AppelToolsPaperBootstrap
loader: me.Maussee.AppelTools.paper.AppelToolsPaperLoader
author: '${author}'

api-version: 1.21
dependencies:
  server:
    LuckPerms:
      load: BEFORE
      required: true
      join-classpath: true
    Vault:
      load: BEFORE
      required: true
      join-classpath: true
    PremiumVanish:
      load: BEFORE
      required: true
      join-classpath: true

The plugin has no libraries: section: MySQL, HikariCP, ConfigLib, LiteCommands and the rest are shaded into the jar by the shadow plugin and moved under their own namespace, so they cannot clash with the copy another plugin brings.

15.2 Velocity Resources (velocity/src/main/resources/) ​

FilePurpose
config.ymlThe default configuration. Copied to the data folder when it is not there yet.

The Velocity plugin has no descriptor file: it is described by the annotation on its bootstrap class.

java
@Plugin(
        id = "appeltoolsvelocity",
        name = "AppelToolsVelocity",
        version = Constants.VERSION,
        description = Constants.DESCRIPTION,
        authors = "Maussee",
        dependencies = {
                @Dependency(id = "luckperms"),
                @Dependency(id = "vpacketevents")
        }
)

15.3 Common Resources (common/src/main/resources/) ​

FilePurpose
crash-signatures.ymlThe patterns that recognise a crash in the log of a server.
i18n/messages.propertiesThe English texts of the common module.
i18n/messages_nl.propertiesThe Dutch texts of the common module.

15.4 On-disk Files at Runtime ​

After the first start, the data folders hold:

Paper (plugins/AppelToolsPaper/) ​

config.yml               # the configuration, user-edited
messages.yml             # the messages, user-edited
data.yml                 # { server-uuid: "<random-uuid>" }

Velocity (plugins/AppelTools/) ​

config.yml               # the configuration, user-edited
messages.yml             # the messages, user-edited
data.yml                 # the data of the proxy

MySQL ​

appelSettings
playerData
playerServerData
punishments
staffInventory
servers
friendRequests
homes
reports
player_notes
playerIPs
sessions
sessionServers
transactions
playerNames
serverStats
twoFactor
twoFactorTrustedIp
schema_version

The three tables _obsolete_punishments, _obsolete_tempPunishments and _obsolete_undonePunishments hold the rows of the punishment tables before they were merged into punishments. Nothing reads them; they may be dropped.

15.5 Resource Loading ​

java
InputStream in = getClass().getClassLoader().getResourceAsStream("config.yml");

The plugin reads the file from the data folder first. When it is not there yet, the copy in the jar is written to it — and the file is written back on every start, so that a key that a newer version adds appears with its default.

YamlStore.store(Class, Path) hands out the store of a file. The store of messages.yml coerces the shape of a value: a message may be written as a single string or as a list of lines. Every other file keeps its own types, so a value that does not have the shape its component asks for is refused.

The keys are written in lower kebab case (two-factor.server-key), and a value that is null is left out of the file.

15.6 Backup and Migration ​

  • A key that is missing from the file is written back with its default; the values that are in the file are kept.
  • The file is written back on every start, so a file that was written by an older version gains the keys of the new one without a migration step.
  • data.yml carries a header that says that it is managed by the plugin: the values in it are overwritten on the next save.

15.7 Localization ​

Locale (from server.locale) selects the language of the messages: en or nl. The messages of the plugin itself are MiniMessage and are not translated — only the texts of the common module have a language file, in common/src/main/resources/i18n/.

The dates are formatted per locale:

  • en → MM/dd/yyyy HH:mm
  • nl → dd-MM-yyyy HH:mm

15.8 Icon and Asset Resources ​

None. The plugin does not ship textures, models or sounds. The icon of the maintenance mode and the icon of the server info are read from a file the operator puts in the data folder.

15.9 Build-time Resources ​

The replaceTokens Gradle task copies common/src/main/java into common/build/filteredSrc and replaces @version@ and @description@ in it. compileJava reads from that folder, so the substitution happens before the compilation.

The task is a Sync and not a Copy: a copy never removes what was deleted, so a source file that is gone would keep being compiled out of the filtered folder.

15.10 Deployment ​

There are no deploy tasks in 3.0.0: the release is built locally and dropped into the plugins folder by hand. The data folder is left intact, so a new jar never overwrites a configuration.

Built with VitePress.