[INACTIVE][ECON] Cookies! v0.5 - Economic System w/ API [424]

Discussion in 'Inactive/Unsupported Plugins' started by Coelho, Feb 21, 2011.

  1. Offline

    Coelho

    [ECON] Cookies! v0.5 - Economic System w/ API

    Description:
    Cookies lets you trade cookies with all your dearest friends, haven't you remembered in kindergarten you doing that? No? Well, use your imagination.

    Cookies is another Economic System that stands out from all the others. Cookies is made like no other, with everything that everyone else has, including MySQL, SQLLite, and more, packed up in a bite size cookie that is 18 kilos and less than 100 lines per file, with only 8 files.

    There is also a lot of built in features! It has an interest system where you can choose the rate of the interest, simply type in the properties the max hundredth of a second you'd like the rate to be, and the script will randomize it for you! (eg Typing 5 in properties will result in 1.00 to 1.05 interest rate)

    Another great feature is adding drops for Players and Monsters so for example, when a Player dies, they are deducted 2 money and the killer gains 2 money (if PvP). Monsters work the same way, when a player kills a monster he gets the specified amount in the properties.

    All of these features, if you wish to redo them on your own in your own plugin, can be turned off. You will never have to edit the plugin to remove anything!

    cookies.svgamers.com is the plugin's website hosted by Rockstar04. It has a nice cookies theme, and can be used to check for updates on the plugin!

    Cookies offers a iConomy 2.x Wrapper v0.25 that will make all iConomy plugins work with Cookies. Try it and love it!

    ----------------------------------------------------------------------------------------------------

    Features:
    • Permission support
    • Easy to configure properties
    • Interest System w/ Configuration
    • Monster Drop w/ Configuration
    • Player Drop w/ Configuration
    • Developers API for additional Plugins
    • Extremely condensed and excecuted code
    ----------------------------------------------------------------------------------------------------

    Permissions w/ Commands:
    • /(c)ookies : Checks your current money
    • /(c)ookies send [player] [amount] : Sends money : "cookies.send"
    • /(c)ookies status [player] : Checks player's money : "cookies.status"
    • /(c)ookies top : Lists top players : "cookies.top"
    • /(c)ookies admin set [player] [amount] : Sets player's money : "cookies.admin"
    • /(c)ookies admin clear [player] [amount] : Clear's player's money : "cookies.admin"
    • /(c)ookies admin grant [player] [amount] : Grants player money (Negative?) : "cookies.admin"
    • /(c)ookies admin status : Looks at all the economic status : "cookies.admin"
    • /(c)ookies admin save-all : Saves all of the economic data : "cookies.admin"
    ----------------------------------------------------------------------------------------------------

    Developers API:
    Before you do anything, add these imports to the top of the script
    Code:
    import org.bukkit.plugin.Plugin;
    import com.pi.coelho.Cookies.Cookies;
    
    Afterwards, add this to your "onEnable" to check if the user has Cookies.
    Code:
    Plugin pCookies = getServer().getPluginManager().getPlugin("Cookies");
    if(pCookies == null)
            System.out.println("Cookies is not found, disabling script!");
            getServer().getPluginManager().disablePlugin(this);
            return;
    }
    
    To get a players current money use this method
    Code:
    Cookies.getPlayerMoney(String displayName);
    
    To set a players current money use this method
    Code:
    Cookies.setPlayerMoney(String displayName, int value);
    
    To get the servers currency name use this method
    Code:
    Cookies.getCurrency();
    
    If you'd like to manipulate the HashMap directly (be careful) use this method
    Code:
    HashMap<String, Integer> balances = Cookies.getBalances();
    
    Cookies also uses the API of Permissions, so if you are making a script for Cookies, you do not need to create your own Permissions variable. This method returns "true" if Permissions is not found. I do NOT reccomend this, however it is an option.
    Code:
    Player p = event.getPlayer();
    boolean hasPermissions = Cookies.hasPermission(p, "cookies.send");
    if(hasPermissions)
              System.out.println("He has permissions!");
    else
              System.out.println("He dosen't have permissions!");
    
    ----------------------------------------------------------------------------------------------------

    Download:
    ----------------------------------------------------------------------------------------------------

    Notes:
    • Using my plugin? Show me you love me by putting me in the credits of your server [sheep]
    • All of the methods within Cookies are static, do not make a variable for it!
    • The databases are now case sensitive!
    • Do not bother me with errors from older builds or you'll force me to say, Example: "Build 0.45 fixes this"
    • Before closing Bukkit you must type "/c admin save-all" or nothing from the past auto-save to your current time will save. (You can also type "stop" in console)
    ----------------------------------------------------------------------------------------------------

    Suggestions:
    • Instead of choosing max interest, let user choose a range
    ----------------------------------------------------------------------------------------------------

    Cookies Changelog:
    Version 0.5
    • The databases are now case sensitive.
    • Doing this required a lot of changes, please report anything broken.
    Version 0.45
    • Fixed Bug with Initial Money
    • EVERYONE SHOULD UPDATE
    Version 0.4
    • Can now choose currency name!
    • Auto-save Configuration
    • Admin command "save-all"
    • Properties generation bug-fix
    • Developers API method "getCurrency()"
    Version 0.35
    • SQLite Bug Fix
    Version 0.3
    • Organized properties
    • Added admin command "grant"
    • Added admin command "status"
    Version 0.25
    • Fixed classpath in plugin.yml
    • Fixed "/cookies top" correctly
    • Admin command "clear" bugfix
    • Interest System "0.0" bugfix (hopefully)?
    Version 0.2
    • Bugfixes
    • Ability to choose initial player money
    • Ability to make monsters drop money
    • Ability to make players drop money
    • Ability to choose interest rates
    Version 0.1
    • Release
    ----------------------------------------------------------------------------------------------------

    iConomy Wrapper Changelog:
    Version 0.25
    • Fixed Misc File
    Version 0.2
    • Added method for more support
    Version 0.15
    • Fix
    Version 0.1
    • Release
     
    unya and Rockstar04 like this.
  2. Offline

    Racha

    What can i do with this money? ;/
     
  3. Offline

    jwideman

    Sounds promising.
     
  4. Offline

    Juze

    Sounds promising but I'd rather stick with iConomy now.
     
  5. Offline

    Coelho

    It's fine if you stick with iConomy for now since this does not have a lot of support yet. I'll be adding a lot of features to it though today! :)
    A lot of bug fixes coming today, i'll actually test everything today (Thank god) and I will fix the bug that is currently RED on the warnings. Good bye for now!
    --- merged: Feb 23, 2011 2:12 AM ---
    v0.2 Released with the following features:
    • Bugfixes
    • Ability to choose initial player money
    • Ability to make monsters drop money
    • Ability to make players drop money
    • Ability to choose interest rates

    You can use /c status Rockstar04 to see their current money, then /c admin set Rockstar04 to set their money. I may add this though, however.

    EDIT: Clear sets the money to 0. Sorry did not see the question, i'll make it default on next update as that is a bug.
    --- merged: Feb 23, 2011 4:56 AM ---
    v0.25 Released since I got on my Minecraft server for 2 minutes to test everything.
    • Fixed classpath in plugin.yml
    • Admin command "clear" bugfix
    • Interest System "0.0" bugfix (hopefully)?
    --- merged: Feb 23, 2011 8:04 AM ---
    Cookies is now stable, I tested all bugs and fixed them accordingly in v0.25, enjoy.
    --- merged: Feb 23, 2011 9:25 AM ---
    v0.3 Released in hopes of making this script finished.
    • Organized properties
    • Added admin command "grant"
    • Added admin command "status"
    Any more suggestions anyone? I am willing to add.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 9, 2016
  6. Offline

    Hakaslak

    Could you make a simple shop plugin that would allow players to buy things with your econ system? I know you have an API, but it would lead to quicker adoption if you had a somewhat ready to go package =)
     
  7. Offline

    KingPin

    hey there, if yo could add a way for iconomy users to use this as a drop in replacement it would be great!
     
  8. Offline

    RustyDagger

    Looked good till i seen the you must type stop to have things to save thats a problem for me because of my host They just kill the process :( its bad i know iv asked them to change it but they refuse. So thats a no go for me :(
     
  9. Offline

    Coelho

    As an operator type /stop and it will fix your problem.
    --- merged: Feb 23, 2011 8:39 PM ---
    I'll make my own, sure, it will be called, Cookie Stand! Muhahahah!
    --- merged: Feb 23, 2011 8:39 PM ---
    Do you mean an easy way for you to transfer over from iConomy to this?
     
  10. Offline

    KingPin

    well transferring over probably isnt that much of an issue as I can give out the amounts of currency manually or copy over the amounts to new DB. but the other plugins that use iconomy like multiverse portals, wormhole extreme... those are the larger issue.
     
  11. Offline

    Coelho

    Yes I see the problem there, that is why you need to go nag all your favorite script makers to add Cookies support :p
     
  12. Offline

    Kainzo

    Is there a conversion for Iconomy ? and a way to rename the currency?
     
  13. Offline

    Coelho

    If you are using iConomy as a flatfile, no there is no conversion, however it should be relatively easy for you to convert if you have it in MySQL or SQLite
    As for renaming the currency, at the moment no. I'll be adding that soon, however, I will put it on my suggestions list :D
     
    ShadowDrakken likes this.
  14. Offline

    ShadowDrakken

    Hrm, perhaps as a way of promoting this plugin, and since iConomy has been discontinued (not permanently, but indefinitely), create an optional second plugin that pretends to be iConomy 2.2b but just maps over to Cookies API?

    That will give existing plugins a way to use Cookies without knowing they're using Cookies until official support is added :)
     
  15. Offline

    Coelho

    Ooooh! Will post right after i'm done working on Cookie Stall plugin :p (or maybe before)
     
    ShadowDrakken likes this.
  16. Offline

    jwideman

    Yeah, I'll switch if there's a wrapper.
     
    ShadowDrakken likes this.
  17. Offline

    Coelho

    Wrapper is released!
    --- merged: Feb 24, 2011 12:17 AM ---
    Enjoy
    --- merged: Feb 24, 2011 12:18 AM ---
    Enjoy
     
    KingPin likes this.
  18. Offline

    RustyDagger

    O God how i wish it was that simple The server just restarts its self due to the CP And it just all ends bad if i try to stop it any other way. may i also point out another flaw with not saving it at an interval say the servers been running fine for 3 days and then it crashes wont all that data from the 3 days be lost i dont know bout you but that would piss my players off.
     
  19. Offline

    ShadowDrakken

    hrm, almost there, but not quite... missing some of iConomy's API
    --- merged: Feb 24, 2011 12:27 AM ---
    Also, am I missing something with the monster pay, or is there just a global monster payout rather than per-monster payouts?
     
  20. Offline

    Coelho

    It's my problem trying to fix ASAP.
     
  21. Offline

    Kainzo

    Yeah - we're using sqlite atm.
     
  22. Offline

    Coelho

    Fixed!
     
  23. Offline

    ShadowDrakken

    Hrm, not sure if this is the wrapper or Cookies! itself...
    Code:
    2011-02-23 18:45:24 [SEVERE] java.lang.ClassNotFoundException: org.sqlite.JDBC
    2011-02-23 18:45:24 [SEVERE]     at java.net.URLClassLoader$1.run(Unknown Source)
    2011-02-23 18:45:24 [SEVERE]     at java.security.AccessController.doPrivileged(Native Method)
    2011-02-23 18:45:24 [SEVERE]     at java.net.URLClassLoader.findClass(Unknown Source)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:30)
    2011-02-23 18:45:24 [SEVERE]     at java.lang.ClassLoader.loadClass(Unknown Source)
    2011-02-23 18:45:24 [SEVERE]     at java.lang.ClassLoader.loadClass(Unknown Source)
    2011-02-23 18:45:24 [SEVERE]     at java.lang.Class.forName0(Native Method)
    2011-02-23 18:45:24 [SEVERE]     at java.lang.Class.forName(Unknown Source)
    2011-02-23 18:45:24 [SEVERE]     at com.pi.coelho.Cookies.net.cDatabase.<init>(cDatabase.java:16)
    2011-02-23 18:45:24 [SEVERE]     at com.pi.coelho.Cookies.Cookies.onEnable(Cookies.java:95)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:140)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:426)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:187)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:76)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:57)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:187)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:174)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:120)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:227)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    2011-02-23 18:45:24 [SEVERE] java.lang.NullPointerException
    2011-02-23 18:45:24 [SEVERE]     at com.pi.coelho.Cookies.Cookies.onDisable(Cookies.java:131)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:142)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:441)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:199)
    2011-02-23 18:45:24 [SEVERE]     at com.pi.coelho.Cookies.Cookies.onEnable(Cookies.java:106)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:140)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:426)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:187)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:76)
    2011-02-23 18:45:24 [SEVERE]     at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:57)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:187)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:174)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:120)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:227)
    2011-02-23 18:45:24 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    nm, fixed... seems to be a discrepancy in the way different plugins look for SQLite support... I had sqlitejdbc-v056.jar and made a copy to sqlite-jdbc.jar and it fixed the error

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 9, 2016
  24. Offline

    Coelho

    Do tell me if everything goes well with the plugin :D
     
  25. Offline

    ShadowDrakken

    Where is Cookies saving the SQLite file, and which .properties line determines the filename? It didn't throw any errors, but I can't find the database either...
     
  26. Offline

    Coelho

    There is no .properties line to determine the filename, it should save to /Cookies/Cookies.sqlite
     
  27. Offline

    ShadowDrakken

    hrm, something is bugged then... I have /Cookies/.properties but no /Cookies/Cookies.sqlite (or another other .sqlite/.db file)
     
  28. Offline

    KingPin

    <3
     
  29. Offline

    ShadowDrakken

    bleh, the SQLite errors are back... I must have overlooked them when I thought it was fixed...

    I've tried putting the sqlite-jdbc.jar in the Bukkit folder as with other plugins, and also tried it in the plugins folder, and getting the errors both ways.
     
  30. Offline

    Coelho

    ShadowDrakken, download 0.35 and it will be fixed.
    0.35 Released!
    • SQLite Bug Fix
    --- merged: Feb 24, 2011 1:21 AM ---
    0.4 will have this! Adding to suggestions.
     

Share This Page