+ /wa reload zum Neuladen der Templates

This commit is contained in:
Peda 2020-12-28 03:33:08 +01:00
parent bb589757ee
commit 52b9468b8f
2 changed files with 100 additions and 87 deletions

View File

@ -78,6 +78,12 @@ public class CommandRegistry implements CommandExecutor {
return settings.tntCommand(sender, command, label, args);
case "fire":
return settings.fireCommand(sender, command, label, args);
case "reload":
if(!sender.isOp()){
sender.sendMessage("Reloaded Templates!");
WorldTemplateProvider.getInstance().reload();
return true;
}
default:
//default command is better than the other one
return ws.mainCommand(sender, command, label, args);

View File

@ -17,7 +17,14 @@ public class WorldTemplateProvider {
private static final WorldTemplateProvider instance = new WorldTemplateProvider();
private final HashMap<String, WorldTemplate> templates = new HashMap<>();
private WorldTemplateProvider() {
reload();
}
public void reload(){
templates.clear();
ConfigurationSection section = PluginConfig.getConfig().getConfigurationSection("worldtemplates.templates");
for (String key : section.getKeys(false)) {
String name = section.getString(key + ".name");