forked from ploppyperson/StackMob-5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2334926
commit 4c97f97
Showing
18 changed files
with
411 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,113 @@ | ||
# Project exclude paths | ||
/target/ | ||
# User-specific stuff | ||
.idea/ | ||
|
||
*.iml | ||
*.ipr | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
target/ | ||
|
||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
|
||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
.mvn/wrapper/maven-wrapper.jar | ||
.flattened-pom.xml | ||
|
||
# Common working directory | ||
run/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/uk/antiperson/stackmob/scheduler/BukkitScheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package uk.antiperson.stackmob.scheduler; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
public class BukkitScheduler implements Scheduler { | ||
|
||
@Override | ||
public void runGlobalTaskTimer(Plugin plugin, Runnable runnable, long delay, long period) { | ||
plugin.getServer().getScheduler().runTaskTimer(plugin, runnable, delay, period); | ||
} | ||
|
||
@Override | ||
public void runTask(Plugin plugin, Location location, Runnable runnable) { | ||
plugin.getServer().getScheduler().runTask(plugin, runnable); | ||
} | ||
|
||
@Override | ||
public void runTask(Plugin plugin, Entity entity, Runnable runnable) { | ||
plugin.getServer().getScheduler().runTask(plugin, runnable); | ||
} | ||
|
||
@Override | ||
public void runTaskAsynchronously(Plugin plugin, Runnable runnable) { | ||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, runnable); | ||
} | ||
|
||
@Override | ||
public void runTaskLater(Plugin plugin, Entity entity, Runnable runnable, long delay) { | ||
plugin.getServer().getScheduler().runTaskLater(plugin, runnable, delay); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/uk/antiperson/stackmob/scheduler/FoliaScheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package uk.antiperson.stackmob.scheduler; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
public class FoliaScheduler implements Scheduler { | ||
|
||
@Override | ||
public void runGlobalTaskTimer(Plugin plugin, Runnable runnable, long delay, long period) { | ||
plugin.getServer().getGlobalRegionScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), (int) delay, (int) period); | ||
} | ||
|
||
@Override | ||
public void runTask(Plugin plugin, Location location, Runnable runnable) { | ||
plugin.getServer().getRegionScheduler().run(plugin, location, scheduledTask -> runnable.run()); | ||
} | ||
|
||
@Override | ||
public void runTask(Plugin plugin, Entity entity, Runnable runnable) { | ||
entity.getScheduler().run(plugin, scheduledTask -> runnable.run(), () -> { | ||
}); | ||
} | ||
|
||
@Override | ||
public void runTaskAsynchronously(Plugin plugin, Runnable runnable) { | ||
plugin.getServer().getAsyncScheduler().runNow(plugin, scheduledTask -> runnable.run()); | ||
} | ||
|
||
@Override | ||
public void runTaskLater(Plugin plugin, Entity entity, Runnable runnable, long delay) { | ||
entity.getScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), () -> { | ||
}, (int) delay); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/uk/antiperson/stackmob/scheduler/Scheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package uk.antiperson.stackmob.scheduler; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
public interface Scheduler { | ||
|
||
void runGlobalTaskTimer(Plugin plugin, Runnable runnable, long delay, long period); | ||
|
||
void runTask(Plugin plugin, Location location, Runnable runnable); | ||
|
||
void runTask(Plugin plugin, Entity entity, Runnable runnable); | ||
|
||
void runTaskAsynchronously(Plugin plugin, Runnable runnable); | ||
|
||
void runTaskLater(Plugin plugin, Entity entity, Runnable runnable, long delay); | ||
|
||
} |
Oops, something went wrong.