Klasse SoftRestore

java.lang.Object
de.delinkedde.mobarenareborn.protection.SoftRestore
Alle implementierten Schnittstellen:
Listener

public final class SoftRestore extends Object implements Listener
Soft-restore: instead of cancelling block changes inside an arena during a round, the original block states are captured and rebuilt when the round ends. This lets arenas be destructible (blow up walls, dig tunnels) while still resetting cleanly. Optionally, container inventories in the arena region are snapshotted at round start and refilled at round end - so loot chests reset every round. All opt-in via protection.soft-restore and protection.reset-containers.
  • Konstruktordetails

    • SoftRestore

      public SoftRestore(@NotNull @NotNull MobArenaPlugin plugin, @NotNull @NotNull ConfigManager config, @NotNull @NotNull ArenaManager arenas, @NotNull @NotNull SessionManager sessions)
      Parameter:
      plugin - the owning plugin
      config - the configuration manager
      arenas - the arena manager, to resolve the arena a block belongs to
      sessions - the session manager, to check for a running round
  • Methodendetails

    • isEnabled

      public boolean isEnabled()
      Gibt zurück:
      whether soft-restore is enabled at all
    • tryCapture

      public boolean tryCapture(@NotNull @NotNull Block block)
      Tries to capture a block for later restore. Returns true when the caller should allow the change (soft-restore is on and the block is in a running arena); otherwise false (the caller should protect as usual).
      Parameter:
      block - the block about to change
      Gibt zurück:
      whether the change may proceed under soft-restore
    • onRoundStart

      public void onRoundStart(@NotNull @NotNull ArenaRoundStartEvent event)
      Snapshots container inventories at round start (when reset-containers is on).
      Parameter:
      event - the round-start event
    • onRoundEnd

      public void onRoundEnd(@NotNull @NotNull ArenaRoundEndEvent event)
      Restores captured blocks and container contents when the round ends.
      Parameter:
      event - the round-end event