Package io.github.simplexdevelopment.api
Interface IService
- All Superinterfaces:
Runnable
- All Known Implementing Classes:
ExecutableService,ServiceImpl
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull org.bukkit.NamespacedKeylonggetDelay()org.bukkit.NamespacedKeyreactor.core.publisher.Mono<ServicePool>longorg.bukkit.plugin.java.JavaPluginbooleanstatic @NotNull org.bukkit.NamespacedKeynewNamespacedKey(String space, String key) This is an easy static call for creating a new namespaced key for services and service pools.default voidrun()reactor.core.publisher.Mono<Void>start()The actual start method for the service.reactor.core.publisher.Mono<Void>stop()The actual end method for the service.
-
Method Details
-
getDefaultNamespacedKey
@Contract(" -> new") @NotNull static @NotNull org.bukkit.NamespacedKey getDefaultNamespacedKey() -
getNamespacedKey
org.bukkit.NamespacedKey getNamespacedKey()- Returns:
- The NamespacedKey of this service.
-
isPeriodic
boolean isPeriodic()- Returns:
- If the service should be scheduled for repeated executions or not.
-
getPeriod
long getPeriod()- Returns:
- How long the service should wait between subsequent executions.
-
getDelay
long getDelay()- Returns:
- How long the service should wait before executing the first time.
-
start
reactor.core.publisher.Mono<Void> start()The actual start method for the service. This should be overridden by subclasses, and should include all the required code necessary to execute when the service is queued.- Returns:
- An encapsulated Mono object representing the start method for the service.
-
stop
reactor.core.publisher.Mono<Void> stop()The actual end method for the service. This should be overridden by subclasses, and should include all the required code necessary to execute when the service is stopped.- Returns:
- An encapsulated Mono object representing the end method for the service.
-
getPlugin
org.bukkit.plugin.java.JavaPlugin getPlugin()- Returns:
- The plugin which was defined in the constructor. This should be an instance of your main plugin class.
-
getParentPool
reactor.core.publisher.Mono<ServicePool> getParentPool()- Returns:
- The
ServicePoolwhich this service is executing on.
-
run
default void run() -
newNamespacedKey
@Contract("_, _ -> new") @NotNull static @NotNull org.bukkit.NamespacedKey newNamespacedKey(String space, String key) This is an easy static call for creating a new namespaced key for services and service pools.- Parameters:
space- The namespace of the service.key- The key name of the service.- Returns:
- A NamespacedKey object representing the service.
-