Skip to content

Commit

Permalink
Add folia support to spigot side
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgeiss0702 committed Nov 3, 2023
1 parent e67b790 commit e811d07
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
implementation("net.kyori:adventure-text-serializer-plain:4.13.1")
compileOnly("com.google.guava:guava:30.1.1-jre")

compileOnly("us.ajg0702:ajUtils:1.2.14")
compileOnly("us.ajg0702:ajUtils:1.2.25")
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
compileOnly("net.kyori:adventure-text-serializer-plain:4.13.1")

compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.2.14")
compileOnly("us.ajg0702:ajUtils:1.2.25")

compileOnly("org.slf4j:slf4j-log4j12:1.7.29")

Expand Down
2 changes: 1 addition & 1 deletion free/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("org.spongepowered:configurate-yaml:4.0.0")

implementation("us.ajg0702:ajUtils:1.2.14")
implementation("us.ajg0702:ajUtils:1.2.25")

implementation(project(":platforms:velocity"))
implementation(project(":platforms:bungeecord"))
Expand Down
2 changes: 1 addition & 1 deletion platforms/bungeecord/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
dependencies {
compileOnly("net.kyori:adventure-api:4.13.1")
compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.2.14")
compileOnly("us.ajg0702:ajUtils:1.2.25")

compileOnly("net.md-5:bungeecord-api:1.16-R0.4")

Expand Down
2 changes: 1 addition & 1 deletion platforms/velocity/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
dependencies {
compileOnly("net.kyori:adventure-api:4.13.1")
compileOnly("com.google.guava:guava:30.1.1-jre")
compileOnly("us.ajg0702:ajUtils:1.2.14")
compileOnly("us.ajg0702:ajUtils:1.2.25")

compileOnly("com.velocitypowered:velocity-api:3.1.1")
annotationProcessor("com.velocitypowered:velocity-api:3.1.1")
Expand Down
2 changes: 1 addition & 1 deletion premium/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {

compileOnly("me.TechsCode:FakeUltraPerms:1.0.2")

compileOnly("us.ajg0702:ajUtils:1.2.14")
compileOnly("us.ajg0702:ajUtils:1.2.25")

compileOnly("net.kyori:adventure-api:4.13.1")

Expand Down
2 changes: 1 addition & 1 deletion spigot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {

compileOnly("org.spongepowered:configurate-yaml:4.1.2")

compileOnly("us.ajg0702:ajUtils:1.2.14")
compileOnly("us.ajg0702:ajUtils:1.2.25")

compileOnly(group = "org.spigotmc", name = "spigot", version = "1.16.5-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.10.4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public String onPlaceholderRequest(Player player, final String identifier){
}
}

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
HashMap<String, String> playerCache;
if(responseCache.containsKey(player)) {
playerCache = responseCache.get(player);
Expand All @@ -147,7 +147,7 @@ public String onPlaceholderRequest(Player player, final String identifier){
try {
playerCache.remove(playerCache.keySet().toArray()[0]);
} catch(ConcurrentModificationException e) {
Bukkit.getScheduler().runTask(plugin, () -> playerCache.remove(playerCache.keySet().toArray()[0]));
plugin.getScheduler().runTaskAsynchronously(() -> playerCache.remove(playerCache.keySet().toArray()[0]));
}
}
String resp = parsePlaceholder(player, identifier);
Expand Down
10 changes: 8 additions & 2 deletions spigot/src/main/java/us/ajg0702/queue/spigot/SpigotMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import us.ajg0702.queue.spigot.communication.ResponseManager;
import us.ajg0702.queue.spigot.placeholders.PlaceholderExpansion;
import us.ajg0702.utils.common.ConfigFile;
import us.ajg0702.utils.foliacompat.CompatScheduler;

import java.io.File;
import java.util.HashMap;
Expand All @@ -34,6 +35,8 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List
private PlaceholderExpansion placeholders;

private ResponseManager responseManager = new ResponseManager();

private final CompatScheduler compatScheduler = new CompatScheduler(this);

private ConfigFile config;

Expand All @@ -60,7 +63,7 @@ public void onEnable() {
getLogger().info("Registered PlaceholderAPI placeholders");
}

Bukkit.getScheduler().runTaskTimer(this, () -> {
getScheduler().runTaskTimerAsynchronously(() -> {
if(Bukkit.getOnlinePlayers().size() <= 0 || queuebatch.size() <= 0) return;
StringBuilder msg = new StringBuilder();
for(Player p : queuebatch.keySet()) {
Expand Down Expand Up @@ -153,7 +156,7 @@ public void onLeave(PlayerQuitEvent e) {
@EventHandler
public void onJoin(PlayerJoinEvent e) {
if(hasProxy) return;
Bukkit.getScheduler().runTaskLater(this, () -> sendMessage(e.getPlayer(), "ack", ""), 5);
getScheduler().runTaskLaterAsynchronously(() -> sendMessage(e.getPlayer(), "ack", ""), 5);
}

@EventHandler(priority = EventPriority.HIGH)
Expand All @@ -175,6 +178,9 @@ public void onServerPing(ServerListPingEvent e) {
e.setMotd("ajQueue;whitelisted="+whitelist);
}

public CompatScheduler getScheduler() {
return compatScheduler;
}

public ConfigFile getAConfig() {
return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public String getRegex() {

@Override
public String parse(Matcher matcher, OfflinePlayer p) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
MessagedResponse<String> response = AjQueueSpigotAPI.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public String getRegex() {

@Override
public String parse(Matcher matcher, OfflinePlayer p) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
Boolean response = AjQueueSpigotAPI.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public String getRegex() {

@Override
public String parse(Matcher matcher, OfflinePlayer p) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
MessagedResponse<Integer> response = AjQueueSpigotAPI.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public String getRegex() {

@Override
public String parse(Matcher matcher, OfflinePlayer p) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
MessagedResponse<Integer> response = AjQueueSpigotAPI.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public String getRegex() {

@Override
public String parse(Matcher matcher, OfflinePlayer p) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
MessagedResponse<String> response = AjQueueSpigotAPI.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public String parse(Matcher matcher, OfflinePlayer p) {
String queue = matcher.group(1);
String cached = cache.getOrDefault(queue, "...");

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
Integer response = AjQueueSpigotAPI.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public String parse(Matcher matcher, OfflinePlayer p) {
String queue = matcher.group(1);
String cached = cache.getOrDefault(queue, "...");

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
String response = AjQueueSpigotAPI.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public String parse(Matcher matcher, OfflinePlayer p) {

if(!p.isOnline()) return "You aren't online!";

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getScheduler().runTaskAsynchronously(() -> {
if(!p.isOnline()) return;
try {
String response = AjQueueSpigotAPI.getInstance()
Expand Down
1 change: 1 addition & 0 deletions spigot/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: "@VERSION@"
api-version: 1.13
author: ajgeiss0702
name: ajQueue
folia-supported: true
softdepend: [PlaceholderAPI]
commands:
queue:
Expand Down

0 comments on commit e811d07

Please sign in to comment.