Content generated with AI — it may contain mistakes.

ExyliaLib/Reference

Module index

Every module, what it is for, and where its entry point lives.

Page 51 of 5412 min read

Every module is reached the same way: a static class named after it, usually with an of(plugin) handing back a view that belongs to your plugin.

Foundations#

ModuleEntry pointWhat it is for
TaskTasks.of(plugin)Scheduling that runs on Spigot, Paper and Folia from one call.
ConfigConfigs.define(plugin, name, type)YAML files declared and read as Java records.
TextText.of(string)Every player-facing string, into Adventure components.
PlaceholdersPlaceholders.group(plugin, prefix)One registry for %placeholders%, with or without PlaceholderAPI.
FormatsFormats, AmountsNumbers, money, percentages and dates a player reads — and amounts a player types.
DebugDebug.of(plugin)Coloured console output, with a server-wide switch.
ReloadingReloads.of(plugin)Named reload steps with contained failures, plus library-reload listeners.
ModulesPluginModules.of(plugin, switches)Switchable parts of a plugin, each with its own files, listeners, actions, menus, commands and timers.
MetricsMetrics.describe(plugin, details)How a plugin's setup is described to stats.exylia.net. See Metrics.
Web editorWebEditor.of(plugin)Editing a plugin's files from the browser.
LogsLogs.of(plugin)A staff audit log every plugin records into, read with /exylialib logs.

Storage#

ModuleEntry pointWhat it is for
DatabaseDatabases.of(plugin)Records in H2, MySQL, MariaDB, PostgreSQL or MongoDB.
TransferTransfers.of(plugin)A plugin's whole database out to one file and back.
RedisconfigurationA shared cache that makes one database look the same from every server.
SnapshotsSnapshots.of(plugin)A player's state kept for later, in memory or stored.
ProxyProxy.request(module, payload)Talking to ExyliaProxyUtils on Velocity or BungeeCord, and every request answered.

Interfaces#

ModuleEntry pointWhat it is for
MenusMenus.of(plugin)Menus written in configuration: lists, templates, conditions, live values.
ItemsItems.of(plugin)Items described in configuration, read once and drawn per player.
ActionsActions.of(plugin, namespace)Compiled, namespaced actions shared by menus and items.
InputInputs.of(plugin)Asking a player for text, numbers, choices or a whole form.
EditorsEditors.of(plugin)Screens for editing the lists a plugin configures.
WizardsWizards.of(plugin)Walking a player through several questions, applied only on confirm.
PreviewsPreviews.of(plugin)Showing one player an effect against an empty sky.
HeadsHeads.browse(inputs, …)The decorative head catalogue, searchable from a menu, a page at a time.
InteractionsInteractions.compile(plugin, lines)What clicking something in the world does: lines with click filters, commands and effect tokens.
TunerTuner.of(plugin, subject)Fine adjustment with the mouse wheel, with a boss-bar HUD and a live preview.
SettingsSettings.register(plugin, setting)Player preferences every plugin registers into, and the one /settings screen.
ToastsToasts.send(player, icon, title, frame)The advancement popup in the corner, with a configurable fallback.
NoticesNotices.of(plugin)Messages left for a player: shown now, across the network, or on their next join.
Discord webhooksWebhooks.of(plugin)Messages to Discord written in config, with escaped values and rate limits.

On screen#

