How to reward players

Discussion in 'Plugin Development' started by Lellz, Nov 7, 2011.

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

    Lellz

    Hey i have been working on plugin and spent weeks reading tutorials and going through code, used c++, c# and vb.net, but just started java, i was wondering, inside the entitykillbyentityevent(i know all that getDamager stuff), just how to assign a reward to particular player, what would the the code look like, i don't like how complicated iconomy is, so i'm trying to assign a mob reward, then if i feel good, a simplified towny for just claiming chunks and inviting people, thats it
    thanks if you can help(please dont' shut me down :p)
     
  2. Offline

    randomman159

    Just wait what? Is this a coding question or a general concept question? I don't follow...

    Well if your after a concept...
    If you want a simple economy, you could make your own, storing money amounts in a yaml, and adding a few commands... And for claiming chunks you could have a yaml containing claimed chunks and let them either only build in claimed chunks, or build if the chunk is not claimed (or claimed by them).
     
  3. Offline

    Lellz

    yeah sorry i'm confused aswell, Tell me this, what is required for these type of plugins, like in simplest form(i know it still wont be) i just want to know what i need to look specifically for while learning and when i need help i know what to ask, i'm pretty new to this, at most i have made command based games in c# but the whole thing with API's and yaml storage is messing with me, thanks if you can explain it all to me(like how plugins work)
     
  4. Offline

    randomman159

    Yeah i can't blame you really. You'll find java is pretty simple to learn if you know C#.

    Now when it comes to the API's and stuff,
    http://wiki.bukkit.org/HUGE_Plugin_Tutorial

    could help a lot. Start by creating a java project in eclipse, basically do what it says in the above tutorial... Just learn how to import libraries (mentioned in the above tutorial). Then start looking into the API.


    In regards to connecting to other plugins, simply reference them like you do the bukkit.jar, then you should receive access to their commands. There should be simple ones such as giveMoney(int val); or something like that throughout economy plugins. A lot of plugins give you source (or decompile if really neccessary) so you should get a good idea of how you are accessing these function and what they do.


    Regarding the YAML, basically its a configuration file. It's mentioned in the above tutorial, but to quickly give you an idea...


    Code:
    Configuration config = getConfiguration();
    if (config.getProperty("enabled") == null)
    {
        config.setProperty("enabled", true);
        config.setProperty("killreward", 20);
        config.save();
    }
    
    boolean enabled = config.getBoolean("enabled", false); // the second parameter here is a default value in case the value can't be found
    int killreward = config.getInt("killreward", 0);

    that should simply store that "enabled" is true, and "killreward" if the property "enabled" isn't set yet. Then it stores killreward and enabled into variables...


    Good luck and have fun! Just keep asking questions on these forums, there's many active clever coders :) Fortunately for us new Minecraft modders, it means we have a lot of people to learn from :D
     
  5. Offline

    Lellz

    looking at code has been a big help, but some things i don't get why, like what is "("enabled") == null" and whats it telling the programme(what's "null" doing?). it's just the indepth explanation of certains things i need and why they're there
    thanks
     
  6. Offline

    Acecreativity

    Hey if you're new to making plugins go to here it's great and helped me. You may be bored as you know something but he does explain the null things etc. I would recommend watching all!
     
Thread Status:
Not open for further replies.

Share This Page