package dk.socketmud.object; import java.io.IOException; import java.util.ArrayList; import dk.socketmud.io.SMClient; import dk.socketmud.util.Log; public class Character extends Mobile { protected SMClient socket; static { cmdList.add("quit"); cmdList.add("who"); } public Character(SMClient socket, String name) throws NullPointerException { super(name); if (socket == null) throw new NullPointerException("socket cannot be NULL"); this.socket = socket; } public void write(String s) { socket.write(s); } public String getName() { return this.name; } public ArrayList<Character> getAllCharacters() { return socket.getAllCharacters(); } public void quit() { write("Goodbye\r\n"); try { socket.flush(); socket.close(); } catch (IOException ex) { Log.logException(ex); } } }