Make a plugin to change server.properties ingame

Discussion in 'Plugin Requests' started by Tzzzt123, Jun 18, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    Tzzzt123

    Hi bukkit,
    Can someone make me a plugin which gives the possibility to change server.properties values ingame without reboot. something as:
    /properties <property> <value>
    and a permission named: properties.<property>.
    Example: Admin1 wants to change the value pvp to true he needs to type /properties pvp true and he needs the permission node properties.pvp

    and a command: /properties view to view the server.properties file ingame (permission name: properties.view)
    Thanks Tzzzt123

    Hi bukkit,
    me again. And if someone wants he can make an addon that can change the values of standard .yml files (bukkit.yml, commands.yml, help.yml, permissions.yml [Not permissions plugin], [And for spigot users spigot.yml]). The command could be /yml <file_without.yml> <part_of_yml> <add_under/remove_under/change> <value>
    and permission node: yml.<file_without.yml>.<part_of_yml>
    Example:
    If Admin1 is online again and types: /yml commands command-block-overrides add_under heal he would need this permission node: yml.commands.command-block-overrides and then it changes this:
    YML (open)

    command-block-overrides:
    - heal

    If you need additional information write it in this thread!
    Thanks Tzzzt123

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 18, 2016
  2. Online

    timtower Administrator Administrator Moderator

    @Tzzzt123 We can edit the file just fine, not sure if we can reload it though.
     
  3. Offline

    Tzzzt123

    @timtower that is just an idea for plugin developers who want to make a plugin. if anyone wants, he can make this plugin.
    Regards Tzzzt123
     
  4. Offline

    MrGeneralQ

    Prety sure it is not possible to edit this file using a plugin. The plugin has no access to the server properties file since it is a read-only file. Also, your plugin doesn't have access to that folder. Would be very vulnurable tough if it was possible.
     
  5. Offline

    I Al Istannen

    @MrGeneralQ
    I am able to write to it. Might be because it is on my Computer though. Crude example code would be this:
    Code:
            Path path = Paths.get(getDataFolder().getParentFile().getAbsolutePath()).getParent().resolve("server.properties");
            try {
                List<String> lines = Files.readAllLines(path);
                lines.add("test:test");
                Files.write(path, lines, StandardOpenOption.TRUNCATE_EXISTING);
            } catch (IOException e) {
                e.printStackTrace();
            }
    Just put it in the onEnable, and it will append "test:test" to the file.

    But the point is what timtower already mentioned. You would need to reload the server "Bukkit#reload" and if you do this, you can cause problems with other plugins. I also don't know if just reloading is enough to refresh the settings or if you need to restart it.
     
  6. Online

    timtower Administrator Administrator Moderator

    @MrGeneralQ You can access the file just fine.
    @I Al Istannen Reload might work, but I am not sure about that.

    Might be easier to just control those variables through plugins like worldguard etc instead.
     
Thread Status:
Not open for further replies.

Share This Page