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 longThe first room that new characters appear in. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds anItemto the room.voidShould ONLY be used for testing!!!!booleandestroyItem(Item item) Physically destroys an item instance.booleanA person, apparently, dropped this into the room.booleanReturns items if found, otherwise returns an empty list.voidgetArea()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()inthashCode()booleanremoveAttribute(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.voidvoidsetAttribute(String name, String value) Set the value of the attribute, creates the attribute if the attribute does not exist.voidsetAttributes(Set<Roomattribute> attributes) voidsetContents(String contents) voidsetCreation(LocalDateTime creation) voidvoidvoidvoidvoidsetMaximumPoint(Position position) Sets the maximum point of a cube.voidsetMinimumPoint(Position position) Sets the minimum point of a cube.voidvoidSets the owner, the administrator, of this object.voidsetPicture(String picture) voidsetRoomCollection(Collection<Room> roomCollection) voidsetRoomCollection1(Collection<Room> roomCollection1) voidsetRoomCollection2(Collection<Room> roomCollection2) voidsetRoomCollection3(Collection<Room> roomCollection3) voidsetRoomCollection4(Collection<Room> roomCollection4) voidsetRoomCollection5(Collection<Room> roomCollection5) voidvoidvoidvoidtoString()booleanverifyAttribute(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:DisplayInterfaceThe 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:
getBodyin interfaceDisplayInterface- Returns:
-
getCreation
-
setCreation
-
getTitle
-
getMainTitle
Description copied from interface:DisplayInterfaceThe title as visible on the screen.- Specified by:
getMainTitlein interfaceDisplayInterface- Returns:
-
setTitle
-
getPicture
-
getImage
Description copied from interface:DisplayInterfaceReturns an url pointing to an image.- Specified by:
getImagein interfaceDisplayInterface- Returns:
-
setPicture
-
getOwner
-
setOwner
Description copied from interface:OwnageSets 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:ItemWranglerRetrieves a set of items that this entity has.- Specified by:
getItemsin 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:
findItemsin 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:AttributeWranglerRemoves an attribute by name.- Specified by:
removeAttributein interfaceAttributeWrangler- Parameters:
name- the name of the attribute, for example "guildwish".- Returns:
- false if not found, true if removed.
-
getAttribute
Description copied from interface:AttributeWranglerRetrieves an attribute, returns null if not found.- Specified by:
getAttributein interfaceAttributeWrangler- Parameters:
name- the name of the attribute- Returns:
- an attribute
-
setAttribute
Description copied from interface:AttributeWranglerSet the value of the attribute, creates the attribute if the attribute does not exist.- Specified by:
setAttributein interfaceAttributeWrangler- Parameters:
name- the name of the attributevalue- the value of the attribute
-
verifyAttribute
Description copied from interface:AttributeWranglerVerify if the attribute exists, and has the proper value.- Specified by:
verifyAttributein 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:ItemWranglerPhysically destroys an item instance.- Specified by:
destroyItemin 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 anItemto the room.- Specified by:
addItemin interfaceItemWrangler- Parameters:
item- the new item. May not be null.- Returns:
- the new item, null if unable to add.
-
addPerson
-