ModuleEntry pointWhat it is for
EffectsEffects.play(config, viewer)Titles, action bars, boss bars, sounds, particles, fireworks.
SequencesSequences.of(plugin)Choreographed effects from configuration: twenty-six shapes, sounds, delays, displays and bodies.
DisplaysDisplays.of(plugin)Item, block and text displays that move, spin and fall by themselves, animated by the client.
NPCsNpcs.of(plugin)Player-shaped bodies that exist only on a client.
RagdollsRagdolls.of(plugin)One of those bodies coming apart, in twelve poses.
OverlaysOverlays.of(plugin)Items in a player's own inventory that the server does not have.
PacketsPackets.of(plugin)Vanish, fake blocks, per-player world borders, freezing, a fake spectator, silent chest viewing and item lines.
ScoreboardScoreboards.show(plugin, player, config)Packet sidebars declared in config.
HologramHolograms.show(plugin, id, location, config)Packet holograms declared in config: line tags, pages, clicks and buttons.
NametagsNametags.of(plugin)Name colour, glow and collision as one player sees another.
ChatChats.rule(plugin, rule)Who reads whose messages, taken off the audience before delivery.
CosmeticsCosmetics.rule(plugin, rule)Whether a player's cosmetics are drawn — one question every cosmetic plugin asks.
ClientClients.of(plugin)Lunar, Feather and the SurvivalCore mod: waypoints, teams, HUD timers and bars, cooldowns.
SkullsSkulls.player(name)Player heads from base64, a URL or a name — cached, never blocking.
ModelsModels.of(plugin)Blockbench models worn by living entities, with no resource pack.
VFXVfx.at(location)Effects built in Java and played as one timeline: displays, sounds, particles, screen shake.
CamerasCameras.of(plugin)Showing a player themselves from outside, and always giving the view back.
ReplaysReplays.of(plugin)Recording what happened and playing it back as packet bodies.
ShowcasesShowcases.of(plugin)Places that show a plugin's cosmetics off on a loop to whoever stands near.

World#

ModuleEntry pointWhat it is for
RegionsRegions.of(plugin)Shapes, a spatial index, overlap policies, enter/exit events, outlines.
SchematicsSchematics.of(plugin)Saving a box of the world and pasting it back.
WorldWorlds.create(key, name)Creating and deleting worlds, from any thread.
WorldGuardWorldGuardRegions, WorldGuardFlagsRegion lookups and the ecosystem's own flags — kill-effects, hit-effects, arrows-effects — with no compile-time dependency.
BlocksBlocks.of(plugin)Blocks that answer clicks instead of behaving like their material, and whether a player placed a block.

Players#

ModuleEntry pointWhat it is for
SessionsSessions.of(plugin)One claim registry so two plugins cannot hold the same player.
PlayersExyliaPlayers.of(…)One ExyliaPlayer over online, offline and network players, resolved without blocking.
StaysStays.of(plugin)A player kept in an arena and given back exactly as they came.
CooldownsCooldowns.forPlugin(plugin)The base every cooldown in the ecosystem sits on.
SchedulesSchedules.of(plugin)Timetables: what starts by itself, when, and under what conditions.
TeleportTeleports.of(plugin)Warmups, safe landings, /back, requests and handovers.
CombatCombat.isTagged(player)Whether a player is fighting, over DeluxeCombat or PvPManager.
ClanClans.clanOf(uuid)One API over eight clan plugins and external bridges.
MobsMobs.of(plugin)Custom mobs from a template, with skills, phases and who hurt them reported on death.

Things a player earns#

ModuleEntry pointWhat it is for
RewardsRewards.of(plugin)Items, commands, money, odds and conditions — offline-safe.
LootLoot.parseAll(lines)What comes out of a chest, a spawner or a broken block.
EconomyEconomy.balance(uuid)Balances, charges and transfers over Vault, PlayerPoints or your own currency.
CratesCrates.of(plugin)The roll, keys, reels, payout and blocks of a crate, shared; the rewards left to the plugin.
ModifiersModifiers.register(plugin, provider)One multiplier pipeline for what players earn, fed by boosters, ranks and places.
PricesPrices.sell(stack)What an item sells for, answered by whichever shop or worth list has it.

Newer modules#

Not a module#

ClassWhat it is
net.exylia.lib.ExyliaLibThe plugin itself: lifecycle and cleanup, nothing else.
net.exylia.lib.platform.Platformcurrent(), isFolia(), isPaper().
net.exylia.lib.api.practicebot.PracticeBotsIn the public API artifact: a bridge to the training-bot plugin, get() and available(). Empty when it is absent.
net.exylia.lib.internal.*Internal. Free to change without notice.
CleanupNo API: plugins/ExyliaLib/cleanup.yml. The server's logs/ folder swept of files older than keep-days, a minute after startup and every six hours.

Reloading#

java
Reloads.of(this)
        .step("configs", () -> { settings.reload(); menus.reload(); })
        .step("arenas", () -> arenas.load())
        .run(sender);

Each step reports for itself: one that throws is named in the console and the sender is told how many succeeded. A half-reloaded plugin that says nothing is worse than one that names what failed.

