it.gotoandplay.smartfoxserver.data
Class Zone

java.lang.Object
  extended by it.gotoandplay.smartfoxserver.data.Zone

public class Zone
extends java.lang.Object

Zone Class

Version:
1.5

Field Summary
 it.gotoandplay.smartfoxserver.db.DbManager dbManager
          the database manager object
 it.gotoandplay.smartfoxserver.data.ModeratorManager modManager
           
 java.lang.String roomNameAvoidChars
           
static int STATUS_ACTIVE
           
static int STATUS_INACTIVE
           
 java.lang.String userNameAvoidChars
           
 
Constructor Summary
Zone(java.lang.String name, java.lang.String customLogin)
          Default constructor
 
Method Summary
 void activate()
           
 void addBuddy(java.lang.String owner, java.lang.String buddyName)
           
 void addDisabledEvent(java.lang.String evt)
          Add a new event in the disable sysHandler map
 void addDisabledSysAction(java.lang.String action)
          Adds a new SysHandler to be disabled for this zone
 void addName(java.lang.String name, java.lang.Integer uid)
           
 void addRoom(Room rm)
           
 boolean checkBuddy(java.lang.String name)
           
 void clearAllExtensions()
           
 void clearBuddyList(java.lang.String owner)
           
 void clearDisabledEvents()
          Clear the list of disable sysHandler events
 void clearDisabledSysActions()
          Clear all disabled sysHandler actions
 void deactivate()
           
 void destroyVariables(User u)
           
 java.util.LinkedList getAllUsersInZone()
           
 int getAutoJoinRoom()
           
 it.gotoandplay.smartfoxserver.data.BuddyListManager getBuddyManager()
          Return the BuddyListManager for this zone
 java.nio.channels.SocketChannel getChannelFromName(java.lang.String name)
           
 java.util.LinkedList getChannelList()
           
 boolean getCountUpdate()
           
 boolean getEmptyNames()
           
 it.gotoandplay.smartfoxserver.extensions.ExtensionManager getExtManager()
           
 it.gotoandplay.smartfoxserver.data.ignorelist.IIgnoreListManager getIgnoreListManager()
           
 int getMaxRoomNameLen()
           
 int getMaxRooms()
           
 int getMaxRoomsPerUser()
          Get the maximum number of rooms that can be created by a single user
 int getMaxUserNameLen()
           
 int getMaxUsers()
           
 java.lang.String getName()
           
 Room getRoom(int roomId)
          Return a room object from this zone
 Room getRoomByName(java.lang.String name)
          Find a room from its name
 int getRoomCount()
           
 java.util.LinkedList getRoomList()
           
 java.lang.Object[] getRooms()
           
 boolean getRoomUpdates()
           
 int getStatus()
           
 int getUserCount()
          New since version 1.4.0 no need to use the above code.
 java.util.List getUserList()
          Get the full list of users connected to this zone
 boolean getVarsOnRoomList()
           
 java.lang.String getXmlBuddy(java.lang.String name)
           
 boolean hasBuddyList()
           
 boolean hasCustomLogin()
           
 void initBuddyList(int listLength)
           
 boolean isActive()
           
 boolean isAutoReloadExtensions()
           
 boolean isEventDisabled(java.lang.String evt)
          Checks if a certain event is disabled Event names are kep all lowercase to avoid case sensitiveness problems
 boolean isPrivMsgInternalEventEnabled()
          Get the status of the PrivMsg internal event
 boolean isPubMsgInternalEventEnabled()
          Get the status of the PubMsg internal event
 boolean isSysActionDisabled(java.lang.String action)
          Tells if a certain SysHandler action is active or not
 boolean isThereRoom()
           
 java.util.LinkedList loadBuddyList(java.lang.String uName)
           
 boolean removeBuddy(java.lang.String owner, java.lang.String buddyName)
           
 void removeName(java.lang.String name, User u)
           
 void removeRoom(Room rm, boolean exitingAllRooms)
           
 boolean roomNameAlreadyExist(java.lang.String roomName)
           
 void saveAllBuddyLists()
           
 void saveBuddyList(java.lang.String name)
           
 void setAutoJoinRoom(int roomId)
          Set the id of the auto-join room
 void setAutoReloadExtensions(boolean autoReloadExtensions)
           
 void setCountUpdate(boolean b)
           
 void setEmptyNames(boolean b)
           
 void setIgnoreListManager(it.gotoandplay.smartfoxserver.data.ignorelist.IIgnoreListManager ignoreListManager)
           
 void setMaxRoomNameLen(int maxRoomNameLen)
           
 void setMaxRooms(int i)
           
 void setMaxRoomsPerUser(int m)
          Set the maximum number of rooms that can be created by a single user
 void setMaxUserNameLen(int maxUserNameLen)
           
 void setMaxUsers(int i)
           
 void setPrivMsgInternalEvent(boolean b)
          Enable / Disable "privMsg" events in extensions
 void setPubMsgInternalEvent(boolean b)
          Enable / Disable "pubMsg" events in extensions
 void setRoomUpdates(boolean b)
           
 void setVarsOnRoomList(boolean b)
           
 boolean validateUserName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_ACTIVE

