📄 dumbclient.java
字号:
package com.lyrisoft.chat.client;import java.util.*;import com.lyrisoft.chat.server.local.*;import com.lyrisoft.chat.client.*;import java.util.Properties;import java.io.FileInputStream;import java.io.File;/** * An empty implementation of IChatClient. You can subclass this class * and just override the methods you're interested in. * com.lyrisoft.chat.test.LoadTestClient is an example implementation, * and of course, com.lyrisoft.chat.client.Client is another example. */public abstract class DumbClient implements IChatClient { protected Hashtable _attributes = new Hashtable(); /** * The server has authenticated us and acknowledged our sign on */ public void ackSignon(String myName) { } /** * The connection to the server was closed */ public void connectionLost() { } /** * The server has acknowledged our room join */ public void ackJoinRoom(String room) { } /** * The server has acknowledged our room part */ public void ackPartRoom(String room) { } /** * The server is indicating that someone is saying something in a room */ public void messageFromUser(String user, String room, String msg) { } /** * The server is indicating that someone is saying something to us, privately */ public void messageFromUserPrivate(String user, String msg) { } /** * The server is indicating that someone is privately emoting something to us. * (Note, there is no "emoteFromUserPublic" { } A public emote comes in as a * generalRoomMessage * * @see #generalRoomMessage */ public void emoteFromUserPrivate(String user, String msg) { } /** * The server is sending us a list of rooms */ public void roomList(String[] roomList) { } /** * The server is sending us the global user list */ public void globalUserList(String[] users) { } /** * The server is sending us the user list for a particular room */ public void roomUserList(String room, String[] users) { } /** * The server is indicating that someone just joined a room we're in. */ public void userJoinedRoom(String user, String room) { } /** * The server is indicating that someone just parted a room we're in. */ public void userPartedRoom(String user, String room, boolean signOff) { } /** * The server is giving us an error message to display */ public void generalError(String message) { } /** * The server is giving us a general message to display. (This could be a MOTD or the * answer to some general request like the /stats command) */ public void generalMessage(String message) { } /** * The server is giving us a message to display in the context of a particular room. This * is commonly an emote message. */ public void generalRoomMessage(String room, String message) { } /** * The server is indicating that somebody ping'ed us. It expects to get a pong message back */ public void ping(String user, String arg) { } /** * The server is giving us the reply to a ping that we already sent out. */ public void pong(String user, String arg) { } public void killed(String killer, String msg) { } public void ackKill(String victim) { } public void emote(String from, String room, String message) { } public void userSignOn(String userId) { } public void userSignOff(String userId) { } public void roomCreated(String room) { } public void roomDestroyed(String room) { } public void setAttribute(String attribute, Object value) { _attributes.put(attribute, value); } public Object getAttribute(String attribute) { return _attributes.get(attribute); } public Properties getProperties(String name) { String nfcHome = System.getProperty("NFC_HOME"); String file = nfcHome + File.separator + "web" + File.separator + "resources" + File.separator + name; FileInputStream fis = null; try { fis = new FileInputStream(file); Properties p = new Properties(); p.load(fis); return p; } catch (Exception e) { e.printStackTrace(); } finally { if (fis != null) { try { fis.close(); } catch (Exception e) {} } } return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -