Point System

Discussion in 'Plugin Development' started by ChintziSecilMC, Nov 24, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ChintziSecilMC

    Would it be hard to make an Points API for my plugin
    Like what id want to make is like simple methods
    * PointsAPI.getPoints()
    * PointsAPI.getPoints().equals([amount])
    * PointsAPI.setPoints(player, [amount])
    * PointsAPI.addPoints(player, [amount])

    Would it be hard to make something like that? If so how would i get started?
     
  2. Offline

    Wingzzz

    It isn't hard- depending on skill level. By the looks of it you want static methods inside of the class "PointsAPI" that act as getters/setters and a utility method for adding points.

    Assuming you have your collection(s) all setup and you've worked with methods that manipulate said collection(s), all you are left to do is make the methods static or make new static methods that call your other methods.

    It's a bit hard to give direction when there's not much information on your code. If you need any help, post whatever code you can and I'm sure people (including myself) can give you feedback as you work on it :).
     
    DukerHD likes this.
  3. Offline

    FabeGabeMC

    ChintziSecilMC
    You can create a HashMap storing the player's points. Key would be their UUID and Value would be an Integer.
    EDIT: Then save it into a config, of course.
     
  4. Offline

    Skionz

    ChintziSecilMC Ive done something exactly like this but with MySQL. If it is a small server with not many people use a config file but if you have 1000s of players in the config it will start to take a long time to iterate through it all.
     
  5. Offline

    ChintziSecilMC

    Thanks guys it works but how to keep the points system for when the server restarts cause when the server is restarter/reloaded the points reset how to i prevent that?
    @FabeGabeMC @Wingzzz @Skionz
     
  6. Offline

    mythbusterma

Thread Status:
Not open for further replies.

Share This Page