package me.jesensky.dan.playertracker;

import me.jesensky.dan.playertracker.forms.ServerGUI;
import me.jesensky.dan.playertracker.net.Connection;

import java.net.InetAddress;
import java.util.HashMap;

public class Server {
    private static Server singletonInstance;
    private ConnectionManager connectionManager;

    static {
        singletonInstance = null;
    }

    private Server() {
        super();
        this.connectionManager = new ConnectionManager();
        this.connectionManager.start();
        this.loadConfiguration();
    }

    public static Server getSingleton() {
        if (singletonInstance == null)
            singletonInstance = new Server();
        return singletonInstance;
    }

    public ConnectionManager getConnectionManager() {
        return this.connectionManager;
    }

    public static void main(String[] args) {
        Server singleton = new Server();
        ServerGUI gui = new ServerGUI();
        singleton.getConnectionManager().registerConnectionListener((evt) -> gui.setConnections(singleton.getConnectionManager().getConnections().size()));
    }

    public HashMap<InetAddress, Connection> getConnections() {
        return this.connectionManager.getConnections();
    }

    private void loadConfiguration() {

    }

    @Override
    public String toString() {
        return "Server@" + super.hashCode() + "[" + this.getConnectionManager().toString() + "]";
    }
}
@@ -144,36 +144,219 @@
 on;%0A
-%0Aimport java.net.InetAddress
+import me.jesensky.dan.playertracker.util.DatabaseManager;%0A%0Aimport javax.xml.crypto.Data;%0Aimport java.beans.Statement;%0Aimport java.net.InetAddress;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.SQLException
 ;%0Aim
@@ -495,16 +495,51 @@
 Manager;
+%0A    private DatabaseManager dbMan;
 %0A%0A    st
@@ -754,24 +754,755 @@
 guration();%0A
+        try %7B%0A            //TODO replace hard-coded test data with actual configuration%0A%0A            this.dbMan = new DatabaseManager(%22::1%22, 1533, %22root%22, %22root%22, %22playertracker_test%22);%0A            this.dbMan.connect();%0A%0A            PreparedStatement s = this.dbMan.prepareStatement(%22SELECT * FROM information_schema.tables WHERE table_schema = 'playertracker' AND table_name = 'players' LIMIT 1;%22);%0A            s.execute();%0A            s.close();%0A%0A            s = this.dbMan.prepareStatement(%22SELECT * FROM information_schema.tables WHERE table_schema = 'playertracker' AND table_name = 'users' LIMIT 1;%22);%0A            s.execute();%0A            s.close();%0A        %7Dcatch(SQLException e)%7B%0A            //TODO log exception%0A        %7D%0A
     %7D%0A%0A    p
@@ -1756,32 +1756,109 @@
 Manager;%0A    %7D%0A%0A
+    public DatabaseManager getDbManager()%7B%0A        return this.dbMan;%0A    %7D%0A%0A
     public stati

Handle default tables in singleton