public interface CharacterProvider
This interface controls the storage of character related documents. The
basic concept is that each character can have attachments of a specific
and
Ungültige Referenz
format
.
Examples for those attachments may be portrait image (type CHARACTER, format IMAGE)
serialized character data (type CHARACTER, format RULESPECIFIC) or a
background story (type BACKGROUND, format PDF).Ungültige Referenz
type
All the attachments are collected in a CharacterHandle.
CharacterHandles itself belong to a
and
have a Ungültige Referenz
de.rpgframework.core.PlayerRoleplayingSystem assigned.
// Get the player that represents yourself
Player myself = RPGFrameworkLoader.getInstance().getPlayerService().getMyself();
// Obtain an instance of the character provider ...
CharacterProvider charProv = RPGFrameworkLoader.getInstance().getCharacterProvider();
// Obtain an instance of the character provider ...
for (CharacterHandle handle : charProv.getCharacters(myself)) {
// ... do something
}
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungaddAttachment(CharacterHandle handle, Attachment.Type type, Attachment.Format format, String filename, byte[] data) Adding an attachment to a character.createCharacter(String charName, RoleplayingSystem ruleSystem) Create a new CharacterHandle as a container for attachments for the local user.voiddeleteAttachment(CharacterHandle handle, Attachment attach) Remove an attachment from a character.voiddeleteCharacter(CharacterHandle handle) Delete a character and all his attachments,getCharacter(String charName, RoleplayingSystem ruleSystem) Return an eventually existing character - or null if it doesn't exist yet.getFirstAttachment(CharacterHandle handle, Attachment.Type type, Attachment.Format format) Get a specific attachment with datagetMyCharacters(RoleplayingSystem ruleSystem) Get all characters of a given player belonging to a specific roleplaying system.voidbooleanlistAttachments(CharacterHandle handle) Get a list of attachments without loading the datavoidmodifyAttachment(CharacterHandle handle, Attachment attach) Write modifications made to this attachment to storage.voidrenameCharacter(CharacterHandle handle, String newName) Rename a character and all his attachments,voidsetListener(CharacterProviderListener callback)
-
Methodendetails
-
setListener
-
getCharacter
Return an eventually existing character - or null if it doesn't exist yet.- Parameter:
charName- Name of the characterruleSystem- The roleplaying system of the character- Gibt zurück:
- The created handle
- Löst aus:
IOException- Error executing operation - e.g. on directory creation or missing internet connection
-
createCharacter
Create a new CharacterHandle as a container for attachments for the local user.- Parameter:
charName- Name of the characterruleSystem- The roleplaying system of the character- Gibt zurück:
- The created handle
- Löst aus:
IOException- Error executing operation - e.g. on directory creation or missing internet connection
-
listAttachments
Get a list of attachments without loading the data- Parameter:
handle-- Gibt zurück:
- Löst aus:
IOException
-
getFirstAttachment
Attachment getFirstAttachment(CharacterHandle handle, Attachment.Type type, Attachment.Format format) throws IOException Get a specific attachment with data- Löst aus:
IOException
-
addAttachment
Attachment addAttachment(CharacterHandle handle, Attachment.Type type, Attachment.Format format, String filename, byte[] data) throws IOException Adding an attachment to a character. Though the primary focus of this method is adding attachments only to characters of the local player, it may also be used for characters of other players as well. If this works is implementation dependant. How many instances (per format) of attachments are allowed, depends on the type: CHARACTER and BACKGROUND may only exist once, while REPORT may exist multiple times.- Parameter:
handle- Character to modifytype- What us described in this attachmentformat- What kind of data is itfilename- A proposed file name. May be null. May be ignored by the implementationdata- Binary data of the attachment- Gibt zurück:
- The created attachment
- Löst aus:
IOException- Error executing operation
-
modifyAttachment
Write modifications made to this attachment to storage.- Parameter:
handle- Character to modifyattach- Attachment that has been modified- Löst aus:
IOException
-
deleteAttachment
Remove an attachment from a character.- Parameter:
handle- Character to modifyattach- Attachment to remove- Löst aus:
IOException
-
deleteCharacter
Delete a character and all his attachments,- Parameter:
handle- Character to remove- Löst aus:
IOException
-
renameCharacter
Rename a character and all his attachments,- Parameter:
handle- Character to remove- Löst aus:
IOException
-
getMyCharacters
- Löst aus:
IOException
-
getMyCharacters
Get all characters of a given player belonging to a specific roleplaying system.- Parameter:
ruleSystem- Roleplaying system to get characters for.player- Player to get characters from- Gibt zurück:
- A list of characters in no granted order.
- Löst aus:
IOException
-
isSynchronizeSupported
boolean isSynchronizeSupported() -
initiateCharacterSynchronization
void initiateCharacterSynchronization()
-