public static final int STATUS_ACTIVE
See Also:
Constant Field Values

STATUS_INACTIVE

public static final int STATUS_INACTIVE
See Also:
Constant Field Values

userNameAvoidChars

public java.lang.String userNameAvoidChars

roomNameAvoidChars

public java.lang.String roomNameAvoidChars

modManager

public it.gotoandplay.smartfoxserver.data.ModeratorManager modManager

dbManager

public it.gotoandplay.smartfoxserver.db.DbManager dbManager
the database manager object

See Also:
DbManager
Constructor Detail

Zone

public Zone(java.lang.String name,
            java.lang.String customLogin)
Default constructor

Parameters:
name - zone name
customLogin - true if the Zone handles the login process with a server side extension
Method Detail

addDisabledEvent

public void addDisabledEvent(java.lang.String evt)
Add a new event in the disable sysHandler map

Parameters:
evt - the event name
Since:
version 1.4.0b3

isEventDisabled

public boolean isEventDisabled(java.lang.String evt)
Checks if a certain event is disabled Event names are kep all lowercase to avoid case sensitiveness problems

Parameters:
evt - the event name
Returns:
true if event is disabled
Since:
version 1.4.0b3

clearDisabledEvents

public void clearDisabledEvents()
Clear the list of disable sysHandler events

Since:
version 1.4.0b3

addDisabledSysAction

public void addDisabledSysAction(java.lang.String action)
Adds a new SysHandler to be disabled for this zone

Parameters:
action - the name of the action

isSysActionDisabled

public boolean isSysActionDisabled(java.lang.String action)
Tells if a certain SysHandler action is active or not

Parameters:
action - the action name
Returns:
true if the action is disabled

clearDisabledSysActions

public void clearDisabledSysActions()
Clear all disabled sysHandler actions


isPubMsgInternalEventEnabled

public boolean isPubMsgInternalEventEnabled()
Get the status of the PubMsg internal event

Returns:
the status of the "PubMsg" internal event

setPubMsgInternalEvent

public void setPubMsgInternalEvent(boolean b)
Enable / Disable "pubMsg" events in extensions

Parameters:
b -

isPrivMsgInternalEventEnabled

public boolean isPrivMsgInternalEventEnabled()
Get the status of the PrivMsg internal event

Returns:
the status of the "PrivMsg" internal event

setPrivMsgInternalEvent

public void setPrivMsgInternalEvent(boolean b)
Enable / Disable "privMsg" events in extensions

Parameters:
b -

getName

public java.lang.String getName()
Returns:
the zone name

hasCustomLogin

public boolean hasCustomLogin()
Returns:
true if this zone has custom login extension handler

getStatus

public int getStatus()
Returns:
the status of the current zone

getVarsOnRoomList

public boolean getVarsOnRoomList()
Returns:
the status of the roomListVars flag

setVarsOnRoomList

public void setVarsOnRoomList(boolean b)
Parameters:
b - set the status of roomListVars flag

getRoomUpdates

public boolean getRoomUpdates()

setRoomUpdates

public void setRoomUpdates(boolean b)

getExtManager

public it.gotoandplay.smartfoxserver.extensions.ExtensionManager getExtManager()

getBuddyManager

public it.gotoandplay.smartfoxserver.data.BuddyListManager getBuddyManager()
Return the BuddyListManager for this zone

Returns:
the buddy list manager object

isActive

public boolean isActive()
Returns:
true if the current zone is active

getMaxRoomsPerUser

public int getMaxRoomsPerUser()
Get the maximum number of rooms that can be created by a single user

Returns:
the max number of rooms

setMaxRoomsPerUser

public void setMaxRoomsPerUser(int m)
Set the maximum number of rooms that can be created by a single user

Parameters:
m -

validateUserName

public boolean validateUserName(java.lang.String name)

addName

public void addName(java.lang.String name,
                    java.lang.Integer uid)

removeName

public void removeName(java.lang.String name,
                       User u)

destroyVariables

public void destroyVariables(User u)

