Class Room
Object
Room
- All Implemented Interfaces:
Serializable
,AttributeWrangler
,DisplayInterface
,ItemWrangler
,Ownage
@Entity
public class Room
extends Object
implements Serializable, DisplayInterface, ItemWrangler, AttributeWrangler, Ownage
A room. Bear in mind that this room has potential exits to the north, south,
east, west, up and down, which are also rooms. The structure forms a kind of
graph.
- Author:
- maartenl
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
The first room that new characters appear in. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds anItem
to the room.void
Should ONLY be used for testing!!!!boolean
destroyItem
(Item item) Physically destroys an item instance.boolean
A person, apparently, dropped this into the room.boolean
Returns items if found, otherwise returns an empty list.void
getArea()
getAttribute
(String name) Retrieves an attribute, returns null if not found.retrieve the board in the room.getBody()
The body to be displayed on the screen.A description of the room.getDown()
getEast()
getId()
getImage()
Returns an url pointing to an image.getItems()
Retrieves a set of items that this entity has.The title as visible on the screen.getNorth()
getOwner()
Retrieves the owner, the administrator, of this object.Retrieves a specific person of the room, by (case-insensitive) name.getPersons
(Person excluding) Returns all persons in the room, can be bots or shopkeepers or normal players.getSouth()
getTitle()
getUp()
getWest()
int
hashCode()
boolean
removeAttribute
(String name) Removes an attribute by name.retrievePerson
(String aName) retrieve the character from the list of characters currently active in the current room.retrieveUser
(String aName) retrieve the player from the list of characters currently active in the current room.void
void
setAttribute
(String name, String value) Set the value of the attribute, creates the attribute if the attribute does not exist.void
setAttributes
(Set<Roomattribute> attributes) void
setContents
(String contents) void
setCreation
(LocalDateTime creation) void
void
void
void
void
setMaximumPoint
(Position position) Sets the maximum point of a cube.void
setMinimumPoint
(Position position) Sets the minimum point of a cube.void
void
Sets the owner, the administrator, of this object.void
setPicture
(String picture) void
setRoomCollection
(Collection<Room> roomCollection) void
setRoomCollection1
(Collection<Room> roomCollection1) void
setRoomCollection2
(Collection<Room> roomCollection2) void
setRoomCollection3
(Collection<Room> roomCollection3) void
setRoomCollection4
(Collection<Room> roomCollection4) void
setRoomCollection5
(Collection<Room> roomCollection5) void
void
void
void
toString()
boolean
verifyAttribute
(String name, String value) Verify if the attribute exists, and has the proper value.
-
Field Details
-
STARTERS_ROOM
public static final long STARTERS_ROOMThe first room that new characters appear in.- See Also:
-
-
Constructor Details
-
Room
public Room() -
Room
-
Room
-
-
Method Details
-
getId
-
setId
-
getContents
-
setContents
- Parameters:
contents
- the new description- See Also:
-
getBody
Description copied from interface:DisplayInterface
The body to be displayed on the screen. In general the first letter of the body is converted to an image on the client side.- Specified by:
getBody
in interfaceDisplayInterface
- Returns:
-
getCreation
-
setCreation
-
getTitle
-
getMainTitle
Description copied from interface:DisplayInterface
The title as visible on the screen.- Specified by:
getMainTitle
in interfaceDisplayInterface
- Returns:
-
setTitle
-
getPicture
-
getImage
Description copied from interface:DisplayInterface
Returns an url pointing to an image.- Specified by:
getImage
in interfaceDisplayInterface
- Returns:
-
setPicture
-
getOwner
-
setOwner
Description copied from interface:Ownage
Sets the owner, the administrator, of this object. -
getRoomCollection
-
setRoomCollection
-
getDown
-
setDown
-
getRoomCollection1
-
setRoomCollection1
-
getUp
-
setUp
-
getRoomCollection2
-
setRoomCollection2
-
getWest
-
setWest
-
getRoomCollection3
-
setRoomCollection3
-
getEast
-
setEast
-
getRoomCollection4
-
setRoomCollection4
-
getSouth
-
setSouth
-
getRoomCollection5
-
setRoomCollection5
-
getNorth
-
setNorth
-
getArea
-
setArea
-
getAttributes
-
setAttributes
-
getItems
Description copied from interface:ItemWrangler
Retrieves a set of items that this entity has.- Specified by:
getItems
in interfaceItemWrangler
- Returns:
- A set of items.
-
setItems
-
getMinimumPoint
- Returns:
- Returns the minimum point of a cube.
-
getMaximumPoint
- Returns:
- Returns the maximum point of a cube.
-
getCenterPoint
- Returns:
- Returns the center point of a cube. This is the point where a person can stand in the cube, if he previously didn't have any coordinates assigned but it in the room.
-
setMinimumPoint
Sets the minimum point of a cube. -
setMaximumPoint
Sets the maximum point of a cube. -
hashCode
-
equals
-
toString
-
retrievePerson
retrieve the character from the list of characters currently active in the current room.- Parameters:
aName
- name of the character to search for. Case matters not.- Returns:
- Character/Person in the room. Will return null pointer if character not found.
- See Also:
-
retrieveUser
retrieve the player from the list of characters currently active in the current room.- Parameters:
aName
- name of the player to search for.- Returns:
- Player in the room. Will return null pointer if character not found or character is not a "real" player.
- See Also:
-
getBoard
-
findItems
Returns items if found, otherwise returns an empty list.- Specified by:
findItems
in interfaceItemWrangler
- Parameters:
parsed
- the parsed description of the item as given by the user, for example {"light-green", "leather", "pants"}.- Returns:
- list of found items, empty if not found.
-
removeAttribute
Description copied from interface:AttributeWrangler
Removes an attribute by name.- Specified by:
removeAttribute
in interfaceAttributeWrangler
- Parameters:
name
- the name of the attribute, for example "guildwish".- Returns:
- false if not found, true if removed.
-
getAttribute
Description copied from interface:AttributeWrangler
Retrieves an attribute, returns null if not found.- Specified by:
getAttribute
in interfaceAttributeWrangler
- Parameters:
name
- the name of the attribute- Returns:
- an attribute
-
setAttribute
Description copied from interface:AttributeWrangler
Set the value of the attribute, creates the attribute if the attribute does not exist.- Specified by:
setAttribute
in interfaceAttributeWrangler
- Parameters:
name
- the name of the attributevalue
- the value of the attribute
-
verifyAttribute
Description copied from interface:AttributeWrangler
Verify if the attribute exists, and has the proper value.- Specified by:
verifyAttribute
in interfaceAttributeWrangler
- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- true if it exists, false otherwise.
-
destroyItem
Description copied from interface:ItemWrangler
Physically destroys an item instance.- Specified by:
destroyItem
in interfaceItemWrangler
- Parameters:
item
- the item to be destroyed- Returns:
- returns true, if the item was found and destroyed. False if the item was not found.
-
drop
A person, apparently, dropped this into the room.- Parameters:
item
- the item he dropped.- Returns:
- boolean, true if it was added, false otherwise.
-
get
-
getPersons
-
getPerson
-
addItem
Adds anItem
to the room.- Specified by:
addItem
in interfaceItemWrangler
- Parameters:
item
- the new item. May not be null.- Returns:
- the new item, null if unable to add.
-
addPerson
-