Removed comment from Webserver.Disable_Webserver (#1180)

This commit is contained in:
Risto Lahtela 2019-10-06 11:38:32 +03:00 committed by GitHub
parent d05ece6106
commit dcf47f1120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 9 deletions

View File

@ -17,6 +17,10 @@
package com.djrapitops.plan.settings.config.changes;
import com.djrapitops.plan.settings.config.Config;
import com.djrapitops.plan.settings.config.ConfigNode;
import java.util.Collections;
import java.util.Optional;
/**
* Represents a change made to the config structure.
@ -97,4 +101,28 @@ public interface ConfigChange {
return "Removed " + oldPath;
}
}
class RemovedComment implements ConfigChange {
private String path;
public RemovedComment(String path) {
this.path = path;
}
@Override
public boolean hasBeenApplied(Config config) {
Optional<ConfigNode> node = config.getNode(path);
return !node.isPresent() || node.get().getComment().isEmpty();
}
@Override
public void apply(Config config) {
config.getNode(path).ifPresent(node -> node.setComment(Collections.emptyList()));
}
@Override
public String getAppliedMessage() {
return "Removed Comment from " + path;
}
}
}

View File

@ -137,7 +137,8 @@ public class ConfigUpdater {
new ConfigChange.Removed("Export.Parts.JavaScript_and_CSS"),
new ConfigChange.Moved("Plugins.LiteBans", "Plugins.Litebans"),
new ConfigChange.Moved("Plugins.BuyCraft", "Plugins.Buycraft"),
new ConfigChange.Moved("Plugin.Configuration.Allow_bungeecord_to_manage_settings", "Plugin.Configuration.Allow_proxy_to_manage_settings")
new ConfigChange.Moved("Plugin.Configuration.Allow_bungeecord_to_manage_settings", "Plugin.Configuration.Allow_proxy_to_manage_settings"),
new ConfigChange.RemovedComment("Webserver.Disable_Webserver"),
};
}

View File

@ -50,10 +50,6 @@ Webserver:
Key_pass: default
Store_pass: default
Alias: alias
# For those that want to serve Html from their own WebServer instead.
# Set up Html Export (https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/External-WebServer-Use)
# ATTENTION: On BungeeCord systems it is not possible to disable the WebServer on the plugin due to connection requirements.
# If the WebServer is disabled with this setting BungeeCord systems will cease to function.
Disable_Webserver: false
External_Webserver_address: "https://www.example.address"
# -----------------------------------------------------

View File

@ -52,10 +52,6 @@ Webserver:
Key_pass: default
Store_pass: default
Alias: alias
# For those that want to serve Html from their own WebServer instead.
# Set up Html Export (https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/External-WebServer-Use)
# ATTENTION: On BungeeCord systems it is not possible to disable the WebServer on the plugin due to connection requirements.
# If the WebServer is disabled with this setting BungeeCord systems will cease to function.
Disable_Webserver: false
External_Webserver_address: https://www.example.address
# -----------------------------------------------------