GamePlayer

Jan 12, 2018
GamePlayer
  • ArcadeBoard API - GamePlayer


    Introduction(top)

    A 'GamePlayer' is a player that uses ArcadeBoard. It is an encapsulation of a normal player, but with more features. It is used internally as a way to keep track of players that are playing a game, but can be used as developers to get specific information about other games (or your game) and store them in the database the player has configured.

    Persistent Game storage(top)

    The GamePlayer API offers a way for games to store data in a "key" "value" method. This means that you can give a key of your choice to store data. For example: "killed puppies"=3.


    On top of that, there is a statistic API that allows you to specifically store statistics. Internally this uses the same key/value storage method. This allows external developers to get specific information from your game without having to understand what it actual stores.

    storeGameData(top)

    This stores a key/value pair of a player for your game.
    It takes 4 arguments: The Game (GameInformation is a downcasted instance of your Game instance), the player you are saving the data to, and the key/value pair.

    getGameData(top)

    This gets a stored key/value pair of a player by its key.

    storeStatistic(top)

    This stores a statistic of a given type. Available types are "BEST_SCORE", "VICTORIES", "DEFEATS".
    When using this you immediately provide your game with placeholders for MVdWPlaceholderAPI.
    The placeholders would be:
    {arcadeboard_<YOURGAMENAME>_statistic_<STATISTIC TYPE>}
    So if your game is called "DonkeyKong" and you store the BEST_SCORE, then the placeholder would be:
    {arcadeboard_donkeykong_statistic_best_score}

    Resource pack control(top)

    The plugin and API try to make it as easy for a developer to add resource packs for their game as possible. You do not have to worry about knowing if a player has a resource pack or not, the API comes with a set of helpful methods.

    Please read the API documentations about resource packs first!

    getEnabledResourcePacks(top)

    Returns a list of enabled resource packs

    hasResourcePackEnabled(top)

    Checks if the user has a resource pack enabled.

    setResourcePack(top)

    Sets the resource pack of a user. The user still has time to accept/reject this. Use the "hasResourcePackEnabled" method to check if the user installed it successfully.

    Music/Sound control(top)

    You can play resource pack songs or note block songs (NBS files) through the API.

    Please read the API documentations about resource packs and music first!
  • Loading...
  • Loading...