Print more detailed info about addons loading in console

This commit is contained in:
Florian CUNY 2018-06-17 14:48:53 +02:00
parent a8f2cabd82
commit 45b4f32d78

View File

@ -54,19 +54,21 @@ public class AddonsManager {
} }
Arrays.stream(Objects.requireNonNull(f.listFiles())).filter(x -> !x.isDirectory() && x.getName().endsWith(".jar")).forEach(this::loadAddon); Arrays.stream(Objects.requireNonNull(f.listFiles())).filter(x -> !x.isDirectory() && x.getName().endsWith(".jar")).forEach(this::loadAddon);
addons.forEach(Addon::onLoad); addons.forEach(Addon::onLoad);
plugin.log("Loaded " + addons.size() + " addons.");
} }
/** /**
* Enables all the addons * Enables all the addons
*/ */
public void enableAddons() { public void enableAddons() {
plugin.log("Enabling addons...");
addons.forEach(addon -> { addons.forEach(addon -> {
addon.onEnable(); addon.onEnable();
Bukkit.getPluginManager().callEvent(AddonEvent.builder().addon(addon).reason(AddonEvent.Reason.ENABLE).build()); Bukkit.getPluginManager().callEvent(AddonEvent.builder().addon(addon).reason(AddonEvent.Reason.ENABLE).build());
addon.setEnabled(true); addon.setEnabled(true);
plugin.log("Enabling " + addon.getDescription().getName() + "..."); plugin.log("Enabling " + addon.getDescription().getName() + "...");
}); });
plugin.log("Addons successfully enabled.");
} }
/** /**
@ -134,6 +136,7 @@ public class AddonsManager {
* Disable all the enabled addons * Disable all the enabled addons
*/ */
public void disableAddons() { public void disableAddons() {
plugin.log("Disabling addons...");
// Unload addons // Unload addons
addons.forEach(addon -> { addons.forEach(addon -> {
addon.onDisable(); addon.onDisable();
@ -148,6 +151,7 @@ public class AddonsManager {
// Ignore // Ignore
} }
}); });
plugin.log("Addons successfully disabled.");
} }
public List<Addon> getAddons() { public List<Addon> getAddons() {