Add option to trim (remove trailing spaces) from the motd.

This commit is contained in:
filoghost 2014-12-30 13:41:43 +01:00
parent 010b72fe7d
commit be1866fc2d
3 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,7 @@
package com.gmail.filoghost.holographicdisplays.bridge.bungeecord; package com.gmail.filoghost.holographicdisplays.bridge.bungeecord;
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
public class BungeeServerInfo { public class BungeeServerInfo {
private boolean isOnline; private boolean isOnline;
@ -60,10 +62,10 @@ public class BungeeServerInfo {
if (motd.contains("\n")) { if (motd.contains("\n")) {
String[] split = motd.split("\n"); String[] split = motd.split("\n");
this.motd1 = split[0]; this.motd1 = Configuration.pingerTrimMotd ? split[0].trim() : split[0];
this.motd2 = split[1]; this.motd2 = Configuration.pingerTrimMotd ? split[1].trim() : split[1];
} else { } else {
this.motd1 = motd; this.motd1 = Configuration.pingerTrimMotd ? motd.trim() : motd;
this.motd2 = ""; this.motd2 = "";
} }
} }

View File

@ -16,6 +16,7 @@ public enum ConfigNode {
BUNGEE_PINGER_OFFLINE_MOTD("bungee.pinger.offline-motd", "&cOffline, couldn't get the MOTD."), BUNGEE_PINGER_OFFLINE_MOTD("bungee.pinger.offline-motd", "&cOffline, couldn't get the MOTD."),
BUNGEE_PINGER_ONLINE_FORMAT("bungee.pinger.status.online", "&aOnline"), BUNGEE_PINGER_ONLINE_FORMAT("bungee.pinger.status.online", "&aOnline"),
BUNGEE_PINGER_OFFLINE_FORMAT("bungee.pinger.status.offline", "&cOffline"), BUNGEE_PINGER_OFFLINE_FORMAT("bungee.pinger.status.offline", "&cOffline"),
BUNGEE_PINGER_TRIM_MOTD("bungee.pinger.trim-motd", true),
BUNGEE_PINGER_SERVERS("bungee.pinger.servers", Arrays.asList("hub: 127.0.0.1:25565", "survival: 127.0.0.1:25566", "minigames: 127.0.0.1:25567")), BUNGEE_PINGER_SERVERS("bungee.pinger.servers", Arrays.asList("hub: 127.0.0.1:25565", "survival: 127.0.0.1:25566", "minigames: 127.0.0.1:25567")),
TIME_FORMAT("time.format", "H:mm"), TIME_FORMAT("time.format", "H:mm"),
TIME_ZONE("time.zone", "GMT+1"), TIME_ZONE("time.zone", "GMT+1"),

View File

@ -39,6 +39,7 @@ public class Configuration {
public static String pingerOfflineMotd; public static String pingerOfflineMotd;
public static String pingerStatusOnline; public static String pingerStatusOnline;
public static String pingerStatusOffline; public static String pingerStatusOffline;
public static boolean pingerTrimMotd;
public static boolean debug; public static boolean debug;