1 package org.argosfields.service;
2
3 import java.text.DateFormat;
4 import java.util.Date;
5 import java.util.List;
6
7 import org.apache.commons.lang.StringUtils;
8 import org.argosfields.multi.server.GameServer;
9 import org.argosfields.multi.server.IGameServer;
10 import org.argosfields.resource.ResourceManager;
11 import org.eclipse.jface.preference.IPreferenceStore;
12 import org.eclipse.jface.preference.JFacePreferences;
13
14 /***
15 * GameManager.java
16 * @author Xavier Cho
17 * @version $Revision: 1.2 $ $Date: 2004/04/17 18:20:57 $
18 */
19 public class GameManager implements IGameManager {
20
21 private String welcomeMessage;
22
23 /***
24 * @see org.argosfields.service.IGameManager#getWelcomeMessage()
25 */
26 public String getWelcomeMessage() {
27 if (welcomeMessage == null) {
28 ResourceManager resources = ResourceManager.getInstance();
29 IPreferenceStore preferences = JFacePreferences
30 .getPreferenceStore();
31
32 String message = preferences.getString("welcome.message");
33
34 String[] args = new String[] {
35 resources.getString("application.version"),
36 DateFormat.getInstance().format(
37 new Date(System.currentTimeMillis()))};
38
39 StringBuffer buffer = new StringBuffer();
40 buffer.append(resources.getString("message.server.info", args));
41
42 if (!StringUtils.isBlank(welcomeMessage)) {
43 buffer.append("\n");
44 buffer.append(welcomeMessage);
45 }
46
47 welcomeMessage = buffer.toString();
48 }
49
50 return welcomeMessage;
51 }
52
53 /***
54 * @see org.argosfields.service.IGameManager#getGameRooms()
55 */
56 public List getGameRooms() {
57 // TODO Auto-generated method stub
58 return null;
59 }
60
61 /***
62 * @see org.argosfields.service.IGameManager#getPlayers()
63 */
64 public List getPlayers() {
65 IGameServer server = GameServer.getInstance();
66 return server.getPlayers();
67 }
68 }
This page was automatically generated by Maven