Interface MachineEngine


@NonExtendable public interface MachineEngine
A running MachineEngine: frozen registries and the runtime services built on them.
  • Method Details

    • register

      static void register(@NotNull @NotNull AddonRegistration registration)
      Submits an addon's registration. Call it from the plugin's onLoad(); 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

      @NotNull static @NotNull MachineEngine get()
      Returns:
      the running engine
      Throws:
      IllegalStateException - before MachineEngine has enabled
    • config

      @NotNull static @NotNull ConfigValues 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

      @NotNull static @NotNull Scheduler scheduler(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
      A Scheduler whose tasks belong to plugin and stop when it is disabled (D35). Available from MachineEngine's onLoad; tasks can be scheduled once the plugin is enabled.
      Throws:
      IllegalStateException - before MachineEngine has loaded, or without a server (headless tests)
    • phase

      @NotNull @NotNull LifecyclePhase phase()
    • registries

      @NotNull @NotNull RegistryAccess registries()
    • events

      @NotNull @NotNull EventBus events()
    • transactions

      @NotNull @NotNull TransactionManager transactions()
    • converters

      @NotNull @NotNull ResourceConverterLookup converters()
    • tags

      @NotNull @NotNull ResourceTags tags()
      The current tag snapshot.
    • enabledAddons

      @NotNull @NotNull Set<AddonId> enabledAddons()
      Addons whose content is active.
    • disabledAddons

      @NotNull @NotNull Set<AddonId> disabledAddons()
      Addons whose content was disabled at startup because of errors (see startupReport()).
    • startupReport

      @NotNull @NotNull ValidationReport startupReport()
      Everything found while starting.
    • reload

      @NotNull @NotNull ValidationReport reload(@NotNull @NotNull RegistryType<?> type)
      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 - if type is not a reloadable registry
    • machineAt

      @NotNull @NotNull Optional<MachineInstance> machineAt(@NotNull @NotNull WorldPosition position)
      The loaded machine at position. Owner thread of that position only. Empty if there is none, if it is a placeholder, or if no platform hosts machines (headless).
    • players

      @NotNull @NotNull MachinePlayers players()
      The data MachineEngine and addons keep per player (D37). Headless (tests) it holds players the test joins itself, saved in memory.