org.frogx.service.api
Interface MUGOccupant


public interface MUGOccupant

A Multi-User Gaming occupant represents an user who is associated with a game room. It handles information about this user such as the presence status, affiliation, nickname or real JID and provides the utility to send him a Packet.

Author:
Günther Nieß

Nested Class Summary
static class MUGOccupant.Affiliation
          The Affiliation represents the authorization of an MUGOccupant.
 
Method Summary
 void changeNickname(java.lang.String nickname)
          Set a new nickname for the occupants attributes.
 void destroy()
          Called when the occupant is leaving the game room, to clean things up.
 MUGOccupant.Affiliation getAffiliation()
          Get the MUGOccupant.Affiliation of this occupant.
 MUGRoom getGameRoom()
          Get the MUGRoom associated with this occupant.
 java.lang.String getNickname()
          Get the nickname of this occupant.
 org.xmpp.packet.Presence getPresence()
          Obtain the actual presence information for this occupant including information about his affiliation and game role.
 java.lang.String getRoleName()
          Get the name of the role which this occupant is reserved.
 org.xmpp.packet.JID getRoomAddress()
          Obtain the JID representing this occupant in a room.
 org.xmpp.packet.JID getUserAddress()
          Get the real JID of this occupant.
 boolean hasRole()
          Return true if the occupant has a game role and therefore is a player in the match.
 void send(org.xmpp.packet.Packet packet)
          Sends a packet to the occupant.
 void setPresence(org.xmpp.packet.Presence presence)
          Sets a new presence information for the occupant.
 

Method Detail

getNickname

java.lang.String getNickname()
Get the nickname of this occupant.

Returns:
The nickname of this occupant.

changeNickname

void changeNickname(java.lang.String nickname)
Set a new nickname for the occupants attributes.
Note: A MUGRoom manage its occupants and therefore use MUGRoom.changeNickname(String, String, Presence) to ensure the room handles the occupant with the new nickname correctly.

Parameters:
nickname - The new nickname which should be used.

getRoomAddress

org.xmpp.packet.JID getRoomAddress()
Obtain the JID representing this occupant in a room. The Jabber ID has the form: room@service/nickname.

Returns:
The Jabber ID that represents this occupant in the room.

getUserAddress

org.xmpp.packet.JID getUserAddress()
Get the real JID of this occupant. The real Jabber ID is the account on which this user is signed on.

Returns:
The Jabber ID of the user.

setPresence

void setPresence(org.xmpp.packet.Presence presence)
Sets a new presence information for the occupant.
Note: This doesn't include to announce the new presence in the room.

Parameters:
presence - The new presence for the occupant.

getPresence

org.xmpp.packet.Presence getPresence()
Obtain the actual presence information for this occupant including information about his affiliation and game role.

Returns:
The current presence.

getAffiliation

MUGOccupant.Affiliation getAffiliation()
Get the MUGOccupant.Affiliation of this occupant. The affiliation represents the authorization.

Returns:
The affiliation of this occupant.

hasRole

boolean hasRole()
Return true if the occupant has a game role and therefore is a player in the match. It returns false if the occupant is a spectator.

Returns:
True if the occupant is a player or false otherwise.

getRoleName

java.lang.String getRoleName()
Get the name of the role which this occupant is reserved.

Returns:
The name of the occupants role.

getGameRoom

MUGRoom getGameRoom()
Get the MUGRoom associated with this occupant. Each occupant object represents one participant in one game room.

Returns:
The game room which this occupant is participating.

send

void send(org.xmpp.packet.Packet packet)
          throws org.xmpp.component.ComponentException
Sends a packet to the occupant.

Parameters:
packet - The packet to send.
Throws:
org.xmpp.component.ComponentException

destroy

void destroy()
Called when the occupant is leaving the game room, to clean things up.



Copyright © 2009. All Rights Reserved.