// Path: src/main/java/de/zh32/teleportsigns/server/GameServer.java
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode
// public class GameServer implements Cloneable {
// 	private String name;
// 	private int playersOnline = 0;
// 	private int maxPlayers = 0;
// 	private String motd;
// 	private boolean online = false;
// 	private InetSocketAddress address;
// 	private String displayname;
// 
// 	@Override
// 	public GameServer clone() {
// 		try {
// 			return (GameServer) super.clone();
// 		} catch (CloneNotSupportedException e) {
// 			throw new InternalError();
// 		}
// 	}
// }
// 
// Path: src/main/java/de/zh32/teleportsigns/sign/SignLayout.java
// public interface SignLayout {
// 
// 	public boolean isTeleport();
// 
// 	public String[] renderLayoutFor(GameServer sinfo);
// 
// 	public String getName();
// }
// 
// Path: src/main/java/de/zh32/teleportsigns/sign/TeleportSignLayout.java
// @Data
// @Builder
// @Accessors(chain = true)
// public class TeleportSignLayout implements SignLayout {
// 
// 	private boolean teleport;
// 	private String name;
// 	private String[] layout;
// 	private String online;
// 	private String offline;
// 	private String numberPlaceHolder;
// 
// 	@Override
// 	public String[] renderLayoutFor(GameServer sinfo) {
// 		String[] laa = new String[layout.length];
// 		int motdCount = 0;
// 		String tempMotd = sinfo.getMotd() == null ? "" : sinfo.getMotd();
// 		String[] splitMotd = tempMotd.split("(?<=\\G.{15})");
// 		for (int i = 0; i < layout.length; i++) {
// 			String line = layout[i];
// 			line = line.replace("%displayname%", sinfo.getDisplayname());
// 			if (sinfo.isOnline()) {
// 				line = line.replace("%isonline%", online);
// 				line = line.replace("%numpl%", String.valueOf(sinfo.getPlayersOnline()));
// 				line = line.replace("%maxpl%", String.valueOf(sinfo.getMaxPlayers()));
// 				if (line.contains("%motd%")) {
// 					if (motdCount < splitMotd.length) {
// 						String motd = splitMotd[motdCount];
// 						if (motd != null) {
// 							line = line.replace("%motd%", motd);
// 						}
// 						motdCount++;
// 					} else {
// 						line = line.replace("%motd%", "");
// 					}
// 				}
// 			} else {
// 				line = line.replace("%isonline%", offline);
// 				line = line.replace("%numpl%", numberPlaceHolder);
// 				line = line.replace("%maxpl%", numberPlaceHolder);
// 				line = line.replace("%motd%", "");
// 			}
// 			laa[i] = ChatColor.translateAlternateColorCodes('&', line);
// 		}
// 		return laa;
// 	}
// 
// 
// }


import de.zh32.teleportsigns.server.GameServer;
import de.zh32.teleportsigns.sign.SignLayout;
import de.zh32.teleportsigns.sign.TeleportSignLayout;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.Plugin;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
package de.zh32.teleportsigns.configuration;



/**
 * @author zh32
 */
public class BukkitConfiguration implements ConfigurationAdapter {

	private final Plugin plugin;

	public BukkitConfiguration(Plugin plugin) {
		this.plugin = plugin;
		plugin.saveDefaultConfig();
	}

	@Override
	public List<SignLayout> loadLayouts() {
		List<SignLayout> results = new ArrayList<>();
		ConfigurationSection layouts = plugin.getConfig().getConfigurationSection("layouts");
		for (String layout : layouts.getKeys(false)) {
			results.add(signFromConfigurationSection(layouts.getConfigurationSection(layout), layout));
		}
		Bukkit.getLogger().info(String.format("Loaded %d layouts from configuration.", results.size()));
		return results;
	}

