Skip to content

Commit

Permalink
Update javadocs & readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Anon8281 committed Jul 21, 2023
1 parent df7fd7b commit 6f64e21
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Universal Scheduler
[![](https://jitpack.io/v/Anon8281/UniversalScheduler.svg)](https://jitpack.io/#Anon8281/UniversalScheduler)

Is a lib for java minecraft plugins to simplify Folia support implementation
> Just for information: Folia doesn't support any of `Bukkit.getScheduler().*` and `Bukkit.getServer().getScheduler().*`
Expand All @@ -18,13 +19,15 @@ Is a lib for java minecraft plugins to simplify Folia support implementation

```java
private static TaskScheduler scheduler;
...
```
```java
@Override
public void onEnable() {
//if your already have onEnable() just add next line to it
scheduler = UniversalScheduler.getScheduler(this);
}
...
```
```java
public static TaskScheduler getScheduler() {
return scheduler;
}
Expand All @@ -38,6 +41,12 @@ Main.getScheduler().runTaskLater(() -> { //Main there is your plugin Main
}, 10L);
```

3. If you need to get the scheduled task for some reason
```java
MyScheduledTask task = Main.getScheduler().runTaskLater(() -> { //Main there is your plugin Main
Bukkit.broadcastMessage("Wow, it was scheduled")
}, 10L);
```
### Maven information

```xml
Expand All @@ -51,7 +60,7 @@ Main.getScheduler().runTaskLater(() -> { //Main there is your plugin Main
<dependency>
<groupId>com.github.Anon8281</groupId>
<artifactId>UniversalScheduler</artifactId>
<version>0.1.5</version>
<version>[VERSION]</version>
<scope>compile</scope>
</dependency>
```
Expand Down Expand Up @@ -100,7 +109,7 @@ repositories {
```groovy
dependencies {
...
implementation 'com.github.Anon8281:UniversalScheduler:0.1.5'
implementation 'com.github.Anon8281:UniversalScheduler:[VERSION]'
}
```
Shading:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,28 @@
import org.bukkit.plugin.Plugin;

public interface MyScheduledTask {
/**
* Cancels executing task
*/
void cancel();

/**
* @return true if task is cancelled, false otherwise
*/
boolean isCancelled();

/**
* @return The plugin under which the task was scheduled.
*/
Plugin getOwningPlugin();

/**
* @return true if task is currently executing, false otherwise
*/
boolean isCurrentlyRunning();

/**
* @return true if task is repeating, false otherwise
*/
boolean isRepeatingTask();
}

0 comments on commit 6f64e21

Please sign in to comment.