Schnittstelle CharacterProvider


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

Ungültige Referenz
format
and
Ungültige Referenz
type
. 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).

All the attachments are collected in a CharacterHandle. CharacterHandles itself belong to a

Ungültige Referenz
de.rpgframework.core.Player
and have a RoleplayingSystem 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
 }
 
  • Methodendetails

    • setListener

      void setListener(CharacterProviderListener callback)
    • getCharacter

      CharacterHandle getCharacter(String charName, RoleplayingSystem ruleSystem) throws IOException
      Return an eventually existing character - or null if it doesn't exist yet.
      Parameter:
      charName - Name of the character
      ruleSystem - 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

      CharacterHandle createCharacter(String charName, RoleplayingSystem ruleSystem) throws IOException
      Create a new CharacterHandle as a container for attachments for the local user.
      Parameter:
      charName - Name of the character
      ruleSystem - 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

      List<Attachment> listAttachments(CharacterHandle handle) throws IOException
      Get a list of attachments without loading the data
      Parameter:
      handle -
      Gibt zurück:
      Löst aus:
      IOException
    • getAttachment

      Attachment getAttachment(CharacterHandle handle, UUID id) throws IOException
      Get a specific attachment with data
      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 modify
      type - What us described in this attachment
      format - What kind of data is it
      filename - A proposed file name. May be null. May be ignored by the implementation
      data - Binary data of the attachment
      Gibt zurück:
      The created attachment
      Löst aus:
      IOException - Error executing operation
    • modifyAttachment

      void modifyAttachment(CharacterHandle handle, Attachment attach) throws IOException
      Write modifications made to this attachment to storage.
      Parameter:
      handle - Character to modify
      attach - Attachment that has been modified
      Löst aus:
      IOException
    • deleteAttachment

      void deleteAttachment(CharacterHandle handle, Attachment attach) throws IOException
      Remove an attachment from a character.
      Parameter:
      handle - Character to modify
      attach - Attachment to remove
      Löst aus:
      IOException
    • deleteCharacter

      void deleteCharacter(CharacterHandle handle) throws IOException
      Delete a character and all his attachments,
      Parameter:
      handle - Character to remove
      Löst aus:
      IOException
    • renameCharacter

      void renameCharacter(CharacterHandle handle, String newName) throws IOException
      Rename a character and all his attachments,
      Parameter:
      handle - Character to remove
      Löst aus:
      IOException
    • getMyCharacters

      List<CharacterHandle> getMyCharacters() throws IOException
      Löst aus:
      IOException
    • getMyCharacters

      List<CharacterHandle> getMyCharacters(RoleplayingSystem ruleSystem) throws IOException
      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