When /exylialib reload finds a plugin's language changed (language: default following a new library language), it runs that plugin's whole declared Reloads once, so menus, messages and catalogues read the new language without a second command (1.534.0+). Plugins take turns, one every few ticks, so the server keeps running while the language spreads (1.542.0+).

The Reloads a plugin declared last is also what runs after /exylialib updates apply or the web editor writes one of its files, so the change is live without a manual reload. Declare it once, in a field, rather than building it inside the reload command.

java
Reloads.onLibraryReload(this, () -> menus.reload());

The library's own /exylialib reload fires that listener. The palette changing is the usual reason to want it: every compiled menu is holding last week's colours until it is read again.

Plugin modules#

A plugin made of parts a server owner switches on and off. Each part has its own files, listeners, actions, menus, commands and timers, and a part that is off costs nothing.

java
modules = PluginModules.of(this, id -> settings.get().modules().switchOf(id));
modules.register(new MarketModule());
modules.register(new AuctionsModule());          // requiredModules() returns ["market"]
modules.registerActions(actions);                // before the menus are compiled
menus.load(modules.menuIds());
modules.commandHandlers().forEach(lamp::register);
modules.loadOnlinePlayers(Bukkit.getOnlinePlayers());
modules.startTimers();
java
public final class AuctionsModule extends PluginModule {
    public AuctionsModule() { super("auctions"); }
 
    @Override protected List<String> requiredModules() { return List.of("market"); }
    @Override protected void registerConfigs() { config("modules/auctions/config", AuctionsConfig.class).load(); }
    @Override protected void onEnable() { manager = new AuctionManager(); }
    @Override protected void onDisable() { if (manager != null) manager.shutdown(); }
    @Override protected List<Object> commandHandlers() { return List.of(new AuctionsCommand()); }
    @Override protected void timers() { timer(20L, 20L, () -> manager.sweep()); }
}
A switch is read at startupA module whose id has no switch in the config stays off and is reported, so a misspelt key never fails silently. A switch changed later is only reported by pendingRestart(), unless the plugin switches it live with setEnabled (below).
RequirementsrequiredPlugins() and requiredModules() keep a module off, with a console line, while what it needs is missing.
One module never takes the others downA module that throws while enabling has its new listeners removed, gets its own onDisable, and stays off; the rest still start.
Lookups answer only for running modulesgetModule(id) and isEnabled(id) are empty for a module that is off, missing a requirement or failed.
ReloadreloadConfigs() reloads every running module, each on its own. reload(id) reloads one module in place — for an in-game editor that changed one module's settings.
CommandscommandHandlers() returns plain handler objects for the plugin to register with its own Lamp. registerCommands(lamp) is deprecated.

On disable, disableAll() disables the running modules in reverse order.

Switching a module live#

Since 1.557.0, modules.setEnabled("auctions", false) turns a module on or off without a restart and returns a ModuleToggle (succeeded(), changed(), missing(), menus()). Persisting the switch is the plugin's job.

StatusMeaning
ENABLED / DISABLEDit runs, or is off, now; changed() holds the dependants that moved with it
UNCHANGEDit already was in that state
BLOCKEDit stays off: missing() names the plugins or modules it needs that are not running
FAILEDit threw while enabling, was released and stays off
UNKNOWNno module has that id
  • Off: every running module that needs it goes off first, last registered first: listeners from onEnable are unregistered, timers stop, onDisable runs. On: registerConfigs, onEnable, actions, online players, timers, then the dependants whose switch is on come back. The switch asked for wins for the rest of the run.
  • Actions of an off module answer stop("switched off") (actions.onlyWhile(module::isEnabled)), so compiled menus keep working.
  • Commands cannot be unregistered in Lamp: register modules.allCommandHandlers() and refuse an off module's commands with one commandCondition using modules.offModuleOf(method).

Debug output#

java
Debug debug = Debug.of(this);
 
debug.success("Configs loaded");
debug.warn("Arena 'main' has no schematic");
debug.error("Could not reach the database", failure);
debug.debug("Session drained: " + entries);      // only when debug is on

Debug.all(true) turns debug lines on for every plugin at once, which is the switch to reach for when reproducing something rather than editing each plugin's config.

Something missing on this page? Tell us on Discord