Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## it.gotoandplay.smartfoxserver.data
Class User

    java.lang.Object
      it.gotoandplay.smartfoxserver.data.User

    public class User

extends java.lang.Object

User Class

Author:
  (c) 2004-2007 gotoAndPlay() -- www.gotoandplay.it

Field Summary
`int` | `badwordsWarningCounter`
`java.util.Map<java.lang.String,java.lang.String>` | `buddyVariables`
`int` | `floodCounter`
`int` | `floodWarningsCounter`
`boolean` | `isBeingKicked`
`boolean` | `isPlayer`
`java.lang.String` | `lastMessage`
`int` | `playerIndex`
`java.util.Map` | `properties` A map of custom properties objects.
`int` | `repeatedMsgCounter`

Constructor Summary
`User(java.nio.channels.SocketChannel channel, java.lang.String name, java.lang.String zone)` Default constructor

Method Summary
`void` | `addCreatedRoom(Room r)`
`void` | `addRoom(Room r)`
`boolean` | `buddyListChanged()`
`void` | `deleteVariable(java.lang.String name)`
`void` | `exitAllRooms()`
`java.lang.String` | `getBlueBoxSessionId()`
`java.nio.channels.SocketChannel` | `getChannel()`
`long` | `getDroppedPackets()` Return the number of dropped packets
`java.lang.String` | `getIpAddress()`
`long` | `getLastMessageTime()`
`long` | `getLoginTime()`
`java.lang.String` | `getName()`
`int` | `getPlayerIndex()`
`int` | `getPlayerIndex(Room r)`
`int` | `getPrivilege()`
`int` | `getRoom()`
`int[]` | `getRoomsConnected()`
`int` | `getRoomsConnectedCount()`
`int` | `getRoomsCreatedCount()`
`int` | `getUserId()`
`UserVariable` | `getVariable(java.lang.String varName)` Get a User Variable
`java.util.LinkedList` | `getVariableNames()`
`java.util.HashMap` | `getVariables()`
`java.lang.String` | `getXmlVarList()`
`java.lang.String` | `getZone()`
`void` | `increaseDroppedPackets()`
`void` | `initUser()`
`boolean` | `isAdmin()`
`boolean` | `isBlueBoxed()`
`boolean` | `isBusyForChallenge()`
`boolean` | `isBusyForPlay()`
`boolean` | `isInRoom(int roomId)` Return if the user is currently joined in the room
`boolean` | `isMarkedForRemoval()`
`boolean` | `isModerator()`
`boolean` | `isSpectator()`
`void` | `removeCreatedRoom(Room r)`
`void` | `removeRoom(Room r)`
`static void` | `resetUserStaticData()` Reset the autoId when the server is restarted
`void` | `setAsAdmin()` Set the user as Admin
`void` | `setAsModerator()` Set the user as a moderator
`void` | `setAsModerator(boolean b)` Set the moderator flag
`void` | `setBuddyListChanged()`
`void` | `setBuddyListSaved()`
`void` | `setBusyForChallenge(boolean status)`
`void` | `setIsBusyForPlay(boolean status)`
`void` | `setMarkedForRemoval(boolean b)`
`void` | `setPlayerIndex(Room r, int id)`
`void` | `setPrivilege(int p)`
`boolean` | `setVariable(java.lang.String vn, java.lang.String vv, java.lang.String vt)`
`void` | `updateMessageTime()` Update the last message time

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### isPlayer

    public boolean isPlayer

### isBeingKicked

    public boolean isBeingKicked

### playerIndex

    public int playerIndex

### floodCounter

    public int floodCounter

### repeatedMsgCounter

    public int repeatedMsgCounter

### floodWarningsCounter

    public int floodWarningsCounter

### badwordsWarningCounter

    public int badwordsWarningCounter

### lastMessage

    public java.lang.String lastMessage

### properties

    public java.util.Map properties

  A map of custom properties objects.

  Before version 1.6: by default it was a java.util.HashMap

  Since version 1.6.x and higher: you can now specify your favorite java.util.Map implementation, using the <DynamicPropertiesClass> tag in the main config.xml file.
  For example you could use a java.util.concurrent.ConcurrentHashMap class instead.

### buddyVariables

    public java.util.Map<java.lang.String,java.lang.String> buddyVariables

Constructor Detail

### User

    public User(java.nio.channels.SocketChannel channel,
                java.lang.String name,
                java.lang.String zone)

  Default constructor

  Parameters:
    `channel` - SocketChannel of the client
    `name` - user name
    `zone` - the initial zone

Method Detail

### initUser

    public void initUser()

