mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-10-31 19:44:03 +01:00
Compare commits
6 Commits
9448fbfaa0
...
468837f0ed
Author | SHA1 | Date | |
---|---|---|---|
|
468837f0ed | ||
|
3f4caf7d00 | ||
|
fe3691eaf6 | ||
|
c6aed73f88 | ||
|
2b53e3913f | ||
|
8e2165bb8a |
@ -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://jitpack.io" )
|
||||||
}
|
}
|
||||||
|
|
||||||
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.github.Anon8281:UniversalScheduler:0.1.6")
|
||||||
|
|
||||||
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.github.Anon8281.universalScheduler", "me.clip.placeholderapi.libs.universalScheduler")
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
@ -23,6 +23,9 @@ package me.clip.placeholderapi;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.github.Anon8281.universalScheduler.UniversalScheduler;
|
||||||
|
import com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskScheduler;
|
||||||
import me.clip.placeholderapi.commands.PlaceholderCommandRouter;
|
import me.clip.placeholderapi.commands.PlaceholderCommandRouter;
|
||||||
import me.clip.placeholderapi.configuration.PlaceholderAPIConfig;
|
import me.clip.placeholderapi.configuration.PlaceholderAPIConfig;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
@ -52,6 +55,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final Version VERSION;
|
private static final Version VERSION;
|
||||||
|
private static TaskScheduler scheduler;
|
||||||
private static PlaceholderAPIPlugin instance;
|
private static PlaceholderAPIPlugin instance;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -140,6 +144,8 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
scheduler = UniversalScheduler.getScheduler(this);
|
||||||
|
|
||||||
setupCommand();
|
setupCommand();
|
||||||
setupMetrics();
|
setupMetrics();
|
||||||
setupExpansions();
|
setupExpansions();
|
||||||
@ -162,7 +168,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
PlaceholderAPIPlugin.getScheduler().cancelTasks(this);
|
||||||
|
|
||||||
adventure.close();
|
adventure.close();
|
||||||
adventure = null;
|
adventure = null;
|
||||||
@ -213,6 +219,10 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TaskScheduler getScheduler() {
|
||||||
|
return scheduler;
|
||||||
|
}
|
||||||
|
|
||||||
private void setupCommand() {
|
private void setupCommand() {
|
||||||
final PluginCommand pluginCommand = getCommand("placeholderapi");
|
final PluginCommand pluginCommand = getCommand("placeholderapi");
|
||||||
if (pluginCommand == null) {
|
if (pluginCommand == null) {
|
||||||
@ -250,8 +260,8 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
Class.forName("org.bukkit.event.server.ServerLoadEvent");
|
Class.forName("org.bukkit.event.server.ServerLoadEvent");
|
||||||
new ServerLoadEventListener(this);
|
new ServerLoadEventListener(this);
|
||||||
} catch (final ClassNotFoundException ignored) {
|
} catch (final ClassNotFoundException ignored) {
|
||||||
Bukkit.getScheduler()
|
PlaceholderAPIPlugin.getScheduler()
|
||||||
.runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
|
.runTaskLater(() -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,11 +201,9 @@ public final class CloudExpansionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// loop through what's left on the main thread
|
// loop through what's left on the main thread
|
||||||
plugin
|
PlaceholderAPIPlugin
|
||||||
.getServer()
|
|
||||||
.getScheduler()
|
.getScheduler()
|
||||||
.runTask(
|
.runTask(
|
||||||
plugin,
|
|
||||||
() -> {
|
() -> {
|
||||||
try {
|
try {
|
||||||
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
||||||
|
@ -55,7 +55,7 @@ public class UpdateChecker implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void fetch() {
|
public void fetch() {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
PlaceholderAPIPlugin.getScheduler().runTaskAsynchronously(() -> {
|
||||||
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.getScheduler().runTask(() -> {
|
||||||
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,6 +27,8 @@ 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 me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -43,7 +45,7 @@ public final class Futures {
|
|||||||
if (Bukkit.isPrimaryThread()) {
|
if (Bukkit.isPrimaryThread()) {
|
||||||
consumer.accept(value, exception);
|
consumer.accept(value, exception);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(value, exception));
|
PlaceholderAPIPlugin.getScheduler().runTask(() -> consumer.accept(value, exception));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ author: HelpChat
|
|||||||
|
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
description: "An awesome placeholder provider!"
|
description: "An awesome placeholder provider!"
|
||||||
|
folia-supported: true
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
placeholderapi:
|
placeholderapi:
|
||||||
|
Loading…
Reference in New Issue
Block a user