Package io.github.simplexdevelopment.api
Interface IService
- All Superinterfaces:
Runnable
- All Known Implementing Classes:
ExecutableService
,ServiceImpl
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull org.bukkit.NamespacedKey
long
getDelay()
org.bukkit.NamespacedKey
reactor.core.publisher.Mono<ServicePool>
long
org.bukkit.plugin.java.JavaPlugin
boolean
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.default void
run()
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
ServicePool
which 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.
-