Interface MachineEngine
@NonExtendable
public interface MachineEngine
A running MachineEngine: frozen registries and the runtime services built on them.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ConfigValuesconfig()MachineEngine's settings (EngineConfig), loaded before addons'onLoad.@NotNull ResourceConverterLookupAddons whose content was disabled at startup because of errors (seestartupReport()).Addons whose content is active.@NotNull EventBusevents()static @NotNull MachineEngineget()@NotNull Optional<MachineInstance> machineAt(@NotNull WorldPosition position) The loaded machine atposition.@NotNull LifecyclePhasephase()@NotNull MachinePlayersplayers()The data MachineEngine and addons keep per player (D37).static voidregister(@NotNull AddonRegistration registration) Submits an addon's registration.@NotNull RegistryAccess@NotNull ValidationReportreload(@NotNull RegistryType<?> type) Rebuilds a reloadable registry.static @NotNull Schedulerscheduler(@NotNull org.bukkit.plugin.Plugin plugin) ASchedulerwhose tasks belong topluginand stop when it is disabled (D35).@NotNull ValidationReportEverything found while starting.@NotNull ResourceTagstags()The current tag snapshot.@NotNull TransactionManager
-
Method Details
-
register
Submits an addon's registration. Call it from the plugin'sonLoad(); MachineEngine runs all registrations in dependency order when it enables, before worlds load (D13).MachineEngine.register(AddonRegistration.builder(getName(), getPluginMeta().getVersion()) .requiresApi("[0.1,1.0)") .register(ctx -> ctx.machineTypes().register(MY_MACHINE)) .build());- Throws:
IllegalStateException- if registration is already closed
-
get
- Returns:
- the running engine
- Throws:
IllegalStateException- before MachineEngine has enabled
-
config
MachineEngine's settings (EngineConfig), loaded before addons'onLoad. Without a server (headless tests) every key has its default. A reload swaps the values; read them when needed instead of keeping them. -
scheduler
ASchedulerwhose tasks belong topluginand stop when it is disabled (D35). Available from MachineEngine'sonLoad; tasks can be scheduled once the plugin is enabled.- Throws:
IllegalStateException- before MachineEngine has loaded, or without a server (headless tests)
-
phase
-
registries
-
events
-
transactions
-
converters
-
tags
The current tag snapshot. -
enabledAddons
-
disabledAddons
Addons whose content was disabled at startup because of errors (seestartupReport()). -
startupReport
Everything found while starting. -
reload
Rebuilds a reloadable registry. If the new snapshot has errors, it is rejected and the current one stays live (ยง7.3).- Returns:
- the findings of the reload
- Throws:
IllegalArgumentException- iftypeis not a reloadable registry
-
machineAt
The loaded machine atposition. Owner thread of that position only. Empty if there is none, if it is a placeholder, or if no platform hosts machines (headless). -
players
The data MachineEngine and addons keep per player (D37). Headless (tests) it holds players the test joins itself, saved in memory.
-