mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-10-31 19:44:03 +01:00
Compare commits
9 Commits
90a0f0bb38
...
82641e96bb
Author | SHA1 | Date | |
---|---|---|---|
|
82641e96bb | ||
|
882b7c5965 | ||
|
7a0be5edf8 | ||
|
e94328935d | ||
|
403622d205 | ||
|
545f7f0bbd | ||
|
9b22192112 | ||
|
d3a1ad1cdb | ||
|
c9cf609b91 |
@ -29,7 +29,7 @@ public abstract class PlaceholderHook {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
|
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
|
||||||
if (player != null && player.isOnline()) {
|
if (player != null && player.isOnline()) {
|
||||||
return onPlaceholderRequest((Player) player, params);
|
return onPlaceholderRequest(player.getPlayer(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
return onPlaceholderRequest(null, params);
|
return onPlaceholderRequest(null, params);
|
||||||
|
@ -200,7 +200,9 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
for (final Plugin other : plugins) {
|
for (final Plugin other : plugins) {
|
||||||
builder.append(" ")
|
builder.append(" ")
|
||||||
.append(String.format("%-" + size + "s", other.getName()))
|
.append(String.format("%-" + size + "s", other.getName()))
|
||||||
.append(" [Version: ")
|
.append(" [Authors: [")
|
||||||
|
.append(String.join(", ", other.getDescription().getAuthors()))
|
||||||
|
.append("], Version: ")
|
||||||
.append(other.getDescription().getVersion())
|
.append(other.getDescription().getVersion())
|
||||||
.append("]")
|
.append("]")
|
||||||
.append("\n");
|
.append("\n");
|
||||||
|
@ -61,6 +61,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.server.PluginDisableEvent;
|
import org.bukkit.event.server.PluginDisableEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -352,6 +353,9 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
private void registerAll(@NotNull final CommandSender sender) {
|
private void registerAll(@NotNull final CommandSender sender) {
|
||||||
Msg.info("Placeholder expansion registration initializing...");
|
Msg.info("Placeholder expansion registration initializing...");
|
||||||
|
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
|
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
Msg.severe("Failed to load class files of expansion.", exception);
|
Msg.severe("Failed to load class files of expansion.", exception);
|
||||||
@ -360,7 +364,7 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
final List<PlaceholderExpansion> registered = classes.stream()
|
final List<PlaceholderExpansion> registered = classes.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.map(this::register)
|
.map(LocalExpansionManager.this::register)
|
||||||
.filter(Optional::isPresent)
|
.filter(Optional::isPresent)
|
||||||
.map(Optional::get)
|
.map(Optional::get)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@ -390,6 +394,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
|
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
}
|
||||||
|
|
||||||
private void unregisterAll() {
|
private void unregisterAll() {
|
||||||
for (final PlaceholderExpansion expansion : Sets.newHashSet(expansions.values())) {
|
for (final PlaceholderExpansion expansion : Sets.newHashSet(expansions.values())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user