[ECON/RPG] MultiCurrency v0.11 - the only Multiple Currency Plugin [1240]

Discussion in 'Inactive/Unsupported Plugins' started by ashtheking, Jul 15, 2011.

  1. Offline

    ashtheking

    MultiCurrency
    by Ashtheking
    What is MultiCurrency? A lightweight yet powerful plugin providing multiple currencies. Perfect for that RP server with different nations! Or perhaps usable for that Stock Market server? Whatever you are looking for, this plugin is for you. Created for the private server TJRP (tjrp.proboards.com), I decided to release this for the world.

    Download:
    MultiCurrency
    Source included in jar.

    Command List:
    Alias are the same, with "mc" infront, aka "/mcpay" instead of "/pay."

    Permissions:
    Uses these nodes if Permissions is installed, else it uses the above settings.
    Show Spoiler

    ashtheking.multicurrency.info: (/money command)
    ashtheking.multicurrency.pay (/pay command)
    ashtheking.multicurrency.create (/create command)
    ashtheking.multicurrency.convert (/convert command)
    ashtheking.multicurrency.exchange (/exchange command)
    ashtheking.multicurrency.remove (/remove command)
    (If the config is set up for this)
    ashtheking.multicurrency.obtain.<currency> (receiving from /pay command)


    BUGS:
    None so far, :D
    Please email ag4ce@hotmail.com OR post here with any bugs.

    For Plugin Developers (How to hook into MultiCurrency):
    Uneeded now, it's part of Register!
    Show Spoiler

    Hooking into MultiCurrency is about the easiest thing to do. Here's how.
    1. Start by importing the following.
      1. Code:
        import me.ashtheking.currency.CurrencyList;
    2. Then, when you wish to modify the currency (add / subtract / multiply/ divide), use this. If you do not specify, currency, uses whatever currency the player has the most of.
      1. Code:
        CurrencyList.<function>(String playerName, double amount, [optional] String currency)
    3. You can check things about the currency, such as isNegative, hasOver, hasUnder, hasEnough, all of which have arguments: (String playerName, double amount, (optional) String currency). If you don't specify currency, does the same as the functions.
    4. If you wish to add your own currency, simply use this code, where "m" is a Material:
      1. Code:
        CurrencyList.addCurrency(currency, m.name());
    5. If you ever need help, just check the source code included in the jar, or email me at ag4ce@hotmail.com


    Config File Explanation:
    Show Spoiler

    • usePermissions=true
      • If set to true, means that it will look for, and if found, will use, Permissions 3.x
    • noPermsMessage=You don't have permissions to do this.
      • Message sent if someone tries to use a command, does not mean you need the usePermissions, as it will do this for the (Op) commands.
    • requirePermsForEachCurrency=false
      • If changed to true, will require the player a person is trying to send <currency> to using /pay to have "ashtheking.multicurrency.obtain.<currency>", otherwise will tell both players the below message
    • unableToGetCurrencyMessage=not having permissions for this currency.
      • Reason Message for being unable to obtain <currency>.


    TODO:
    --Integrate with Permissions DONE!
    --Have better plugin dev support. Part of Register! Thanks @Acrobot
    --Suggest if you have an idea.

    Changelog:

    That's all, folks! Enjoy!
     
    kahlilnc and StormyDayz like this.
  2. Offline

    turtlemoviesco

    When I try to create a currency I get this error in server console.

    18:32:49 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'crea
    te' in plugin Currency v0.05
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:12
    9)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:3
    20)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    java:713)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:677)

    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:670)
    at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:85)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NullPointerException
    at me.ashtheking.currency.Currency.onCommand(Currency.java:94)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
    ... 12 more

     
  3. Offline

    ashtheking

    Be sure you use a correct material, it seems that it couldn't find what material you've specified. I'll fix that exception in a bit.
     
  4. Offline

    turtlemoviesco

    Oh, keep forgetting that gold is a gold ingot. One more question does any chestshop work with this?
     
  5. Offline

    ashtheking

    iconomychestshop does. Acrobot and I worked together to make it work.
     
  6. Offline

    turtlemoviesco

    Ok thank you
     
  7. Offline

    SorcererRed

    I was just wondering if I can like multiple material exchange rates to one type of currency. For example, when I started playing Minecraft back in 1.3 me and some friends made a currency chart for RP based on gold ingots. Diamond = 10 gi, 4 flint = 1gi, etc.

    So is there a way to possibly link all game materials to a specific exchange rate for a single currency?
     
  8. Offline

    ashtheking

    Hmmm, not at the present moment. It'd be a large file, but i'll see about it.

    ::EDIT::
    You could just have an exchange shop that converts materials into currency for you.
     
  9. Offline

    ashtheking

    As far as I know, this should work with the latest recommended build, but i'm on vacation for a week and i'll check later. If someone could test it and save me the time, that would be great.
     
  10. Offline

    TOAST7312

    Out of curiosity, since I have seen mention of 'currency item' in here and don't see any mention of what the currency is exactly in the OP; does the currency created by this plugin require use of an item, or is it 'virtual', IE just numbers with a name beforehand, like iConomy?
     
  11. Offline

    ashtheking

    Basically, you use the command /convert to convert said item into X currency, where x is the exchange rate set with "/exchange." On the previous page, i give a nice example usage, feel free to ask any questions if you don't understand it.

    Tested, plugin is compatible with RB 1060.

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

    erawr00

    So from this I see that you can convert items to money, but does this allow you to do the opposite, convert money to items?
     
  13. Offline

    Kardocraft

    Is a currency 1:1 with another currency? Or have it a exchange rate or something?
     
  14. Offline

    ashtheking

    @erawr00 No, it's a one way conversion. You can't convert a gold coin back into gold. Legally.
    @Kardocraft Currency 1:1 means that every 1 <item> converts into 1 <currency>. If you use /exchange, you change that ratio to 1:<whatever>. See my example.
     
  15. Offline

    Johnsilver88

    Hello there. Me and some friends have an SMP server and we tried out this pluggin to make it all a bit more rpg.
    Problem is, when we create the "Iron coins" it doesen show in any way, but the iron ingots dissappear from my inventory anyway. My question is following: Is the currency supposed to be a "Physical" coin as an item in my inventory or a balance for an account? in any case i cannot find neither, but the create/exchange commands works :)
     
  16. Offline

    ashtheking

    Try using /money IronCoin, that should show you how much you have. It's a balance from an account, it's not an item.
     
  17. Offline

    ashtheking

    @AskCharlie it should now be doable with this new version.

    Updated, see changelog for details!
     
  18. Offline

    JamEngulfer221

    @ashtheking I have a question, how exactly does this work with other currency plugins? Does it allow the conversion of, for example, iConomy into a currency by this plugin, or one iConomy currency into another, or have I got it entirely wrong? Also, would it be possible to have it so that the conversion rates between currencies are randomised; Either as a random number that is added onto the conversion value every time, or a value that fluctuates based on the amount of conversion going on.

    Could we also have the same thing with the conversion from say, gold ingots into gold currency.

    Well, when I get home (I am on holiday right now) I might just try and code that myself, but I might not make it work.

    Other than that, I love the plugin!
     
  19. Offline

    ashtheking

    It doesn't work with the other currency plugins persay, it's part of Register, so it's compatible with them. It provides it's own currencies. If you want the conversion rate randomized, just keep changing the value based on what is going on. It does require some work by the server admin. I do realize there may be need for a Total Currency Out There command, for admins to change the exchange rate. I'll add that.

    @JamEngulfer221
     
  20. Offline

    JamEngulfer221

    Well, I mean on a transaction to transaction basis, have the value change veeeeery slightly. I might well just grab the source code and fiddle with it to make it work to my demands. That might be better than you doing anything, or me constantly changing the values :)

    Hang on, what exactly IS register? I can't seem to find it. Would you mind linking to it if it is something tangible like a plugin or a forum post. :)

    Aaaactually, I might not fiddle with the source code, too confusing.

    Well, if you could tell me where in the source code is the place where the exchanges happen, I would be grateful!

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

    ashtheking

  22. Offline

    JamEngulfer221

  23. Offline

    kahlilnc

    hm maybe a /money top [currency name] ???
    For the richest list of people?
     
  24. Offline

    JamEngulfer221

    i did a little fiddling with the code and this is what I came up with:

    Code:
    if(amount < 128){
    int tax = 4;
    } else {
    int tax = 2;
     player.getInventory().removeItem(new ItemStack([U]m[/U].getId(),amount));
                      CurrencyList.setValue(currency, player.getName(), CurrencyList.getValue(currency, player.getName()) + (amount * CurrencyList.getExchangeRate(currency) + ((new Random().nextInt(0-2) + tax))));
    
    Basically it adds a larger tax for smaller amounts of currency exchange, and a smaller tax for large amounts, plus a random amount between 0 and 2 to (kind of) simulate market fluctuations. This also means that you couldn't exploit the system if there was a loophole etc.
     
  25. Offline

    ashtheking

    Quite interesting, @JamEngulfer221 , perhaps you could make an addon plugin for that. I have a few ideas of having the plugin call custom events. Also, Register is an API for devs to make plugins with compatibility to a lot of currency plugins, because they use the API.
     
  26. Offline

    JamEngulfer221

    I will try and make an add-on plugin for this. I am unable to compile the pure source of the plugin due to some errors in the code (don't know what they are) Don't worry about them though, they aren't like a missing variable or ;.

    Could you help me make an add-on plugin, as in, compatibility wise. I don't know how to exactly hook into your plugin, and I'm not sure how to use register.

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

    ashtheking

    When I next release, i'll have better support for devs. ATM, you could use a playercommandpreprocessevent and check for the "/pay" command. Then you deduct your tax from the player, using CurrencyList.subtract(String name, int amount, String currency), as stated in the spoiler.
     
  28. Offline

    JamEngulfer221

    Ok, that's fine. I will wait until you include support for developers!
     
  29. Offline

    ashtheking

    I've updated the plugin to 0.11, making it usable and working with register. The config was glitchy. Also, I will be moving this to BukkitDev soon, probably over the weekend, when I get more time.
     
  30. Offline

    JamEngulfer221

  31. Offline

    Snaipe

    @ashtheking Could you add BukkitPerm support ? :)
     

Share This Page