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>
|
<groupId>me.clip</groupId>
|
||||||
<artifactId>placeholderapi</artifactId>
|
<artifactId>placeholderapi</artifactId>
|
||||||
|
|
||||||
<version>2.10.1</version>
|
<version>2.10.2</version>
|
||||||
<name>PlaceholderAPI</name>
|
<name>PlaceholderAPI</name>
|
||||||
<description>An awesome placeholder provider!</description>
|
<description>An awesome placeholder provider!</description>
|
||||||
<url>http://extendedclip.com</url>
|
<url>http://extendedclip.com</url>
|
||||||
|
@@ -137,18 +137,15 @@ public 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 (ExceptionInInitializerError | ClassNotFoundException exception) {
|
} catch (ExceptionInInitializerError | ClassNotFoundException exception) {
|
||||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
Bukkit.getScheduler().runTaskLater(this, () -> {
|
||||||
@Override
|
getLogger().info("Placeholder expansion registration initializing...");
|
||||||
public void run() {
|
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost
|
||||||
getLogger().info("Placeholder expansion registration initializing...");
|
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
|
||||||
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost
|
getExpansionManager().registerAllExpansions();
|
||||||
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
|
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
|
||||||
getExpansionManager().registerAllExpansions();
|
alreadyRegistered.forEach(PlaceholderAPI::registerPlaceholderHook);
|
||||||
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
|
|
||||||
alreadyRegistered.entrySet().stream().forEach(hook -> PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 20*15);
|
}, 1);
|
||||||
}
|
}
|
||||||
if (config.checkUpdates()) {
|
if (config.checkUpdates()) {
|
||||||
new UpdateChecker(this).fetch();
|
new UpdateChecker(this).fetch();
|
||||||
@@ -157,7 +154,7 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
enableCloud();
|
enableCloud();
|
||||||
}
|
}
|
||||||
setupMetrics();
|
setupMetrics();
|
||||||
getServer().getScheduler().runTaskLater(this, this::checkHook, 20 * 30);
|
getServer().getScheduler().runTaskLater(this, this::checkHook, 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -196,8 +193,10 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
author = "the author of the hook's plugin";
|
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));
|
"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;
|
package me.clip.placeholderapi;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -8,22 +9,29 @@ import org.bukkit.event.server.ServerLoadEvent;
|
|||||||
|
|
||||||
public class ServerLoadEventListener implements Listener {
|
public class ServerLoadEventListener implements Listener {
|
||||||
|
|
||||||
private PlaceholderAPIPlugin plugin;
|
private PlaceholderAPIPlugin plugin;
|
||||||
|
|
||||||
public ServerLoadEventListener(PlaceholderAPIPlugin instance) {
|
public ServerLoadEventListener(PlaceholderAPIPlugin instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
Bukkit.getPluginManager().registerEvents(this, instance);
|
Bukkit.getPluginManager().registerEvents(this, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
/**
|
||||||
public void onServerLoad(ServerLoadEvent e) {
|
* This method will be called when the server is first loaded
|
||||||
plugin.getLogger().info("Placeholder expansion registration initializing...");
|
*
|
||||||
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
|
* The goal of the method is to register all the expansions as soon as possible
|
||||||
plugin.getExpansionManager().registerAllExpansions();
|
* especially before players can join
|
||||||
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
|
*
|
||||||
alreadyRegistered.entrySet().stream().forEach(hook -> {
|
* This will ensure no issues with expanions and hooks.
|
||||||
PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue());
|
* @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;
|
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.PlaceholderAPI;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
@@ -37,6 +30,14 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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 {
|
public class ExpansionCloudCommands implements CommandExecutor {
|
||||||
|
|
||||||
private PlaceholderAPIPlugin plugin;
|
private PlaceholderAPIPlugin plugin;
|
||||||
@@ -327,7 +328,7 @@ public class ExpansionCloudCommands implements CommandExecutor {
|
|||||||
expansions.put(exp.getName(), exp);
|
expansions.put(exp.getName(), exp);
|
||||||
}
|
}
|
||||||
List<String> ce = expansions.keySet().stream().sorted().collect(Collectors.toList());
|
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) {
|
for (String name : ce) {
|
||||||
if (expansions.get(name) == null) {
|
if (expansions.get(name) == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@@ -49,7 +49,7 @@ public class PlaceholderAPICommands implements CommandExecutor {
|
|||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
|
|
||||||
Msg.msg(s, "PlaceholderAPI &7version &b&o" + plugin.getDescription().getVersion(),
|
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",
|
"&fPapi commands: &b/papi help",
|
||||||
"&fEcloud commands: &b/papi ecloud");
|
"&fEcloud commands: &b/papi ecloud");
|
||||||
return true;
|
return true;
|
||||||
|
@@ -27,9 +27,7 @@ public class TimeUtil {
|
|||||||
if (seconds < 60) {
|
if (seconds < 60) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DAYS:
|
case DAYS:
|
||||||
return "0";
|
|
||||||
case HOURS:
|
case HOURS:
|
||||||
return "0";
|
|
||||||
case MINUTES:
|
case MINUTES:
|
||||||
return "0";
|
return "0";
|
||||||
case SECONDS:
|
case SECONDS:
|
||||||
@@ -44,7 +42,6 @@ public class TimeUtil {
|
|||||||
if (minutes < 60) {
|
if (minutes < 60) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DAYS:
|
case DAYS:
|
||||||
return "0";
|
|
||||||
case HOURS:
|
case HOURS:
|
||||||
return "0";
|
return "0";
|
||||||
case MINUTES:
|
case MINUTES:
|
||||||
@@ -118,9 +115,9 @@ public class TimeUtil {
|
|||||||
int secondsLeft = seconds - s;
|
int secondsLeft = seconds - s;
|
||||||
if (minutes < 60) {
|
if (minutes < 60) {
|
||||||
if (secondsLeft > 0) {
|
if (secondsLeft > 0) {
|
||||||
return String.valueOf(minutes + "m " + secondsLeft + "s");
|
return minutes + "m " + secondsLeft + "s";
|
||||||
} else {
|
} else {
|
||||||
return String.valueOf(minutes + "m");
|
return minutes + "m";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (minutes < 1440) {
|
if (minutes < 1440) {
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
name: ${project.name}
|
name: ${project.name}
|
||||||
main: me.clip.placeholderapi.PlaceholderAPIPlugin
|
main: me.clip.placeholderapi.PlaceholderAPIPlugin
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
author: [extended_clip]
|
authors: [extended_clip, Glare]
|
||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
api-version: 1.13
|
|
||||||
permissions:
|
permissions:
|
||||||
placeholderapi.*:
|
placeholderapi.*:
|
||||||
description: ability to use all commands
|
description: ability to use all commands
|
||||||
@@ -39,4 +38,4 @@ permissions:
|
|||||||
commands:
|
commands:
|
||||||
placeholderapi:
|
placeholderapi:
|
||||||
description: PlaceholderAPI command
|
description: PlaceholderAPI command
|
||||||
aliases: [clipsplaceholderapi, papi]
|
aliases: [papi]
|
||||||
|
Reference in New Issue
Block a user