clearAllExtensions

public void clearAllExtensions()

getChannelFromName

public java.nio.channels.SocketChannel getChannelFromName(java.lang.String name)

addRoom

public void addRoom(Room rm)
             throws it.gotoandplay.smartfoxserver.exceptions.CreateRoomException
Throws:
it.gotoandplay.smartfoxserver.exceptions.CreateRoomException

removeRoom

public void removeRoom(Room rm,
                       boolean exitingAllRooms)

deactivate

public void deactivate()

activate

public void activate()

setAutoJoinRoom

public void setAutoJoinRoom(int roomId)
Set the id of the auto-join room

Parameters:
roomId - the room id

getAutoJoinRoom

public int getAutoJoinRoom()
Returns:
the id of the autojoin room

getRoom

public Room getRoom(int roomId)
Return a room object from this zone


getRoomByName

public Room getRoomByName(java.lang.String name)
Find a room from its name

Parameters:
name - the room name
Returns:
the Room object

getRoomList

public java.util.LinkedList getRoomList()
Returns:
a list of rooms inside the Zone

getRooms

public java.lang.Object[] getRooms()

roomNameAlreadyExist

public boolean roomNameAlreadyExist(java.lang.String roomName)

getRoomCount

public int getRoomCount()
Returns:
the number of rooms

getUserCount

public int getUserCount()
New since version 1.4.0 no need to use the above code. The # of users in the Zone is determined by the size of userNames which represents the unique clients logged in


isThereRoom

public boolean isThereRoom()

getAllUsersInZone

public java.util.LinkedList getAllUsersInZone()
Returns:
a list with all SocketChannels in the Zone, but excludes users in game rooms

getChannelList

public java.util.LinkedList getChannelList()
Returns:
a list with all SocketChannels in the Zone

getUserList

public java.util.List getUserList()
Get the full list of users connected to this zone

Returns:
the List of users

hasBuddyList

public boolean hasBuddyList()
Returns:
true if the Zone has an active buddy list

initBuddyList

public void initBuddyList(int listLength)

addBuddy

public void addBuddy(java.lang.String owner,
                     java.lang.String buddyName)
              throws it.gotoandplay.smartfoxserver.exceptions.BuddyListException
Throws:
it.gotoandplay.smartfoxserver.exceptions.BuddyListException

removeBuddy

public boolean removeBuddy(java.lang.String owner,
                           java.lang.String buddyName)

loadBuddyList

public java.util.LinkedList loadBuddyList(java.lang.String uName)
                                   throws it.gotoandplay.smartfoxserver.exceptions.BuddyListException
Throws:
it.gotoandplay.smartfoxserver.exceptions.BuddyListException

saveBuddyList

public void saveBuddyList(java.lang.String name)

saveAllBuddyLists

public void saveAllBuddyLists()

clearBuddyList

public void clearBuddyList(java.lang.String owner)

checkBuddy

public boolean checkBuddy(java.lang.String name)

getXmlBuddy

public java.lang.String getXmlBuddy(java.lang.String name)

getCountUpdate

public boolean getCountUpdate()

setCountUpdate

public void setCountUpdate(boolean b)

getMaxUsers

public int getMaxUsers()

setMaxUsers

public void setMaxUsers(int i)

getMaxRooms

public int getMaxRooms()

setMaxRooms

public void setMaxRooms(int i)

setEmptyNames

public void setEmptyNames(boolean b)

getEmptyNames

public boolean getEmptyNames()

getMaxRoomNameLen

public int getMaxRoomNameLen()
Returns:
Returns the maxRoomNameLen.

setMaxRoomNameLen

public void setMaxRoomNameLen(int maxRoomNameLen)
Parameters:
maxRoomNameLen - The maxRoomNameLen to set.

getMaxUserNameLen

public int getMaxUserNameLen()
Returns:
Returns the maxUserNameLen.

setMaxUserNameLen

public void setMaxUserNameLen(int maxUserNameLen)
Parameters:
maxUserNameLen - The maxUserNameLen to set.

isAutoReloadExtensions

public boolean isAutoReloadExtensions()
Returns:
the autoReloadExtensions

getIgnoreListManager

public it.gotoandplay.smartfoxserver.data.ignorelist.IIgnoreListManager getIgnoreListManager()

setIgnoreListManager

public void setIgnoreListManager(it.gotoandplay.smartfoxserver.data.ignorelist.IIgnoreListManager ignoreListManager)

setAutoReloadExtensions

public void setAutoReloadExtensions(boolean autoReloadExtensions)
Parameters:
autoReloadExtensions - the autoReloadExtensions to set