1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Making a ability?

Discussion in 'Development' started by Hoyee, Aug 3, 2020.

  1. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    I want to make a ability that can fight with players by own ability(for example, If I thouch a block, give player flame resistance effect who has the ability named fireman).
    How can I? I can't think what should I use and do.
    should I use yaml? Then, what structure should I make YAML?
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    No YAML is used for structuring data, not behaviour, just like JSON.

    The steps to take in order to proceed and succeed is per ability based. In given example you must code a plugin that listens for PlayerInteractEvent and give player the effect whenever he touches a block and has the ability. As it looks, you have no or close to little understanding about the development of plugins, is that correct?
     
    Diduhless likes this.
  3. Seeker

    Seeker Spider Jockey

    Messages:
    45
    GitHub:
    seeker-devs
    Why would you do that? Or maybe, you could create a new database.
    Idea for YAML:
    path
    Server/plugin_data/YourPlugin/[ abilities, e.g. ] Fireman | Seekerman | Dummo/PlayerName.yml

    You could use a skeleton of this idea for other db types too!
    #Method 2 (store it in existing player database)
    server/plugin_data/PlayerData/{players}.yml
    Make the abilities nested like:
    Code:
    joins: null
    kills: null
    abilities:
      - firearm
      - dumboy
    
    If you're using the built-in pm configuration method, you can make use of setNested() and getNested().
    This may consume more memory. I suggest using MySQL.
    There is a method #3 too!
    PHP:
    //code...
    public $abilities = [];
    //code
    $this->abilities["firearm"] = $playerobjectvariable;
    //now code to access and modify the array, make use of getters and setters!
     
    Primus likes this.
  4. Primus

    Primus Zombie Pigman

    Messages:
    749
    However this does not give the expected behaviour just the datum to tell if player has the ability.
     
    Seeker likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.