Package de.marcely.bedwars.api
Interface MigrationProcess
public interface MigrationProcess
It's possible to migrate from previous sources. This class represents a process that has been manually run.
The process is being done on a seperate thread.
Possibly the user for instance has been using an other Bedwars plugin and is now using this one.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA callback gets called when the process is done.static enumThe previous system that has been used from which we're migrating from. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCallback(MigrationProcess.Callback callback) Add a callback to know then the process is done.booleancancel()Forcefully terminate the running process.Returns all callbacks that have been added.Returns the previously used system.booleanReturns whether it is still runningbooleanremoveCallback(MigrationProcess.Callback callback) Remove a previously added callback.booleanrun()You must manually run this method in order to run this.
-
Method Details
-
getOrigin
MigrationProcess.Origin getOrigin()Returns the previously used system.- Returns:
- The origin from which we're migrating from
-
run
boolean run()You must manually run this method in order to run this. You might want to add callbacks before that usingaddCallback(Callback)in order to know when it's done. It's not possible to run a process twice.- Returns:
truewhen it has been started for the first time, and it's now actually running
-
cancel
boolean cancel()Forcefully terminate the running process. It's possible that this doesn't occur immediately and that it is still running for a while beyond that.- Returns:
trueif the process has been running and now has been cancelled.
-
isRunning
boolean isRunning()Returns whether it is still running- Returns:
trueif the migration is still being processed
-
addCallback
Add a callback to know then the process is done. It's highly recommended doing that before running the process, otherwise you possibly face a race condition.- Parameters:
callback- The new callback you want to add
-
removeCallback
Remove a previously added callback.- Parameters:
callback- The callback you don't want to be called- Returns:
trueif it has been found and removed
-
getCallbacks
Collection<MigrationProcess.Callback> getCallbacks()Returns all callbacks that have been added. This collection is modifiable, meaning that you don't really have to useaddCallback(Callback).- Returns:
- All callbacks that have been added
-