Change image rendering settings path

This commit is contained in:
filoghost 2021-07-11 11:49:41 +02:00
parent 6948afcfa9
commit 2e68e95497
2 changed files with 27 additions and 10 deletions

View File

@ -43,8 +43,8 @@ public class Settings {
timeFormat = parseTimeFormatter(config.timeFormat, config.timeZone, errorCollector); timeFormat = parseTimeFormatter(config.timeFormat, config.timeZone, errorCollector);
updateNotification = config.updateNotification; updateNotification = config.updateNotification;
imageSymbol = DisplayFormat.apply(config.imageSymbol); imageSymbol = DisplayFormat.apply(config.imageRenderingSolidPixel);
transparencySymbol = DisplayFormat.apply(config.transparencySymbol); transparencySymbol = DisplayFormat.apply(config.imageRenderingTransparentPixel);
bungeeRefreshSeconds = parseBungeeRefreshInterval(config.bungeeRefreshSeconds, errorCollector); bungeeRefreshSeconds = parseBungeeRefreshInterval(config.bungeeRefreshSeconds, errorCollector);
useRedisBungee = config.useRedisBungee; useRedisBungee = config.useRedisBungee;

View File

@ -20,11 +20,11 @@ public class SettingsModel implements MappedConfig {
@Path("quick-edit-commands") @Path("quick-edit-commands")
boolean quickEditCommands = true; boolean quickEditCommands = true;
@Path("images.symbol") @Path("image-rendering.solid-pixel")
String imageSymbol = "[x]"; String imageRenderingSolidPixel = "[x]";
@Path("images.transparency.space") @Path("image-rendering.transparent-pixel")
String transparencySymbol = " [|] "; String imageRenderingTransparentPixel = "&7 [|] ";
@Path("bungee.refresh-seconds") @Path("bungee.refresh-seconds")
int bungeeRefreshSeconds = 3; int bungeeRefreshSeconds = 3;
@ -77,7 +77,25 @@ public class SettingsModel implements MappedConfig {
} }
@Override @Override
public boolean beforeSave(Config rawConfig) { public boolean beforeLoad(Config rawConfig) {
boolean modified = false;
if (rawConfig.contains("images") && !rawConfig.contains("image-rendering")) {
String oldTransparencyColor = rawConfig.getString("images.transparency.color");
String oldTransparencySpace = rawConfig.getString("images.transparency.space");
String oldSolidSymbol = rawConfig.getString("images.symbol");
if (oldTransparencyColor != null && oldTransparencySpace != null) {
rawConfig.setString("image-rendering.transparent-pixel", oldTransparencyColor + oldTransparencySpace);
modified = true;
}
if (oldSolidSymbol != null) {
rawConfig.setString("image-rendering.solid-pixel", oldSolidSymbol);
modified = true;
}
}
List<String> pathsToRemove = Arrays.asList( List<String> pathsToRemove = Arrays.asList(
"vertical-spacing", "vertical-spacing",
"time-format", "time-format",
@ -86,13 +104,12 @@ public class SettingsModel implements MappedConfig {
"bungee-online-format", "bungee-online-format",
"bungee-offline-format", "bungee-offline-format",
"precise-hologram-movement", "precise-hologram-movement",
"images.transparency.color" "images"
); );
boolean modified = false;
for (String path : pathsToRemove) { for (String path : pathsToRemove) {
if (rawConfig.get(path) != null) { if (rawConfig.contains(path)) {
rawConfig.remove(path); rawConfig.remove(path);
modified = true; modified = true;
} }