### getDroppedPackets

    public long getDroppedPackets()

  Return the number of dropped packets

  Returns:
    the number of dropped packets
  Since:
    1.5.9

### increaseDroppedPackets

    public void increaseDroppedPackets()

### buddyListChanged

    public boolean buddyListChanged()

### setBuddyListChanged

    public void setBuddyListChanged()

### setBuddyListSaved

    public void setBuddyListSaved()

### isSpectator

    public boolean isSpectator()

  Returns:
    true if the user is a spectator (for game rooms)

### setPlayerIndex

    public void setPlayerIndex(Room r,
                               int id)

### getPlayerIndex

    public int getPlayerIndex()

  Returns:
    the player index

### getPlayerIndex

    public int getPlayerIndex(Room r)

  Returns:
    the player index for the user inside the Room r
    if -1 is returned the playerIndex does not exist
    if 0 is returned the room is not a game room
    A valid playerIndex is always > 0

### exitAllRooms

    public void exitAllRooms()

### addRoom

    public void addRoom(Room r)

### getRoomsConnected

    public int[] getRoomsConnected()

  Returns:
    an array of room indexes where the user is joined

### getRoomsConnectedCount

    public int getRoomsConnectedCount()

  Returns:
    the number of rooms where the user is connected

### getRoomsCreatedCount

    public int getRoomsCreatedCount()

  Returns:
    the number of active rooms created by the user

### getRoom

    public int getRoom()

### setPrivilege

    public void setPrivilege(int p)

### getPrivilege

    public int getPrivilege()

### isModerator

    public boolean isModerator()

  Returns:
    true if the user is moderator

### setAsModerator

    public void setAsModerator()

  Set the user as a moderator

### setAsModerator

    public void setAsModerator(boolean b)

  Set the moderator flag

  Parameters:
    `b` - the status
  Since:
    version 1.4.0beta 4

### isAdmin

    public boolean isAdmin()

  Returns:
    true if the user is Admin

### setAsAdmin

    public void setAsAdmin()

  Set the user as Admin

### removeRoom

    public void removeRoom(Room r)

### addCreatedRoom

    public void addCreatedRoom(Room r)

### removeCreatedRoom

    public void removeCreatedRoom(Room r)

### getUserId

    public int getUserId()

  Returns:
    the user id

### getChannel

    public java.nio.channels.SocketChannel getChannel()

  Returns:
    the SocketChannel of the user

### getName

    public java.lang.String getName()

  Returns:
    the user name

### getZone

    public java.lang.String getZone()

  Returns:
    the zone name

### getLastMessageTime

    public long getLastMessageTime()

  Returns:
    the last message time expressed in Unix time

### getLoginTime

    public long getLoginTime()

  Returns:
    the login time (Unix time format)

### updateMessageTime

    public void updateMessageTime()

  Update the last message time

### setVariable

    public boolean setVariable(java.lang.String vn,
                               java.lang.String vv,
                               java.lang.String vt)

### deleteVariable

    public void deleteVariable(java.lang.String name)

### isBusyForChallenge

    public boolean isBusyForChallenge()

### setBusyForChallenge

    public void setBusyForChallenge(boolean status)

### isBusyForPlay

    public boolean isBusyForPlay()

### setIsBusyForPlay

    public void setIsBusyForPlay(boolean status)

### getXmlVarList

    public java.lang.String getXmlVarList()

### getVariable

    public UserVariable getVariable(java.lang.String varName)

  Get a User Variable

  Parameters:
    `varName` -
  Returns:
    the UserVariable

### getVariables

    public java.util.HashMap getVariables()

  Returns:
    a HashMap of UserVariables with the name as the key

### getVariableNames

    public java.util.LinkedList getVariableNames()

  Returns:
    a list of UserVariables names

### getIpAddress

    public java.lang.String getIpAddress()

  Returns:
    the ip address of the client

### resetUserStaticData

    public static void resetUserStaticData()

  Reset the autoId when the server is restarted

### isInRoom

    public boolean isInRoom(int roomId)

  Return if the user is currently joined in the room

  Parameters:
    `roomId` - the id of the room
  Returns:
    true if the user is joined in the specified room, false otherwise

### isMarkedForRemoval

    public boolean isMarkedForRemoval()

### setMarkedForRemoval

    public void setMarkedForRemoval(boolean b)

### isBlueBoxed

    public boolean isBlueBoxed()

  Returns:
    true if the user is connected via the BlueBox
  Since:
    1.6.0

### getBlueBoxSessionId

    public java.lang.String getBlueBoxSessionId()

  Returns:
    the sessionID of the BlueBox connection
  Since:
    1.6.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD