Give Players Points

Discussion in 'Plugin Development' started by 8thDimension, Jul 28, 2011.

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

    8thDimension

    I'm working on a plugin where players can earn points by doing certain things like mining diamond and etc. The problem is... I don't know exactly how to do something like that... How would I make it so when ever something happens, such as someone mining diamond or killing a mob, it gives them a point?

    Sorry if this is a "noob question" of any kind :3
     
  2. Offline

    nossr50

    There's a few things you need to program to make something like this work, this is a vague list as it can be programmed in many different ways.
    1. Register events like onBlockBreak and onEntityDamage
    2. Program code inside the event listeners that check for the correct conditions to hand out the 'points'
    3. Program a method for players to check their points via command or otherwise (onCommand works for this)
    4. Program storage on a player basis where the 'points' and the 'user' are being written to a file/db for persistence
    5. Program your plugin to read from said storage when players join the server so their points are persistent
    You need to learn the basics of using Java IO and the basics of playing with event listeners in Bukkit, I can get more specific if you have more specific questions. There are plenty of tutorials to help you get started with Java in the resources section of this forum.

    My plugin mcMMO stores a lot of data on a per-player basis inside a PlayerProfile datatype I've created, mcMMO is open source so feel free to look at it as an example. Pay special attention to save() and load() inside PlayerProfile.java

    You can find the link to my source code in my signature (GitRepo)
     
  3. Offline

    8thDimension

    Thanks for your help :)
    I've had a fair amount of experience developing, so I know how to do at least most of the stuff you're talking about. I'll look into the mcMMO stuff :)
     
Thread Status:
Not open for further replies.

Share This Page