No enclosing instance of type Server is accessible
<p>I'm encountering a weird issue in Java at the moment that I've never seen before.</p>

<p>The error is "No enclosing instance of type Server is accessible. Must qualify the allocation with an enclosing instance of type Server (e.g. x.new A() where x is an instance of Server)."</p>

<p>The line I've commented on is where the error occurs.</p>

<pre><code>package game;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;

public class Server {

    private static List&lt;ThreadModtagClient&gt; clients;

    class ReceiveDataListener implements SocketListener {

        @Override
        public void dataReceived(ThreadModtagClient client, String data) {

        }   
    }

    /**
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub

        clients = new ArrayList&lt;ThreadModtagClient&gt;();

        ServerSocket welcomeSocket = new ServerSocket(16567);

        while (true) {
            Socket connectionSocket = welcomeSocket.accept();

            ThreadModtagClient client = new ThreadModtagClient(connectionSocket);
            ReceiveDataListener listener = new ReceiveDataListener(); // &lt;--- this is where the error occurs
            client.addSocketListener(listener);
            clients.add(client);
        }

    }
}

class ThreadModtagClient extends Thread implements SocketThread {

    private BufferedReader inFromClient;
    private DataOutputStream outToClient;

    private Player player;

    private List&lt;SocketListener&gt; listeners;


    public ThreadModtagClient(Socket connection) throws IOException {
        inFromClient = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        outToClient = new DataOutputStream(connection.getOutputStream());
        listeners = new ArrayList&lt;SocketListener&gt;();

    }

    public void addSocketListener(SocketListener listener) {
        listeners.add(listener);
    }

    public void removeSocketListener(SocketListener listener) {
        listeners.remove(listener);
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }


    public void sendData(String data) throws IOException {
        outToClient.writeChars(data);
    }

    public void run() {

        while (true) {
            try {

                String data = inFromClient.readLine();

                for(SocketListener listener : listeners) {
                    listener.dataReceived(this, data);
                }

            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch(NoSuchElementException e1) {
                e1.printStackTrace();
            }
        }
    }
}
</code></pre>
