{HELP} Ranking System

Discussion in 'Plugin Development' started by The Fancy Whale, Oct 24, 2013.

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

    The Fancy Whale

    *NOTICE* I am NOT asking for a code I just need help finding the general idea so I can figure out the code on my own.

    What I am trying to do is create a ranking system. I want to make it similar to /baltop on the plugin essnetials. I want to add points to someone's account and have a command where they can see the highest ranks. Can anyone give me the gyst of what I need to do? All help is appreciated!
  2. Offline


    Store the data in SQL, then

    1. SELECT `username`, `field`
    2. FROM `yourTable`
    3. ORDER BY `field` DESC
  3. Offline

    The Fancy Whale

    Okay I will try that thanks for the advice!
  4. Offline


    You can use SQL however that requires all users of the plugin to have an SQL db available which is not many.
    A more user friendly way to do it would be to store an int for each user based on their display name and
    save/load that list using YML, then just iterate through and re-list them in order of the integer.

    Cya around,
  5. Offline

    The Fancy Whale

    So I give playernames integers and do +1 everytime they need 1 more point?
  6. Offline


    Um… ? That is not even remotely correct in regards to the SQL. Read/writing from a SQL is literally the same thing as flat file, however SQL is more robust.

    Use a SQL database, create a table, call it Ranks, and make a new row for each user. That will be your primary key if necessary. Create a column, type int, name it Rank. Then when a player joins, check if they exist in the database, if they don't create the row. If they do, grab their rank using their name as a key.

    Then create a PlayerObject that stores that variable locally in RAM on the server.

    When a player leaves, update their rank in the database.
  7. Offline


    The Fancy Whale
    I would store it on a HashMap and serialize to file because I'm too lazy to learn SQL
  8. Offline


    store xp level in config ^^ then reset it if die and keep if leave and join and make if kill players it raises little that how i did my ranking
  9. Offline

    The Fancy Whale

    It does not involve xp though

    Thats what one of my friends said that codes. Although I am going to try using another file to store everyone's data, because I tried hashmaps on a different plugin and I did not understand it at all

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 5, 2016
Thread Status:
Not open for further replies.

Share This Page