+ /wa reload zum Neuladen der Templates
This commit is contained in:
parent
bb589757ee
commit
52b9468b8f
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue