[ECON] Command iConomy - Make any plugin an iConomy plugin [1.4.7, 1.5beta]

Discussion in 'Inactive/Unsupported Plugins' started by Kostronor, Jun 1, 2011.

  1. Offline

    Kostronor

    Since @deltahat is in lack of time, i will continue his plugin for him:
    Command iConomy - Charge for each command
    Version v7

    Overview
    Command iConomy is a plugin that allows a server admin to assign a cost to server commands that is deducted from a player's iConomy account whenever a player uses that command. Commands are matched using java regular expressions. If text entered by a player matches a configured rule, Command iConomy will attempt to bill the player. Command iConomy requires Vault!

    Examples include charging for each summoned magic carpet, or adding a fee for different kits.

    Configuration
    To set the price of a command, add a line to prices.yml. Command iConomy matches regular expressions against user input. Regular expressions allow you to charge separately for individual sub-commands or even specific command arguments.

    A typical configuration line looks like this: ^/tp: 10
    A configuration line matching sub-commands might look like this: ^/time (day|night): 20

    Command expressions are matched in order from top to bottom. If a match is found, Command iConomy stops looking for a match and charges the player the configured amount. If the command is configured with a cost of zero, processing will stop but the player will not be charged. Together these features allow open ended commands to be individually charged. Ex:

    ^/warp help$: 0
    ^/warp \S+$: 10

    Really Quick Regular Expression Info
    ^ = Start of command
    $ = End of command
    \S+ = One or more non-whitespace characters

    For best results, please study and learn regular expressions!

    For more info on regular expressions, see: http://www.regular-expressions.info/reference.html

    Command Cooldowns
    You can now configure a number of seconds before charging a player again for a command. To do so, add a space and then the number of seconds to wait after the command's cost. Ex:

    ^/warp \S+$: 10 30

    Permissions
    • CommandIConomy.Free - Grants free access to all commands.
    Internationalization
    Three additional settings can be made in the config.yml file to localize Command iConomy's text. You will have to create config.yml. They are:
    • NoAccountMessage
    • InsuficientFundsMessage
    • AccountDeductedMessage
      • Substitute {cost} for cost
    Download
    http://dev.bukkit.org/server-mods/command-iconomy/

    Changelog (since Kostronor):

    [COLOR=#444444][SIZE=11px][COLOR=#444444][SIZE=11px][COLOR=#444444][SIZE=11px][COLOR=#444444][SIZE=11px][FONT=Bitstream Vera Sans Mono]Version 9[/FONT][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR]
    • Reworked against cb1597/1602
    • should work with every never build, if not please instantly contact me and i will fix it!
    • Vault support!
    [COLOR=#444444][SIZE=11px][COLOR=#444444][SIZE=11px][COLOR=#444444][SIZE=11px][COLOR=#444444][SIZE=11px][FONT=Bitstream Vera Sans Mono]Version 8[/FONT][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR]
    • Reworked against cb1337
    • should work with every never build, if not please instantly contact me and i will fix it!
    • Register support!
    [FONT=Bitstream Vera Sans Mono]Version 7[/FONT]
    • Reworked against cb818
    • should work with every never build, if not please instantly contact me and i will fix it!
    • Initial Release
    Version 2
    • Added free permission
    • Only match first expression
    • Match but don't display zero cost commands
    Version 3
    • Increased priority of CommandPreProcess hook to improve compatibility
    Version 3.1
    • Bukkit 602 compatibility
    Version 5
    • iConomy 4.6.5 suport
    [*]Added optional logging to the console
    [*]Added optional matching of chat events
    [*]Added command cost to insufficient funds message
    [*]Verified CB612 and MC1.4 support
    [/LIST]
    Version 6
    • Added command cooldowns
    • Added fee collection account
    Version 7
    • [iConomy 5 support
    //Sidenote spoiler's are messed up so i removed them.
    //if someone is against this, he can format my post himself :p
     
  2. Offline

    LlmDl

    I'll be testing this today, think you could update the thread title, I think I was on v8, so is this v9 now?

    Works, but players are seeing 'Charged {cost}' ingame.

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

    shanko

    I run vault and register together and get no problems, im afraid to update x.x
     
  4. Offline

    Kostronor

    yes, that is true, since {} are spezial chars and i have to double-escape them like \\{cost\\} and that was making some problems so i changed to (cost), the auto-generated config will have this change already, sorry, but i forgot to mention it because i tested it myself after posting here and then {} were not working...
    change {cost} to (cost) and it will be fine.
    If both are using the same Economy, just update and nothing will change.
    I have tested the Vault-Support myself and it is working well.

    What i am interested in is, does anyone use the payto feature?
    with vault, i have to make a difference between a bank account and a player-account and at the moment, this feature is trying to pay to a player-account so i want to know if some of you are paying to a bank and i have to check, whether pay to bank or player
     
  5. Offline

    miketoast

    I added these commands

    ^/tpa: 30
    ^/tpaccept: 20

    and get this error whenever I use the commands (it still does the commands even if balance is 0$)

    Code:
    02:42:05 [SEVERE] Could not pass event PLAYER_COMMAND_PREPROCESS to CommandICono
    my
    java.lang.IndexOutOfBoundsException: No group 3
            at java.util.regex.Matcher.group(Unknown Source)
            at java.util.regex.Matcher.appendReplacement(Unknown Source)
            at java.util.regex.Matcher.replaceAll(Unknown Source)
            at java.lang.String.replaceAll(Unknown Source)
            at com.ryanmichela.cmdiconomy.CIListener.chargePlayerForCommand(CIListen
    er.java:112)
            at com.ryanmichela.cmdiconomy.CIListener.onPlayerCommandPreprocess(CILis
    tener.java:47)
            at org.bukkit.plugin.java.JavaPluginLoader$5.execute(JavaPluginLoader.ja
    va:293)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:339)
            at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    java:750)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:722)
    
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:715)
            at lishid.orebfuscator.utils.NetServerHandlerProxy.a(NetServerHandlerPro
    xy.java:106)
            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:93)
            at lishid.orebfuscator.utils.NetServerHandlerProxy.a(NetServerHandlerPro
    xy.java:44)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:527)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:425)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)


    -I use groupmanager for my permissions plugin
     
  6. Offline

    Kostronor

    you forgot the $ at the end of the regex:

    ^/tpa$: 30
    ^/tpaccept$: 20
    will work
     
  7. Offline

    miketoast

    Still gives me the same error with the $ at the end

    Here's what I have in the config

    Code:
    # To charge for a command, list a matching regular expression below on its own
    # line with the price, separated by a colon. For more info on regular expressions
    # see http://www.regular-expressions.info/reference.html
    #
    # ^/tp: 10
    # To add a multiplier to a command like /i or /give so it charges for every item not for the whole command:
    # ^/give stone 10(amount)(?:/give \w+ )\d+: 10 will cost 10*10=100
    # (?:<regex>) is a noncapturing group, so it will be included in the match but will not alter the returned amount
    ^/tpa$: 30
    ^/tpaccept$: 20

    Edit: This only happens once I've reached 0 dollars in balance


    Edit again:

    Here is the code for the price file:
    Code:
    # To charge for a command, list a matching regular expression below on its own
    # line with the price, separated by a colon. For more info on regular expressions
    # see http://www.regular-expressions.info/reference.html
    #
    # ^/tp: 10
    # To add a multiplier to a command like /i or /give so it charges for every item not for the whole command:
    # ^/give stone 10(amount)(?:/give \w+ )\d+: 10 will cost 10*10=100
    # (?:<regex>) is a noncapturing group, so it will be included in the match but will not alter the returned amount
    ^/home$: 25



    Here is the error I get:
    Code:
    [SEVERE] Could not pass event PLAYER_COMMAND_PREPROCESS to CommandICono
    my
    java.lang.IndexOutOfBoundsException: No group 2
            at java.util.regex.Matcher.group(Unknown Source)
            at java.util.regex.Matcher.appendReplacement(Unknown Source)
            at java.util.regex.Matcher.replaceAll(Unknown Source)
            at java.lang.String.replaceAll(Unknown Source)
            at com.ryanmichela.cmdiconomy.CIListener.chargePlayerForCommand(CIListen
    er.java:112)
            at com.ryanmichela.cmdiconomy.CIListener.onPlayerCommandPreprocess(CILis
    tener.java:47)
            at org.bukkit.plugin.java.JavaPluginLoader$5.execute(JavaPluginLoader.ja
    va:293)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:339)
            at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    java:750)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:722)
    
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:715)
            at lishid.orebfuscator.utils.NetServerHandlerProxy.a(NetServerHandlerPro
    xy.java:106)
            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:93)
            at lishid.orebfuscator.utils.NetServerHandlerProxy.a(NetServerHandlerPro
    xy.java:44)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:527)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:425)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
     
  8. Offline

    Kostronor

    please send me your config.yml file
    this is 100% a problem with the regex and i dont know why...
     
  9. Offline

    miketoast

    Code:
    Verbose: false
    ChargeForChat: false
    #PayTo: accountName
    UseamountMultiplier: false
    NoAccountMessage: No bank account.
    InsuficientFundsMessage: Insuficent funds. (cost) needed.
    AccountDeductedMessage: Charged (cost)
    
    
     
  10. Offline

    Kostronor

    hmmm... i think i have to test this on your server, can you add Kostronor to whitelist give me ip and so on?

    I will since today give support to the plugin mostly in my forum:
    http://wusebi.de/viewforum.php?f=14
    And i will announce new versions in this thread.
    You can watch it and receive instant email-notification about new updates and nothing when someone has a problem and is posting somewhere else
    http://wusebi.de/viewtopic.php?f=14&t=20
    I will still look here at bukkit, but there will be the main adress for me

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

    deadmatters

    is this a valid configuration?
    ^/i 1 64$:120
    ^/give 1 64$:120
    ^/i 2 64$:50
    ^/give 2 64$:50
    ...and so on...

    I wanted to create an option to use TooManyItems for a little charge of the curency ;)

    Is this possible?
    Thanks for a quick reply. :p
     
  12. Offline

    Kostronor

    sure, that should be valid.
    if it fails:
    one space before the price
    try without the $
    and it only charges for 64
    63 will be free
    so try /i 1.*: 120
    will charge for:
    -/i 1
    -/i 1 1
    -/i 1 64
     
    deadmatters likes this.
  13. Offline

    deadmatters

    thanks :)
    gonna use is this way.
    nice plugin anyway. keep up the great work ;)
     
  14. Offline

    Kostronor

    and if you want to charge them 120 per stone they get, you can use amount multiplier explained somewhere up :D
    this will charge the twice if they want /i 1 2
    i have explained it in the pices.yml file
     
  15. Offline

    5000 People

    its not charging anything. in the console it says [commandiconomy] loaded
    i am running iconomy 6

    prices .yml

    # To charge for a command, list a matching regular expression below on its own
    # line with the price, separated by a colon. For more info on regular expressions
    # see http://www.regular-expressions.info/reference.html
    #
    # ^/tp: 10
    # To add a multiplier to a command like /i or /give so it charges for every item not for the whole command:
    # ^/give stone 10(amount)(?:/give \w+ )\d+: 10 will cost 10*10=100
    # (?:<regex>) is a noncapturing group, so it will be included in the match but will not alter the returned amount
    ^/tp$: 35
    ^/home$: 40
    ^/sethome$: 25

    config.yml

    Verbose: false
    ChargeForChat: false
    #PayTo: accountName
    UseamountMultiplier: false
    NoAccountMessage: No bank account.
    InsuficientFundsMessage: Insuficent funds. (cost) needed.
    AccountDeductedMessage: Charged (cost)

    5000 people are getting this error
     
  16. Offline

    Kostronor

    try to remove the $ at the end of each command.
    If you need it or not depends on your regex generator
    most people dont need it ;)
     
  17. Offline

    5000 People

    thanks it worked best plugin ever :p - a review from 5000 people
     
  18. Offline

    Tomskied

    Hey! The plugin isnt trying to load at all for me, I get no errors in console, and when I try /pl its not there at all.
    Im using iconomy 6 and 1.5 register and Pex. I have no idea whats going on. So if you could give any assistance that would be great
    Thanks :)
     
  19. Offline

    Kostronor

    Hey Tomskied,
    I have changed from register to Vault, as this is much more frequent updated and is much more easier for me.
    That the plugin won't load could be you not using vault but normally, this should throw an error or leave a message in your console.
    Please try having command-iconomy and Vault in your plugins-directory and tell me the outcome of it :)
     
  20. Offline

    Tomskied

    I have vault in there aswell, as i use it for other plugins.
     
  21. Offline

    Kostronor

    Hmmm... that is very interesting, so there is no trace of the plugin saying anything on startup, as i can't imagine it just doing nothing and vanishing without a single trace.
    The first two points comming in mind are:
    -do you really have it in your plugin-folder?
    -Is there anything about Command-Iconomy in your startup-log, perhaps something you have overseen?
    If both are not the case, please send me a whole snip of your startup-log and what plugins you are using please
     
  22. Offline

    Tomskied

  23. Offline

    Kostronor

    Hey, thanks for the log:
    at first i found these two lines:
    2012-01-20 23:17:20 [INFO] [CommandIConomy] Verbose mode enabled.

    2012-01-20 23:17:20 [INFO] [CommandIConomy] Loaded.

    this means, that everything should work well.
    Somewhere above there was an error with spout, this should not interfere my plugin but i have seen some cases where errors in one plugin prevent a bunch of plugins loading at the same time from working. perhaps a goot first try would be to try resolving this error.
    the next step would be sending me your config and prices .yml and let me try out simple things like:
    ^/help :10
    and try /help if it charges.
     
  24. Offline

    Tomskied

    Wow i feel dumb, i cant believe I missed that. i tried that help, and didnt get anything, this is my config. http://pastebin.com/8XgLh0h8
     
  25. Offline

    Kostronor

    ok, please post your price.yml and tell me your server-ip etc. so i can join it and test it out please
     
  26. Offline

    Tomskied

  27. Offline

    Kostronor

    sorry sorry sorry, this was a fail on my side, please move the : one to the left
    ^/help: 10
    and try again please, if this does not work, i would have to go onto your server and try some things out please
     
  28. Offline

    Tomskied

    Perfecto! I thought I tried all combinations of formatting but obviously missed out that one, thanks for helping me, with quite a stupid problem really :p
    Tom
     
  29. Offline

    Kostronor

    Ok, fine it now goes well :)
     
  30. Offline

    MangoKiwi

    I Really Have An Important Question !!!!! Is It Possible For Me To CHANGE The STARTING MONEY ? And Also Since Im An Admin For My Server How Can I Give My Self Money ? Please Answer And Thank U :)
     
  31. Offline

    Kostronor

    this is done by your economy-plugin, please refer to them ;)
     

Share This Page