Class GlobalWorldEventManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintUUID[]booleanvoidclear()Removes every active global world-event id and drops the queued start and stop tasks.booleanbooleanvoidstatic voidscheduleRestartEventInAllWorlds(UUID eventId) Stops the event in every world, then starts it again.static voidscheduleStartEventInAllWorlds(UUID eventId) voidshutdown()voidstart(Store<EntityStore> store, WorldEventRecord[] events) static booleanstartEvent(UUID eventId) voidstartup()static boolean
-
Field Details
-
INSTANCE
-
FILENAME
- See Also:
-
-
Constructor Details
-
GlobalWorldEventManager
public GlobalWorldEventManager()
-
-
Method Details
-
clear
public void clear()Removes every active global world-event id and drops the queued start and stop tasks.The caller must stop the running events itself. This method only clears the manager.
Does not touch
taskBuffer.runTasks()drains and runs that list under the same lock, so this call and a task run cannot interleave: the queue is either wiped before a task is drained, or the drained tasks run to completion first. A reset cannot race a mid-drain task and leave a global event running in worlds it just reset. -
add
-
contains
-
activeCount
public int activeCount()- Returns:
- the number of active ids, without the copy that
activeIds()makes
-
activeIds
- Returns:
- a sorted snapshot of the active global world-event ids
-
remove
-
start
-
loadAsync
-
saveAsync
public void saveAsync() -
startup
public void startup() -
shutdown
public void shutdown() -
startEvent
-
stopEvent
-
scheduleStartEventInAllWorlds
-
scheduleRestartEventInAllWorlds
Stops the event in every world, then starts it again.scheduleStartEventInAllWorlds(UUID)alone cannot restart a running event, becauseEventStartAction.startEvent(ComponentAccessor, WorldEventRecord)refuses an id that the world already runs. Both halves run in one task, so each world receives the stop before the start. The removal that the stop queues is applied before the start task runs, so the start then sees a free id.
-