mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-11-26 04:25:18 +01:00
updated LocalExpansionManager to accept a command sender to notify of load completion details
This commit is contained in:
parent
00ced0495d
commit
50cee40531
@ -28,7 +28,6 @@ import me.clip.placeholderapi.expansion.manager.CloudExpansionManager;
|
|||||||
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
||||||
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
||||||
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -128,7 +127,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin
|
|||||||
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
|
|
||||||
getLocalExpansionManager().load();
|
getLocalExpansionManager().load(sender);
|
||||||
|
|
||||||
if (config.isCloudEnabled())
|
if (config.isCloudEnabled())
|
||||||
{
|
{
|
||||||
@ -138,9 +137,6 @@ public final class PlaceholderAPIPlugin extends JavaPlugin
|
|||||||
{
|
{
|
||||||
getCloudExpansionManager().kill();
|
getCloudExpansionManager().kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
Msg.msg(sender,
|
|
||||||
getLocalExpansionManager().getIdentifiers().size() + " &aplaceholder hooks successfully registered!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -232,7 +228,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin
|
|||||||
}
|
}
|
||||||
catch (final ExceptionInInitializerError | ClassNotFoundException ignored)
|
catch (final ExceptionInInitializerError | ClassNotFoundException ignored)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTaskLater(this, getLocalExpansionManager()::load, 1);
|
Bukkit.getScheduler().runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ public final class CommandReload extends PlaceholderCommand
|
|||||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin, @NotNull final CommandSender sender, @NotNull final String alias, @NotNull @Unmodifiable final List<String> params)
|
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin, @NotNull final CommandSender sender, @NotNull final String alias, @NotNull @Unmodifiable final List<String> params)
|
||||||
{
|
{
|
||||||
plugin.reloadConf(sender);
|
plugin.reloadConf(sender);
|
||||||
Msg.msg(sender, "&fPlaceholder&7API &bconfiguration reloaded!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,9 @@ import me.clip.placeholderapi.expansion.Taskable;
|
|||||||
import me.clip.placeholderapi.expansion.VersionSpecific;
|
import me.clip.placeholderapi.expansion.VersionSpecific;
|
||||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||||
import me.clip.placeholderapi.util.FileUtil;
|
import me.clip.placeholderapi.util.FileUtil;
|
||||||
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -63,9 +65,9 @@ public final class LocalExpansionManager implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load()
|
public void load(@NotNull final CommandSender sender)
|
||||||
{
|
{
|
||||||
registerAll();
|
registerAll(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kill()
|
public void kill()
|
||||||
@ -266,7 +268,7 @@ public final class LocalExpansionManager implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void registerAll()
|
private void registerAll(@NotNull final CommandSender sender)
|
||||||
{
|
{
|
||||||
plugin.getLogger().info("Placeholder expansion registration initializing...");
|
plugin.getLogger().info("Placeholder expansion registration initializing...");
|
||||||
|
|
||||||
@ -277,7 +279,11 @@ public final class LocalExpansionManager implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> classes.forEach(this::register));
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
|
final long registered = classes.stream().map(this::register).filter(Optional::isPresent).count();
|
||||||
|
Msg.msg(sender,
|
||||||
|
registered == 0 ? "&6No expansions were registered!" : registered + "&a placeholder hooks successfully registered!");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public final class ServerLoadEventListener implements Listener
|
|||||||
public void onServerLoad(@NotNull final ServerLoadEvent event)
|
public void onServerLoad(@NotNull final ServerLoadEvent event)
|
||||||
{
|
{
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
plugin.getLocalExpansionManager().load();
|
plugin.getLocalExpansionManager().load(Bukkit.getConsoleSender());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user