mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-06 05:17:05 +02:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9377129554 | ||
|
f4409a6d92 | ||
|
c902485718 | ||
|
09db82a840 | ||
|
9b667fe383 | ||
|
00333f9a4e | ||
|
5472be631c | ||
|
68fa793354 | ||
|
111f5462fc | ||
|
62e282cc0e | ||
|
5aaa9720c8 | ||
|
9a2fb89e43 |
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
|
||||
<version>2.10.1</version>
|
||||
<version>2.10.2</version>
|
||||
<name>PlaceholderAPI</name>
|
||||
<description>An awesome placeholder provider!</description>
|
||||
<url>http://extendedclip.com</url>
|
||||
|
@@ -137,18 +137,15 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
|
||||
Class.forName("org.bukkit.event.server.ServerLoadEvent");
|
||||
new ServerLoadEventListener(this);
|
||||
} catch (ExceptionInInitializerError | ClassNotFoundException exception) {
|
||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getLogger().info("Placeholder expansion registration initializing...");
|
||||
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost
|
||||
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
|
||||
getExpansionManager().registerAllExpansions();
|
||||
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
|
||||
alreadyRegistered.entrySet().stream().forEach(hook -> PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue()));
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLater(this, () -> {
|
||||
getLogger().info("Placeholder expansion registration initializing...");
|
||||
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost
|
||||
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
|
||||
getExpansionManager().registerAllExpansions();
|
||||
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
|
||||
alreadyRegistered.forEach(PlaceholderAPI::registerPlaceholderHook);
|
||||
}
|
||||
}, 20*15);
|
||||
}, 1);
|
||||
}
|
||||
if (config.checkUpdates()) {
|
||||
new UpdateChecker(this).fetch();
|
||||
@@ -157,7 +154,7 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
|
||||
enableCloud();
|
||||
}
|
||||
setupMetrics();
|
||||
getServer().getScheduler().runTaskLater(this, this::checkHook, 20 * 30);
|
||||
getServer().getScheduler().runTaskLater(this, this::checkHook, 40);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,8 +193,10 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
|
||||
} catch (Exception ex) {
|
||||
author = "the author of the hook's plugin";
|
||||
}
|
||||
getLogger().warning(((EZPlaceholderHook) h).getPluginName() + " is currently using a deprecated method to hook into PlaceholderAPI. This will be disabled after the next update. " +
|
||||
getLogger().severe(((EZPlaceholderHook) h).getPluginName() + " is currently using a deprecated method to hook into PlaceholderAPI. Placeholders for that plugin no longer work. " +
|
||||
"Please consult {author} and urge them to update it ASAP.".replace("{author}", author));
|
||||
// disable the hook on startup
|
||||
PlaceholderAPI.unregisterPlaceholderHook(((EZPlaceholderHook) h).getPlaceholderName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package me.clip.placeholderapi;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -8,22 +9,29 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||
|
||||
public class ServerLoadEventListener implements Listener {
|
||||
|
||||
private PlaceholderAPIPlugin plugin;
|
||||
private PlaceholderAPIPlugin plugin;
|
||||
|
||||
public ServerLoadEventListener(PlaceholderAPIPlugin instance) {
|
||||
plugin = instance;
|
||||
Bukkit.getPluginManager().registerEvents(this, instance);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerLoad(ServerLoadEvent e) {
|
||||
plugin.getLogger().info("Placeholder expansion registration initializing...");
|
||||
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
|
||||
plugin.getExpansionManager().registerAllExpansions();
|
||||
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
|
||||
alreadyRegistered.entrySet().stream().forEach(hook -> {
|
||||
PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue());
|
||||
});
|
||||
public ServerLoadEventListener(PlaceholderAPIPlugin instance) {
|
||||
plugin = instance;
|
||||
Bukkit.getPluginManager().registerEvents(this, instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be called when the server is first loaded
|
||||
*
|
||||
* The goal of the method is to register all the expansions as soon as possible
|
||||
* especially before players can join
|
||||
*
|
||||
* This will ensure no issues with expanions and hooks.
|
||||
* @param e the server load event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onServerLoad(ServerLoadEvent e) {
|
||||
plugin.getLogger().info("Placeholder expansion registration initializing...");
|
||||
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
|
||||
plugin.getExpansionManager().registerAllExpansions();
|
||||
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
|
||||
alreadyRegistered.forEach(PlaceholderAPI::registerPlaceholderHook);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,13 +20,6 @@
|
||||
*/
|
||||
package me.clip.placeholderapi.commands;
|
||||
|
||||
import static me.clip.placeholderapi.util.Msg.color;
|
||||
import static me.clip.placeholderapi.util.Msg.msg;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
@@ -37,6 +30,14 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static me.clip.placeholderapi.util.Msg.color;
|
||||
import static me.clip.placeholderapi.util.Msg.msg;
|
||||
|
||||
public class ExpansionCloudCommands implements CommandExecutor {
|
||||
|
||||
private PlaceholderAPIPlugin plugin;
|
||||
@@ -327,7 +328,7 @@ public class ExpansionCloudCommands implements CommandExecutor {
|
||||
expansions.put(exp.getName(), exp);
|
||||
}
|
||||
List<String> ce = expansions.keySet().stream().sorted().collect(Collectors.toList());
|
||||
int i = 1;
|
||||
int i = (int) ex.keySet().toArray()[0]+1;
|
||||
for (String name : ce) {
|
||||
if (expansions.get(name) == null) {
|
||||
continue;
|
||||
|
@@ -49,7 +49,7 @@ public class PlaceholderAPICommands implements CommandExecutor {
|
||||
if (args.length == 0) {
|
||||
|
||||
Msg.msg(s, "PlaceholderAPI &7version &b&o" + plugin.getDescription().getVersion(),
|
||||
"&fCreated by&7: &bextended_clip",
|
||||
"&fCreated by&7: &b" + plugin.getDescription().getAuthors(),
|
||||
"&fPapi commands: &b/papi help",
|
||||
"&fEcloud commands: &b/papi ecloud");
|
||||
return true;
|
||||
|
@@ -27,9 +27,7 @@ public class TimeUtil {
|
||||
if (seconds < 60) {
|
||||
switch (type) {
|
||||
case DAYS:
|
||||
return "0";
|
||||
case HOURS:
|
||||
return "0";
|
||||
case MINUTES:
|
||||
return "0";
|
||||
case SECONDS:
|
||||
@@ -44,7 +42,6 @@ public class TimeUtil {
|
||||
if (minutes < 60) {
|
||||
switch (type) {
|
||||
case DAYS:
|
||||
return "0";
|
||||
case HOURS:
|
||||
return "0";
|
||||
case MINUTES:
|
||||
@@ -118,9 +115,9 @@ public class TimeUtil {
|
||||
int secondsLeft = seconds - s;
|
||||
if (minutes < 60) {
|
||||
if (secondsLeft > 0) {
|
||||
return String.valueOf(minutes + "m " + secondsLeft + "s");
|
||||
return minutes + "m " + secondsLeft + "s";
|
||||
} else {
|
||||
return String.valueOf(minutes + "m");
|
||||
return minutes + "m";
|
||||
}
|
||||
}
|
||||
if (minutes < 1440) {
|
||||
|
@@ -1,9 +1,8 @@
|
||||
name: ${project.name}
|
||||
main: me.clip.placeholderapi.PlaceholderAPIPlugin
|
||||
version: ${project.version}
|
||||
author: [extended_clip]
|
||||
authors: [extended_clip, Glare]
|
||||
description: ${project.description}
|
||||
api-version: 1.13
|
||||
permissions:
|
||||
placeholderapi.*:
|
||||
description: ability to use all commands
|
||||
@@ -39,4 +38,4 @@ permissions:
|
||||
commands:
|
||||
placeholderapi:
|
||||
description: PlaceholderAPI command
|
||||
aliases: [clipsplaceholderapi, papi]
|
||||
aliases: [papi]
|
||||
|
Reference in New Issue
Block a user