Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
Change void to SchedulerTaskInter
Browse files Browse the repository at this point in the history
  • Loading branch information
Euphillya committed Mar 12, 2024
1 parent 5659f25 commit 295851a
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 116 deletions.
6 changes: 4 additions & 2 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "fr.euphyllia"
version = "1.1.3"
version = "1.1.4"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ExecutorsScheduler(Plugin pluginBukkit) {
}

@Override
public void runAtFixedRate(@NotNull SchedulerType schedulerType, SchedulerCallBack callBack, long initialDelayTicks, long periodTicks) {
public @Nullable SchedulerTaskInter runAtFixedRate(@NotNull SchedulerType schedulerType, SchedulerCallBack callBack, long initialDelayTicks, long periodTicks) {
if (!schedulerType.equals(SchedulerType.ASYNC)) {
throw new UnsupportedOperationException();
}
Expand All @@ -36,25 +36,26 @@ public void runAtFixedRate(@NotNull SchedulerType schedulerType, SchedulerCallBa
mapSchedulerTask.put(executorsScheduler.getTaskId(), executorsScheduler);
callBack.run(executorsScheduler);
}, initialDelayTicks * 50, periodTicks * 50, TimeUnit.MILLISECONDS);
return new ExecutorsSchedulerTask(plugin, executorService);
}

@Override
public void runAtFixedRate(@NotNull SchedulerType schedulerType, MultipleRecords.WorldChunk worldChunk, SchedulerCallBack callBack, long initialDelayTicks, long periodTicks) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runAtFixedRate(@NotNull SchedulerType schedulerType, MultipleRecords.WorldChunk worldChunk, SchedulerCallBack callBack, long initialDelayTicks, long periodTicks) {
return this.runAtFixedRate(schedulerType, callBack, initialDelayTicks, periodTicks);
}

@Override
public void runAtFixedRate(@NotNull SchedulerType schedulerType, Location location, SchedulerCallBack callBack, long initialDelayTicks, long periodTicks) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runAtFixedRate(@NotNull SchedulerType schedulerType, Location location, SchedulerCallBack callBack, long initialDelayTicks, long periodTicks) {
return this.runAtFixedRate(schedulerType, callBack, initialDelayTicks, periodTicks);
}

@Override
public void runAtFixedRate(@NotNull SchedulerType schedulerType, Entity entity, SchedulerCallBack callBack, @Nullable Runnable retired, long initialDelayTicks, long periodTicks) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runAtFixedRate(@NotNull SchedulerType schedulerType, Entity entity, SchedulerCallBack callBack, @Nullable Runnable retired, long initialDelayTicks, long periodTicks) {
return this.runAtFixedRate(schedulerType, callBack, initialDelayTicks, periodTicks);
}

@Override
public void runDelayed(@NotNull SchedulerType schedulerType, SchedulerCallBack callBack, long delayTicks) {
public @Nullable SchedulerTaskInter runDelayed(@NotNull SchedulerType schedulerType, SchedulerCallBack callBack, long delayTicks) {
if (!schedulerType.equals(SchedulerType.ASYNC)) {
throw new UnsupportedOperationException();
}
Expand All @@ -64,25 +65,26 @@ public void runDelayed(@NotNull SchedulerType schedulerType, SchedulerCallBack c
mapSchedulerTask.put(executorsScheduler.getTaskId(), executorsScheduler);
callBack.run(executorsScheduler);
}, delayTicks * 50, TimeUnit.MILLISECONDS);
return new ExecutorsSchedulerTask(plugin, executorService);
}

@Override
public void runDelayed(@NotNull SchedulerType schedulerType, MultipleRecords.WorldChunk worldChunk, SchedulerCallBack callBack, long delayTicks) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runDelayed(@NotNull SchedulerType schedulerType, MultipleRecords.WorldChunk worldChunk, SchedulerCallBack callBack, long delayTicks) {
return this.runDelayed(schedulerType, callBack, delayTicks);
}

@Override
public void runDelayed(@NotNull SchedulerType schedulerType, Location location, SchedulerCallBack callBack, long delayTicks) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runDelayed(@NotNull SchedulerType schedulerType, Location location, SchedulerCallBack callBack, long delayTicks) {
return this.runDelayed(schedulerType, callBack, delayTicks);
}

@Override
public void runDelayed(@NotNull SchedulerType schedulerType, Entity entity, SchedulerCallBack callBack, @Nullable Runnable retired, long delayTicks) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runDelayed(@NotNull SchedulerType schedulerType, Entity entity, SchedulerCallBack callBack, @Nullable Runnable retired, long delayTicks) {
return this.runDelayed(schedulerType, callBack, delayTicks);
}

@Override
public void runTask(@NotNull SchedulerType schedulerType, SchedulerCallBack callBack) {
public @Nullable SchedulerTaskInter runTask(@NotNull SchedulerType schedulerType, SchedulerCallBack callBack) {
if (!schedulerType.equals(SchedulerType.ASYNC)) {
throw new UnsupportedOperationException();
}
Expand All @@ -92,21 +94,22 @@ public void runTask(@NotNull SchedulerType schedulerType, SchedulerCallBack call
mapSchedulerTask.put(executorsScheduler.getTaskId(), executorsScheduler);
callBack.run(executorsScheduler);
});
return new ExecutorsSchedulerTask(plugin, executorService);
}

@Override
public void runTask(@NotNull SchedulerType schedulerType, MultipleRecords.WorldChunk worldChunk, SchedulerCallBack callBack) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runTask(@NotNull SchedulerType schedulerType, MultipleRecords.WorldChunk worldChunk, SchedulerCallBack callBack) {
return this.runTask(schedulerType, callBack);
}

@Override
public void runTask(@NotNull SchedulerType schedulerType, Location location, SchedulerCallBack callBack) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runTask(@NotNull SchedulerType schedulerType, Location location, SchedulerCallBack callBack) {
return this.runTask(schedulerType, callBack);
}

@Override
public void runTask(@NotNull SchedulerType schedulerType, Entity entity, SchedulerCallBack callBack, @Nullable Runnable retired) {
throw new UnsupportedOperationException();
public @Nullable SchedulerTaskInter runTask(@NotNull SchedulerType schedulerType, Entity entity, SchedulerCallBack callBack, @Nullable Runnable retired) {
return this.runTask(schedulerType, callBack);
}

@Override
Expand Down
Loading

0 comments on commit 295851a

Please # to comment.