Compare commits
4 Commits
dd2763dce1
...
0ddb913ad9
Author | SHA1 | Date |
---|---|---|
Yomamaeatstoes | 0ddb913ad9 | |
Yomamaeatstoes | 94a9d84ba0 | |
Yomamaeatstoes | ca46a20671 | |
HSGamer | f8c9ee2fc3 |
|
@ -20,11 +20,13 @@ repositories {
|
||||||
|
|
||||||
maven("https://repo.codemc.org/repository/maven-public/")
|
maven("https://repo.codemc.org/repository/maven-public/")
|
||||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||||
|
maven("https://nexuslite.gcnt.net/repos/other/")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.bstats:bstats-bukkit:3.0.1")
|
implementation("org.bstats:bstats-bukkit:3.0.1")
|
||||||
implementation("net.kyori:adventure-platform-bukkit:4.3.1")
|
implementation("net.kyori:adventure-platform-bukkit:4.3.1")
|
||||||
|
implementation("com.tcoded:FoliaLib:0.3.1")
|
||||||
|
|
||||||
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
|
||||||
compileOnlyApi("org.jetbrains:annotations:23.0.0")
|
compileOnlyApi("org.jetbrains:annotations:23.0.0")
|
||||||
|
@ -88,6 +90,7 @@ tasks {
|
||||||
|
|
||||||
relocate("org.bstats", "me.clip.placeholderapi.metrics")
|
relocate("org.bstats", "me.clip.placeholderapi.metrics")
|
||||||
relocate("net.kyori", "me.clip.placeholderapi.libs.kyori")
|
relocate("net.kyori", "me.clip.placeholderapi.libs.kyori")
|
||||||
|
relocate("com.tcoded", "me.clip.placeholderapi.libs.tcoded")
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
package me.clip.placeholderapi;
|
package me.clip.placeholderapi;
|
||||||
|
|
||||||
|
import com.tcoded.folialib.FoliaLib;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -53,6 +54,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final Version VERSION;
|
private static final Version VERSION;
|
||||||
private static PlaceholderAPIPlugin instance;
|
private static PlaceholderAPIPlugin instance;
|
||||||
|
private static FoliaLib foliaLib;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
final String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
final String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||||
|
@ -90,6 +92,15 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the static instance of the FoliaLib class
|
||||||
|
*
|
||||||
|
* @return FoliaLib instance
|
||||||
|
*/
|
||||||
|
public static FoliaLib getFoliaLib() {
|
||||||
|
return foliaLib;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the configurable {@linkplain String} value that should be returned when a boolean is true
|
* Get the configurable {@linkplain String} value that should be returned when a boolean is true
|
||||||
*
|
*
|
||||||
|
@ -134,6 +145,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
foliaLib = new FoliaLib(this);
|
||||||
|
|
||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
}
|
}
|
||||||
|
@ -162,7 +174,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
||||||
|
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
foliaLib.getImpl().cancelAllTasks();
|
||||||
|
|
||||||
adventure.close();
|
adventure.close();
|
||||||
adventure = null;
|
adventure = null;
|
||||||
|
|
|
@ -200,13 +200,7 @@ public final class CloudExpansionManager {
|
||||||
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
|
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop through what's left on the main thread
|
//todo: Figure out why this was being scheduled back on the main thread
|
||||||
plugin
|
|
||||||
.getServer()
|
|
||||||
.getScheduler()
|
|
||||||
.runTask(
|
|
||||||
plugin,
|
|
||||||
() -> {
|
|
||||||
try {
|
try {
|
||||||
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
||||||
String name = entry.getKey();
|
String name = entry.getKey();
|
||||||
|
@ -234,7 +228,6 @@ public final class CloudExpansionManager {
|
||||||
.log(Level.WARNING, "Failed to download expansion information", e);
|
.log(Level.WARNING, "Failed to download expansion information", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDownloading(@NotNull final CloudExpansion expansion) {
|
public boolean isDownloading(@NotNull final CloudExpansion expansion) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class UpdateChecker implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fetch() {
|
public void fetch() {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
PlaceholderAPIPlugin.getFoliaLib().getImpl().runAsync(t -> {
|
||||||
try {
|
try {
|
||||||
HttpsURLConnection con = (HttpsURLConnection) new URL(
|
HttpsURLConnection con = (HttpsURLConnection) new URL(
|
||||||
"https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openConnection();
|
"https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openConnection();
|
||||||
|
@ -76,7 +76,7 @@ public class UpdateChecker implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
PlaceholderAPIPlugin.getFoliaLib().getImpl().runNextTick(t1 -> {
|
||||||
plugin.getLogger()
|
plugin.getLogger()
|
||||||
.info("An update for PlaceholderAPI (v" + getSpigotVersion() + ") is available at:");
|
.info("An update for PlaceholderAPI (v" + getSpigotVersion() + ") is available at:");
|
||||||
plugin.getLogger()
|
plugin.getLogger()
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.function.BiConsumer;
|
||||||
import java.util.stream.Collector;
|
import java.util.stream.Collector;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.bukkit.Bukkit;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -40,11 +40,7 @@ public final class Futures {
|
||||||
@NotNull final CompletableFuture<T> future,
|
@NotNull final CompletableFuture<T> future,
|
||||||
@NotNull final BiConsumer<T, Throwable> consumer) {
|
@NotNull final BiConsumer<T, Throwable> consumer) {
|
||||||
future.whenComplete((value, exception) -> {
|
future.whenComplete((value, exception) -> {
|
||||||
if (Bukkit.isPrimaryThread()) {
|
PlaceholderAPIPlugin.getFoliaLib().getImpl().runNextTick(t -> consumer.accept(value, exception));
|
||||||
consumer.accept(value, exception);
|
|
||||||
} else {
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(value, exception));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ main: "me.clip.placeholderapi.PlaceholderAPIPlugin"
|
||||||
version: ${version}
|
version: ${version}
|
||||||
author: HelpChat
|
author: HelpChat
|
||||||
|
|
||||||
|
folia-supported: true
|
||||||
|
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
description: "An awesome placeholder provider!"
|
description: "An awesome placeholder provider!"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue