Skip to main content

BetterFood Compatibility

Runtime Targets​

The current repo targets:

  • Plugin version: 1.5.6
  • Bukkit api-version: 1.21.4
  • Spigot API build target: 26.3-R0.1-SNAPSHOT
  • Java: 21

Commands​

The plugin uses:

  • /betterfood
  • /bf

Player-facing subcommands focus on toggling:

  • automatic eating (toggleEating, or just /betterfood with no arguments)
  • consumption feedback messages on the action bar (toggleMessage)

Admin subcommands (require betterfood.admin) expose the shared Nightbreak tooling:

  • setup — opens the in-game setup menu
  • recommendedplugins — shows plugins that pair well with BetterFood. BetterFood currently has no entries in the shared recommendation catalog, so this opens an empty menu and tells you there are no extra recommendations right now (console senders get the same note in chat form)
  • downloadpluginupdate / downloadall — downloads a plugin update if one is available
  • applypluginupdate applies a downloaded plugin update without a server restart (see Restart-Free Plugin Updates)
  • downloadallcontent — reports that BetterFood has no content packs

Tab completion is filtered by permission and by what has been typed so far: toggleEating and toggleMessage are only suggested to senders with betterfood.user, and downloadpluginupdate, applypluginupdate, downloadallcontent, setup, and recommendedplugins only to senders with betterfood.admin. The accepted downloadall alias is intentionally not suggested. The two player toggles are player-only — the explicit toggleEating / toggleMessage subcommands refuse non-player senders with "BetterFood settings can only be changed in-game.", while the bare /betterfood command points console senders to the update command instead. A player without betterfood.user is told they do not have permission to change BetterFood settings. An unrecognised subcommand, or more than one argument, prints the usage line. Admins see the toggles and the update, setup, and recommendation commands; everyone else only sees the two toggles. The usage line omits downloadallcontent, although the command is accepted and offered in admin tab completion.

Shared MagmaCore Commands​

The bundled MagmaCore tooling adds the commands below during startup. The global commands are registered at load time only if their names are available; on a server with other MagmaGuy plugins, the first registration owns each name. BetterFood's release-notes command is initialized when the plugin is enabled:

  • /nightbreak plugins — browses the plugin catalog, as a menu in-game and as a chat list from console (nightbreak.plugins, default op). The bare /nightbreak only prints the usage line.
  • /nightbreaklogin [token] and /nightbreaklogout — link the server to a Nightbreak account and disconnect it. Without a token, /nightbreaklogin prints a nightbreak.io link to approve (nightbreak.login, default op)
  • /logify — uploads the current server log to mclo.gs (logify.*, default op)
  • /betterfoodchangelog [dismiss|disable] — shows unread BetterFood release notes. This one is namespaced per plugin, so it does not collide; if /betterfoodchangelog is somehow taken it falls back to a betterfood:betterfoodchangelog style label.

The changelog command is admin- and player-only: it answers senders without an admin permission (or console) with "This command is only available to plugin administrators in-game." It counts a player as an admin if they are op or hold betterfood.admin or betterfood.*. Admins are also nudged about unread release notes shortly after joining, unless they ran /betterfoodchangelog disable. Read/dismissed state is stored per player in plugins/BetterFood/nightbreak-changelogs.yml.

See Nightbreak Tokens, Nightbreak Setup, and Changelog Notifications for the shared flow.

Permissions​

  • betterfood.user (default true) — gates the auto-eat listener and the player toggles.
  • betterfood.admin (default op) — gates the plugin update download and apply, setup menu, and recommended-plugins commands. It also counts as an admin permission for the changelog command.
  • nightbreak.plugins, nightbreak.login, and logify.* (all default op) — registered by the bundled MagmaCore tooling for the shared commands above, not declared in BetterFood's plugin.yml.

Other Integrations​

  • bStats metrics are enabled (plugin id 4557) — disable globally via the bStats configuration if you want to opt out.
  • BetterFood now ships the shared MagmaCore tooling. It generates a config.yml with two keys, the nightbreak.autoDownloadPluginUpdates toggle (default false) and nightbreak.applyPluginUpdatesWithoutRestart (default never, see Restart-Free Plugin Updates), and checks nightbreak.io for a newer release a few minutes after boot (the delay is staggered per plugin so several MagmaGuy plugins do not all call out at once), then about once an hour. Results are only logged when they change, so the console is not re-spammed every hour. BetterFood passes no SpigotMC resource ID and its catalog entry has none either, so there is no SpigotMC version fallback.
  • Operators who join while an update is pending get a chat notice with the download page link, a few seconds after logging in. It is sent on every join for as long as the installed version is behind.
  • The account token lives outside the plugin folder, in the shared plugins/MagmaCore/nightbreak.yml, so linking once covers every MagmaGuy plugin on the server.
  • No external plugin dependencies; the food logic listens only to vanilla FoodLevelChangeEvent.

Restart-Free Plugin Updates​

A downloaded plugin update waits in the server's update folder. /betterfood applypluginupdate swaps it in without restarting the server: BetterFood is disabled, its jar is replaced, and the new version is loaded and enabled. Players' eating and message toggles are stored on the players, so they carry over.

The command refuses, with a message, when no downloaded update is waiting, when the waiting update is not newer than the running version or its jar is not valid, when a plugin from another author depends or soft-depends on BetterFood, or when another plugin swap is already running. If the new version fails to enable, the previous jar is loaded again and the update stays in the update folder for the next restart.

nightbreak.applyPluginUpdatesWithoutRestart in config.yml decides what happens right after any plugin update download, whether it came from downloadpluginupdate, downloadall, the setup menu, or an automatic download:

ValueBehavior
neverDefault. The update waits for the next restart. Online admins with betterfood.admin or betterfood.* are told a restart is required and are shown the applypluginupdate command
when-emptyApplies the update immediately if no players are online, otherwise checks every 30 seconds and applies it once the server is empty
immediatelyApplies the update as soon as the download finishes

Any other value behaves as never.

Building From Source​

BetterFood builds with JDK 21 and the included Gradle wrapper. From the repository root, run:

./gradlew shadowJar

On Windows, run .\gradlew.bat shadowJar. The plugin JAR is written to build/libs/BetterFood.jar. If the MC_DIST_DIR environment variable or the mcDistDir Gradle property is set, the build also copies the JAR into that folder. The test suite runs on a Java 25 toolchain, so ./gradlew build also needs JDK 25.

MagmaCore is shaded into the JAR and resolves from Maven Local before MagmaGuy's Maven repository. When the source needs MagmaCore changes newer than the published build, publish MagmaCore to Maven Local first, as described in Building a consumer after library changes.

The Java plugin API page covers the Maven artifact and what an integration can rely on.