|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.starhope.appius.game.Zone
public class Zone
| Field Summary | |
|---|---|
private Map<String,Room> |
badges
Badges are icons placed upon the map to indicate something special about a room |
private AbstractCensor |
censor
Censorship object |
protected Set<String> |
cullRooms
Rooms to be culled |
private Set<GameEvent> |
gameEvents
All GameEvents which have been added to this Zone already |
(package private) static long |
lastCheckedZonesForSpawn
|
private List<Room> |
lobbies
Lobby rooms into which users are dropped at login, if they don't specify an initial room to join on their own |
protected Set<String> |
myEmptyZones
Names of empty zones |
private String |
myName
The name of this zone |
private String |
myServer
The hostname of the server on which this Zone is running |
private int |
nextDynamicRoomNumber
The room numbers for dynamic rooms begin here |
private static int |
NPC_TICK_INTERVAL
Time between updates for NPC's |
private static Random |
randomSource
keep the random source around for fun. |
(package private) static Set<AbstractZone> |
retiredZones
Set of retired zones |
static Map<AbstractZone,Map<String,List<String>>> |
roomMaps
linkages between rooms |
private ConcurrentHashMap<Integer,Room> |
roomsByID
All rooms in the Zone: sorted by ID. |
private ConcurrentHashMap<String,Room> |
roomsByMoniker
All rooms in the Zone: sorted by moniker. |
private static long |
serialVersionUID
Java Serialization unique ID |
protected boolean |
serverReady
A flag set once the server has indicated that it's ready to go, to avoid issues with events firing off too soon (e.g. |
private ConcurrentSkipListSet<AbstractUser> |
zoneUsers
The set of all users in the zone. |
| Constructor Summary | |
|---|---|
Zone(String zoneName)
XXX the zone's censor is initialised to FilterType.KID_CHAT. |
|
| Method Summary | |
|---|---|
void |
activate()
This is an overriding method. |
void |
add(AbstractUser user)
|
void |
add(Room room)
This is an overriding method. |
void |
addGameEventByClass(String className)
add a GameEvent by instantiating it into this Zone, based upon its class name. |
void |
assertStaffLevel(GeneralUser u,
int staffLevelRequired)
Assert that the given user must have a given level of staff privileges |
private Room |
autoVivifyUserRoom(String string)
WRITEME: Document this method brpocock@star-hope.org |
private void |
badgesChanged()
Notify everyone in the zone that the badges have been changed |
protected void |
buildRoomMap()
WRITEME: Document this method brpocock@star-hope.org |
void |
clearAllBadges()
WRITEME |
void |
clearAllBadges(Room room)
clear all badges on one room |
void |
clearBadge(String string)
clear the given badge name off of any room to which it might be applied |
int |
compareTo(AbstractZone other)
|
protected static void |
cullAllUserRooms()
remove unused user rooms |
protected void |
cullUserRooms()
WRITEME: Document this method brpocock@star-hope.org |
void |
destroy()
This is an overriding method. |
void |
destroyRoom(Room room)
This is an overriding method. |
boolean |
equals(AbstractZone z)
determine whether two Zone pointers are the same object |
boolean |
equals(Object obj)
This is an overriding method. |
private org.json.JSONObject |
getAllBadges_JSON()
get all badges on the Zone in JSON form |
Map<String,String> |
getAllBadges()
Get all badges in this Zone (and to which rooms they are applied) |
Set<Integer> |
getAllUsersIDsInZone()
get the user ID's of all users active in the Zone |
Collection<AbstractUser> |
getAllUsersInZone()
This is an overriding method. |
private String |
getBackgroundImage()
Get the background image used to identify this Zone in the zone browser |
Set<String> |
getBadgesForRoom(Room room)
Get any badges assigned to a room |
private int |
getBuddiesForUser(AbstractUser user)
Discover how many of the user's buddies are online in a given zone |
static AbstractZone |
getByName(String zoneName)
Deprecated. ask AppiusClaudiusCaecus.getZone(java.lang.String) |
AbstractCensor |
getCensor()
WRITEME: Document this method brpocock@star-hope.org |
private static Vector<String> |
getDefaultGameEvents()
Get the GameEvents configured for default inclusion in all zones |
int |
getDynamicRoomNumber()
|
Set<GameEvent> |
getGameEvents()
get all game events tied to this Zone |
String |
getHost()
Get the host on which this zone's server is running |
int |
getMaxUsers()
This is an overriding method. |
String |
getMyServer()
|
String |
getName()
This is an overriding method. |
Room |
getNextLobby()
Get the next room which will accept an inbound user as the next lobby. |
static int |
getNPCTickInterval()
|
static String |
getRev()
|
Room |
getRoom(Integer room)
This is an overriding method. |
Room |
getRoomByName(String moniker)
This is an overriding method. |
org.json.JSONObject |
getRoomList_JSON()
This is an overriding method. |
Collection<Room> |
getRoomList()
This is an overriding method. |
String |
getRoomListSFSXML()
This is an overriding method. |
Map<String,List<String>> |
getRoomMap()
|
int |
getRoomMaxUsers()
This is an overriding method. |
String |
getURL()
Get the Appius URL for this Zone |
AbstractUser |
getUserByName(String buddy)
This is an overriding method. |
int |
getUserCount()
WRITEME: Document this method brpocock@star-hope.org |
Room |
getUserRoom(AbstractUser user)
Deprecated. use RoomListener.getRoom() |
org.json.JSONObject |
getZoneData_JSON(AbstractUser user)
Gets the Zone data. |
org.json.JSONObject |
getZoneList_JSON(AbstractUser user)
Get the set of all zones active (and not hidden nor retired) in JSON form. |
(package private) void |
handleServerReady()
Once the server indicates its readiness, begin spawning auto-spawning Zones |
int |
hashCode()
This is an overriding method. |
void |
init()
This is an overriding method. |
(package private) boolean |
isItGood()
Check over Zone spawn |
(package private) void |
loadGameEvents()
Load game events specified in the database |
void |
readExternal(ObjectInput in)
|
void |
remove(AbstractUser thing)
This is an overriding method. |
void |
remove(GameEvent ev)
Remove an event from this Zone |
void |
retire()
Stop accepting new users |
private void |
sendBadges(AbstractUser user)
send badges to an given user in this zone |
protected void |
sendBadPassword(String nick,
ServerThread channel,
User user,
String zoneName,
String password)
Deprecated. Use ServerThread.sendBadPassword(Zone, User, String) |
protected void |
sendBuddyNotice(String buddyName,
boolean isOnline,
String roomMoniker,
String roomTitle,
GeneralUser u,
int room)
Sends a buddy notice message to the client |
void |
sendErrorReply(String source,
String error,
org.json.JSONObject result,
User u,
int room)
Deprecated. use ServerThread.sendErrorReply(String, String, JSONObject, User, int) |
void |
sendModMessage(Room room,
GeneralUser user,
String message)
Sends an (anonymous) moderator message to the user |
protected void |
sendNoSuchUser(LinkedList<ServerThread> recipients,
String nick,
String zoneName,
String password)
Deprecated. use ServerThread.sendNoSuchUser(String,String,String) |
void |
sendOops(GeneralUser u)
Deprecated. use AbstractUser.sendOops() |
void |
sendSuccessReply(String source,
org.json.JSONObject resultIn,
AbstractUser u,
int room)
Deprecated. Call AbstractUser.acceptSuccessReply(String, JSONObject, Room)
directly |
void |
sendSuccessReply(String source,
org.json.JSONObject resultIn,
AbstractUser u,
int room,
ServerThread recipient)
Deprecated. Use ServerThread.sendSuccessReply(String,JSONObject,AbstractUser,int)
instead |
(package private) void |
sendWardrobe(AbstractUser user,
Object ignored,
int room)
Send a "from:wardrobe" message to the user |
void |
setAutoJoinRoom(int id)
This is an overriding method. |
void |
setBadge(String badge,
Room room)
set a badge upon a room |
void |
setMyServer(String server)
|
String |
toString()
|
void |
trace(String string)
This is an overriding method. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static long lastCheckedZonesForSpawn
private static int NPC_TICK_INTERVAL
private static Random randomSource
static Set<AbstractZone> retiredZones
private static final long serialVersionUID
private final transient Map<String,Room> badges
private final AbstractCensor censor
protected final transient Set<String> cullRooms
private final Set<GameEvent> gameEvents
private final transient List<Room> lobbies
protected final transient Set<String> myEmptyZones
private final String myName
private String myServer
private int nextDynamicRoomNumber
private final ConcurrentHashMap<Integer,Room> roomsByID
roomsByMonikerprivate final ConcurrentHashMap<String,Room> roomsByMoniker
roomsByIDprotected boolean serverReady
private final ConcurrentSkipListSet<AbstractUser> zoneUsers
public static final Map<AbstractZone,Map<String,List<String>>> roomMaps
| Constructor Detail |
|---|
public Zone(String zoneName)
XXX the zone's censor is initialised to
FilterType.KID_CHAT. To enable
FilterType.ADULT_CHAT you'll have to overrule that on a
zone-by-zone basis right now: there is no configuration option
for that in the default SQL table layout.
zoneName - The name for the new Zone. | Method Detail |
|---|
protected static void cullAllUserRooms()
@Deprecated public static AbstractZone getByName(String zoneName)
AppiusClaudiusCaecus.getZone(java.lang.String)
zoneName - WRITEME
private static Vector<String> getDefaultGameEvents()
Get the GameEvents configured for default inclusion in all zones
XXX: contains SQL
public static int getNPCTickInterval()
public static String getRev()
public void activate()
activate in interface AbstractZoneAbstractZone.activate()public void add(AbstractUser user)
user - the user entering the zonepublic void add(Room room)
add in interface AbstractZoneroom - The room to be added.AbstractZone.add(Room)public void addGameEventByClass(String className)
className - the GameEvent class name to be loaded
public void assertStaffLevel(GeneralUser u,
int staffLevelRequired)
throws PrivilegeRequiredException
u - The Smart Fox user objectstaffLevelRequired - The staff level required to perform the
action
PrivilegeRequiredException - if the userprivate Room autoVivifyUserRoom(String string)
string - WRITEME
private void badgesChanged()
protected void buildRoomMap()
public void clearAllBadges()
AbstractZone
clearAllBadges in interface AbstractZoneAbstractZone.clearAllBadges()public void clearAllBadges(Room room)
clearAllBadges in interface AbstractZoneroom - the room upon which all badges are to be cleared
public void clearBadge(String string)
throws GameLogicException
clearBadge in interface AbstractZonestring - the badge name
GameLogicException - if the given badge wasn't set on the
room alreadypublic int compareTo(AbstractZone other)
compareTo in interface Comparable<AbstractZone>other - the other zone
protected void cullUserRooms()
public void destroy()
destroy in interface AbstractZoneAbstractZone.destroy()public void destroyRoom(Room room)
destroyRoom in interface AbstractZoneroom - WRITEMEAbstractZone.destroyRoom(Room)public boolean equals(AbstractZone z)
z - another Zone
public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public Map<String,String> getAllBadges()
private org.json.JSONObject getAllBadges_JSON()
public Set<Integer> getAllUsersIDsInZone()
getAllUsersIDsInZone in interface AbstractZonepublic Collection<AbstractUser> getAllUsersInZone()
getAllUsersInZone in interface AbstractZoneAbstractZone.getAllUsersInZone()private String getBackgroundImage()
public Set<String> getBadgesForRoom(Room room)
room - the room in question
private int getBuddiesForUser(AbstractUser user)
user - the user in question
public AbstractCensor getCensor()
AbstractZone
getCensor in interface AbstractZoneAbstractZone.getCensor()public int getDynamicRoomNumber()
public Set<GameEvent> getGameEvents()
public String getHost()
getHost in interface AbstractZonepublic int getMaxUsers()
getMaxUsers in interface AbstractZoneAbstractZone.getMaxUsers()public String getMyServer()
myServerpublic String getName()
getName in interface AbstractZoneAbstractZone.getName()public Room getNextLobby()
Get the next room which will accept an inbound user as the next lobby.
XXX: This contains Tootsville-specific code. There should instead be a room variable to indicate that a room is a lobby.
XXX: This code isn't used in Tootsville any more, anyways. Tootsville users get the map screen after logging in.
XXX: this throws out nulls anyways. BAD.
getNextLobby in interface AbstractZonepublic Room getRoom(Integer room)
getRoom in interface AbstractZoneroom - WRITEME
AbstractZone.getRoom(java.lang.Integer)
public Room getRoomByName(String moniker)
throws NotFoundException
getRoomByName in interface AbstractZonemoniker - WRITEME
NotFoundException - if the room doesn't exist (and isn't
set for autovivification)AbstractZone.getRoomByName(java.lang.String)public Collection<Room> getRoomList()
getRoomList in interface AbstractZoneAbstractZone.getRoomList()public org.json.JSONObject getRoomList_JSON()
getRoomList_JSON in interface AbstractZoneAbstractZone.getRoomList_JSON()public String getRoomListSFSXML()
getRoomListSFSXML in interface AbstractZoneAbstractZone.getRoomListSFSXML()public Map<String,List<String>> getRoomMap()
public int getRoomMaxUsers()
getRoomMaxUsers in interface AbstractZoneAbstractZone.getRoomMaxUsers()public String getURL()
getURL in interface AbstractZonepublic AbstractUser getUserByName(String buddy)
getUserByName in interface AbstractZonebuddy - WRITEME
AbstractZone.getUserByName(java.lang.String)public int getUserCount()
AbstractZone
getUserCount in interface AbstractZoneAbstractZone.getUserCount()@Deprecated public Room getUserRoom(AbstractUser user)
RoomListener.getRoom()
getUserRoom in interface AbstractZoneuser - WRITEME
AbstractZone.getUserRoom(AbstractUser)
public org.json.JSONObject getZoneData_JSON(AbstractUser user)
throws org.json.JSONException
getZoneData_JSON in interface AbstractZoneuser - the user from whose perspective we're collecting the
zone information
org.json.JSONException - if something can't be encoded in JSONpublic org.json.JSONObject getZoneList_JSON(AbstractUser user)
getZoneList_JSON in interface AbstractZoneuser - the user whose buddy list will be used to get the
buddy counts on each zone
void handleServerReady()
XXX: contains SQL
public int hashCode()
hashCode in class ObjectObject.hashCode()public void init()
XXX: contains SQL
init in interface AbstractZoneAbstractZone.init()boolean isItGood()
void loadGameEvents()
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
in - object input stream
IOException - if something bad happens
ClassNotFoundException - yeah. maybe.public void remove(AbstractUser thing)
remove in interface AbstractZonething - WRITEMEAbstractZone.remove(AbstractUser)public void remove(GameEvent ev)
ev - eventpublic void retire()
retire in interface AbstractZoneprivate void sendBadges(AbstractUser user)
user - the user to whom to send badges
@Deprecated
protected void sendBadPassword(String nick,
ServerThread channel,
User user,
String zoneName,
String password)
ServerThread.sendBadPassword(Zone, User, String)
Send the user a notification that their password was incorrect
nick - nickchannel - server threaduser - userzoneName - my namepassword - password sha1
protected void sendBuddyNotice(String buddyName,
boolean isOnline,
String roomMoniker,
String roomTitle,
GeneralUser u,
int room)
throws org.json.JSONException
Sends a buddy notice message to the client
{ from: buddyNotice, status: true,
notice: { buddy: name, online: boolean,
room: moniker, roomName: title } }
XXX doesn't belong here
buddyName - WRITEMEisOnline - WRITEMEroomMoniker - WRITEMEroomTitle - WRITEMEu - WRITEMEroom - WRITEME
org.json.JSONException - WRITEME
@Deprecated
public void sendErrorReply(String source,
String error,
org.json.JSONObject result,
User u,
int room)
throws org.json.JSONException
ServerThread.sendErrorReply(String, String, JSONObject, User, int)
send an error packet to the client.
source - The method returning the error messageerror - The error messageresult - The payload, if any. May be altered.u - The user to whom to send the success replyroom - The room in which the user is standing
org.json.JSONException - WRITEME
public void sendModMessage(Room room,
GeneralUser user,
String message)
Sends an (anonymous) moderator message to the user
room - The room the user is inuser - The user to whom to send the messagemessage - The moderator message to be sent
@Deprecated
protected void sendNoSuchUser(LinkedList<ServerThread> recipients,
String nick,
String zoneName,
String password)
ServerThread.sendNoSuchUser(String,String,String)
recipients - WRITEMEnick - WRITEMEzoneName - WRITEMEpassword - WRITEME@Deprecated public void sendOops(GeneralUser u)
AbstractUser.sendOops()
u - the user to whom we want to send the Oops message
@Deprecated
public void sendSuccessReply(String source,
org.json.JSONObject resultIn,
AbstractUser u,
int room)
AbstractUser.acceptSuccessReply(String, JSONObject, Room)
directly
source - The method returning the success messageresultIn - The payload, if any. May be altered.u - The user to whom to send the success replyroom - The room in which the user is standing
@Deprecated
public void sendSuccessReply(String source,
org.json.JSONObject resultIn,
AbstractUser u,
int room,
ServerThread recipient)
throws org.json.JSONException
ServerThread.sendSuccessReply(String,JSONObject,AbstractUser,int)
instead
source - WRITEMEresultIn - WRITEMEu - WRITEMEroom - WRITEMErecipient - WRITEME
org.json.JSONException - WRITEMEServerThread.sendSuccessReply(java.lang.String, org.json.JSONObject, org.starhope.appius.user.AbstractUser, int)
void sendWardrobe(AbstractUser user,
Object ignored,
int room)
throws org.json.JSONException
user - WRITEMEignored - Ignored parameter. Null is a good answer.room - WRITEME
org.json.JSONException - WRITEMEpublic void setAutoJoinRoom(int id)
setAutoJoinRoom in interface AbstractZoneid - WRITEMEAbstractZone.setAutoJoinRoom(int)
public void setBadge(String badge,
Room room)
setBadge in interface AbstractZonebadge - the badge to be setroom - the room upon which the badge is to be setpublic void setMyServer(String server)
server - myServerpublic String toString()
toString in class ObjectObject.toString()public void trace(String string)
trace in interface AbstractZonestring - WRITEMEAbstractZone.trace(java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||