	private SignLayout signFromConfigurationSection(ConfigurationSection cs, String layout) {
// Path: src/main/java/de/zh32/teleportsigns/server/GameServer.java
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode
// public class GameServer implements Cloneable {
// 	private String name;
// 	private int playersOnline = 0;
// 	private int maxPlayers = 0;
// 	private String motd;
// 	private boolean online = false;
// 	private InetSocketAddress address;
// 	private String displayname;
// 
// 	@Override
// 	public GameServer clone() {
// 		try {
// 			return (GameServer) super.clone();
// 		} catch (CloneNotSupportedException e) {
// 			throw new InternalError();
// 		}
// 	}
// }
// 
// Path: src/main/java/de/zh32/teleportsigns/sign/SignLayout.java
// public interface SignLayout {
// 
// 	public boolean isTeleport();
// 
// 	public String[] renderLayoutFor(GameServer sinfo);
// 
// 	public String getName();
// }
// 
// Path: src/main/java/de/zh32/teleportsigns/sign/TeleportSignLayout.java
// @Data
// @Builder
// @Accessors(chain = true)
// public class TeleportSignLayout implements SignLayout {
// 
// 	private boolean teleport;
// 	private String name;
// 	private String[] layout;
// 	private String online;
// 	private String offline;
// 	private String numberPlaceHolder;
// 
// 	@Override
// 	public String[] renderLayoutFor(GameServer sinfo) {
// 		String[] laa = new String[layout.length];
// 		int motdCount = 0;
// 		String tempMotd = sinfo.getMotd() == null ? "" : sinfo.getMotd();
// 		String[] splitMotd = tempMotd.split("(?<=\\G.{15})");
// 		for (int i = 0; i < layout.length; i++) {
// 			String line = layout[i];
// 			line = line.replace("%displayname%", sinfo.getDisplayname());
// 			if (sinfo.isOnline()) {
// 				line = line.replace("%isonline%", online);
// 				line = line.replace("%numpl%", String.valueOf(sinfo.getPlayersOnline()));
// 				line = line.replace("%maxpl%", String.valueOf(sinfo.getMaxPlayers()));
// 				if (line.contains("%motd%")) {
// 					if (motdCount < splitMotd.length) {
// 						String motd = splitMotd[motdCount];
// 						if (motd != null) {
// 							line = line.replace("%motd%", motd);
// 						}
// 						motdCount++;
// 					} else {
// 						line = line.replace("%motd%", "");
// 					}
// 				}
// 			} else {
// 				line = line.replace("%isonline%", offline);
// 				line = line.replace("%numpl%", numberPlaceHolder);
// 				line = line.replace("%maxpl%", numberPlaceHolder);
// 				line = line.replace("%motd%", "");
// 			}
// 			laa[i] = ChatColor.translateAlternateColorCodes('&', line);
// 		}
// 		return laa;
// 	}
// 
// 
// }


// Path: src/main/java/de/zh32/teleportsigns/configuration/BukkitConfiguration.java
import de.zh32.teleportsigns.server.GameServer;
import de.zh32.teleportsigns.sign.SignLayout;
import de.zh32.teleportsigns.sign.TeleportSignLayout;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.Plugin;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;

package de.zh32.teleportsigns.configuration;



/**
 * @author zh32
 */
public class BukkitConfiguration implements ConfigurationAdapter {

	private final Plugin plugin;

	public BukkitConfiguration(Plugin plugin) {
		this.plugin = plugin;
		plugin.saveDefaultConfig();
	}

	@Override
	public List<SignLayout> loadLayouts() {
		List<SignLayout> results = new ArrayList<>();
		ConfigurationSection layouts = plugin.getConfig().getConfigurationSection("layouts");
		for (String layout : layouts.getKeys(false)) {
			results.add(signFromConfigurationSection(layouts.getConfigurationSection(layout), layout));
		}
		Bukkit.getLogger().info(String.format("Loaded %d layouts from configuration.", results.size()));
		return results;
	}

	private SignLayout signFromConfigurationSection(ConfigurationSection cs, String layout) {
		return TeleportSignLayout.builder()