Compare commits

...

10 Commits

Author SHA1 Message Date
Sevastjan
9448fbfaa0
Merge 3f4caf7d0014b89f27da0e1bf7c469e066b658f2 into 882b7c59651ed8f3bb64b179691f49eb330b99a1 2024-03-07 14:09:31 -07:00
Gabriel Dumitru
882b7c5965
Merge pull request #1046 from PlaceholderAPI/feature/add-plugin-authors
Add Plugin Authors to /papi dump
2024-03-07 22:59:42 +02:00
Gabriel Dumitru
7a0be5edf8
Merge pull request #1040 from DevCyntrix/fix-class-cast-exception
Use the OfflinePlayer$getPlayer method instead of casting to Player class
2024-03-07 22:59:24 +02:00
Andre601
e94328935d
Add Plugin Authors to /papi dump 2024-02-25 14:42:48 +01:00
Ricardo Borutta
403622d205 Use the OfflinePlayer$getPlayer method instead of casting to Player class
You should use this to avoid a class cast exception if some other plugins uses an own Implementation of the offline player.
2024-01-29 10:21:24 +01:00
Sevastjan
3f4caf7d00
Merge branch 'PlaceholderAPI:master' into master 2024-01-28 22:12:26 +03:00
Sevastjan
fe3691eaf6
Merge branch 'PlaceholderAPI:master' into master 2024-01-25 07:49:39 +03:00
Sevastjan
c6aed73f88 Added repository and update scheduling lib 2024-01-21 20:40:00 +03:00
Sevastjan
2b53e3913f Ecloud fix 2023-12-31 06:11:53 -05:00
anon8281
8e2165bb8a Folia support 2023-12-31 06:11:53 -05:00
8 changed files with 27 additions and 11 deletions

@ -20,11 +20,13 @@ repositories {
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven ("https://jitpack.io" )
}
dependencies {
implementation("org.bstats:bstats-bukkit:3.0.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")
compileOnlyApi("org.jetbrains:annotations:23.0.0")
@ -88,6 +90,7 @@ tasks {
relocate("org.bstats", "me.clip.placeholderapi.metrics")
relocate("net.kyori", "me.clip.placeholderapi.libs.kyori")
relocate("com.github.Anon8281.universalScheduler", "me.clip.placeholderapi.libs.universalScheduler")
}
test {

@ -23,6 +23,9 @@ package me.clip.placeholderapi;
import java.text.SimpleDateFormat;
import java.util.HashMap;
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.configuration.PlaceholderAPIConfig;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
@ -52,6 +55,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
@NotNull
private static final Version VERSION;
private static TaskScheduler scheduler;
private static PlaceholderAPIPlugin instance;
static {
@ -140,6 +144,8 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
@Override
public void onEnable() {
scheduler = UniversalScheduler.getScheduler(this);
setupCommand();
setupMetrics();
setupExpansions();
@ -162,7 +168,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
HandlerList.unregisterAll(this);
Bukkit.getScheduler().cancelTasks(this);
PlaceholderAPIPlugin.getScheduler().cancelTasks(this);
adventure.close();
adventure = null;
@ -213,6 +219,10 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
return config;
}
public static TaskScheduler getScheduler() {
return scheduler;
}
private void setupCommand() {
final PluginCommand pluginCommand = getCommand("placeholderapi");
if (pluginCommand == null) {
@ -250,8 +260,8 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
Class.forName("org.bukkit.event.server.ServerLoadEvent");
new ServerLoadEventListener(this);
} catch (final ClassNotFoundException ignored) {
Bukkit.getScheduler()
.runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
PlaceholderAPIPlugin.getScheduler()
.runTaskLater(() -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
}
}

@ -29,7 +29,7 @@ public abstract class PlaceholderHook {
@Nullable
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
if (player != null && player.isOnline()) {
return onPlaceholderRequest((Player) player, params);
return onPlaceholderRequest(player.getPlayer(), params);
}
return onPlaceholderRequest(null, params);

@ -200,7 +200,9 @@ public final class CommandDump extends PlaceholderCommand {
for (final Plugin other : plugins) {
builder.append(" ")
.append(String.format("%-" + size + "s", other.getName()))
.append(" [Version: ")
.append(" [Authors: [")
.append(String.join(", ", other.getDescription().getAuthors()))
.append("], Version: ")
.append(other.getDescription().getVersion())
.append("]")
.append("\n");

@ -201,11 +201,9 @@ public final class CloudExpansionManager {
}
// loop through what's left on the main thread
plugin
.getServer()
PlaceholderAPIPlugin
.getScheduler()
.runTask(
plugin,
() -> {
try {
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {

@ -55,7 +55,7 @@ public class UpdateChecker implements Listener {
}
public void fetch() {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
PlaceholderAPIPlugin.getScheduler().runTaskAsynchronously(() -> {
try {
HttpsURLConnection con = (HttpsURLConnection) new URL(
"https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openConnection();
@ -76,7 +76,7 @@ public class UpdateChecker implements Listener {
return;
}
Bukkit.getScheduler().runTask(plugin, () -> {
PlaceholderAPIPlugin.getScheduler().runTask(() -> {
plugin.getLogger()
.info("An update for PlaceholderAPI (v" + getSpigotVersion() + ") is available at:");
plugin.getLogger()

@ -27,6 +27,8 @@ import java.util.function.BiConsumer;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@ -43,7 +45,7 @@ public final class Futures {
if (Bukkit.isPrimaryThread()) {
consumer.accept(value, exception);
} 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"
description: "An awesome placeholder provider!"
folia-supported: true
commands:
placeholderapi: