mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 13:45:14 +01:00
parent
c7a85c2b5a
commit
be91e137a8
@ -7,7 +7,7 @@ import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
|||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays information about Gamemodes, Addons and versioning.
|
* Reloads addons and localization.
|
||||||
*
|
*
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
*/
|
*/
|
||||||
@ -29,17 +29,15 @@ public class BentoBoxReloadCommand extends ConfirmableCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(User user, String label, List<String> args) {
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
this.askConfirmation(user, () -> reloadLocales(user));
|
this.askConfirmation(user, () -> {
|
||||||
return false;
|
// Reload addons
|
||||||
}
|
getPlugin().getAddonsManager().reloadAddons();
|
||||||
|
user.sendMessage("commands.bentobox.reload.addons-reloaded");
|
||||||
|
|
||||||
/**
|
// Reload locales
|
||||||
* Reloads the languages
|
|
||||||
* @param user
|
|
||||||
*/
|
|
||||||
public void reloadLocales(User user) {
|
|
||||||
getPlugin().getLocalesManager().reloadLanguages();
|
getPlugin().getLocalesManager().reloadLanguages();
|
||||||
user.sendMessage("commands.bentobox.reload.locales-reloaded");
|
user.sendMessage("commands.bentobox.reload.locales-reloaded");
|
||||||
|
});
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,6 @@ public class AddonsManager {
|
|||||||
loaders = new HashMap<>();
|
loaders = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: add addon reload
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all the addons from the addons folder
|
* Loads all the addons from the addons folder
|
||||||
*/
|
*/
|
||||||
@ -95,6 +93,20 @@ public class AddonsManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads all the enabled addons
|
||||||
|
*/
|
||||||
|
public void reloadAddons() {
|
||||||
|
if (!addons.isEmpty()) {
|
||||||
|
plugin.log("Reloading addons...");
|
||||||
|
addons.stream().filter(Addon::isEnabled).forEach(addon -> {
|
||||||
|
plugin.log("Reloading " + addon.getDescription().getName() + "...");
|
||||||
|
addon.onReload();
|
||||||
|
});
|
||||||
|
plugin.log("Addons successfully reloaded.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the addon by name
|
* Gets the addon by name
|
||||||
* @param name - addon name
|
* @param name - addon name
|
||||||
@ -260,5 +272,4 @@ public class AddonsManager {
|
|||||||
addons.addAll(sortedAddons.values());
|
addons.addAll(sortedAddons.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -216,6 +216,7 @@ commands:
|
|||||||
reload:
|
reload:
|
||||||
description: "reloads all locale files"
|
description: "reloads all locale files"
|
||||||
locales-reloaded: "&2Languages reloaded"
|
locales-reloaded: "&2Languages reloaded"
|
||||||
|
addons-reloaded: "&2Addons reloaded"
|
||||||
version:
|
version:
|
||||||
plugin-version: "&2Bentobox version: &3[name]"
|
plugin-version: "&2Bentobox version: &3[name]"
|
||||||
description: "display info"
|
description: "display info"
|
||||||
|
Loading…
Reference in New Issue
Block a user