[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

    elitefroggy

    can you add a feature where you pay once to use a command multiple times
     
  3. Offline

    Kostronor

    I've already added the cooldown, so you do not have to pay again in a defined time, but defined uses, for what should it be usefull?
     
  4. Offline

    fneyret

    You can divide the price by the number of uses too
     
  5. Offline

    Kostronor

    are you talking about a discount for the second time using the command?
     
  6. Offline

    fneyret

    No, sorry, I was answering to elitefroggy ^^'
     
  7. Offline

    elitefroggy

    I was thinking infinite, I want it so you have to buy a licence to drive a movecraft car, plane or boat.
     
  8. Offline

    Silicon

    is it possible to only charge like 50 cents for something? i believe putting in like 0.50 would charge 50 dollars and 0.25 would be 25 dollars, etc....
     
  9. Offline

    Kostronor

    Buying a license is a good idea. I'll think about how to do this, it could be very simple i think ;)
    It should work if you put 0.50 or 0.5 it charges you for 0.5. if not, this would be a bug :D
     
  10. Offline

    Silicon

    not a bug, sorry for wasting your time.
     
  11. Offline

    LlmDl

    @Kostronor

    Still love your plugin, is it safe to assume it works with RB1060?
     
  12. Offline

    Kostronor

    Normally, the new build does NOT break anything.
    There is a small chance, that something breaks, but in 99% of the cases, everything works.
    Test it out now and if you encounter any errors, just tell me, I'll fix them the next minutes :)

    @LlmDl
    If everything works, please post this here, so i can state this supporting build 1060, thanks :)

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

    LlmDl

    @Kostronor
    This has been working fine for a couple days on RB 1060. Players get charged what they should when they should if they can.
     
  14. Offline

    Kostronor

    Very thanks, I add a 1060 tag to the post.
     
  15. Offline

    BioRage

    Hey,

    Pause.

    Thanks for keeping this alive, it's very useful!
     
  16. Offline

    Kostronor

    Thanks, you're welcome :)

    I am wondering, if someone would appreciate MYSQl-Support for this plugin, perhaps this will help setting up charges without hassling around with the formatting for where to put what.
    Feedback please :)

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

    imaxorz

    I like MySQL support for any plug in :D

    I also got a question.


    ^/home help$: 0
    ^/home \S+$: 100 5

    I have it so it's free to go to your own /home, but you must pay to go to someone elses, unless it's /home help. The above is what I have in my prices.yml, however it still charges for /home help. Am I missing something?
     
  18. Offline

    Kostronor

    you have to exclude /home help out of /home.
    try this one:
    (?(/home help)false|^/home .+$)^/home .+$: 100 5
    this will look for /home help and if not, it will check for /home, so you are ensured, that /home help is excluded from the list :)
     
  19. Offline

    imaxorz

    That doesn't charge for anything at all :(

    I was basing what I did on this
    "Command expressions are matched in order from top to bottom. If a match is found, Command iConomy stops looking for a match andcharges 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"

    From what I thought for example if some one types /warp help it will stop at the first one and charge zero, but if they do /warp somethingelse it will skip /warp help and stop at the second one and charge 10.

    Also, is there a reload command, so it's easier to play with the settings?
     
  20. Offline

    Kostronor

    ok, well, i've checked my whole code but did not find any errors, it should ignore the second regex if the first one matches. perhaps i have to send you a debugging version of it, will setup it the next days!
     
  21. Offline

    imaxorz

    Cool, thank you.
     
  22. Offline

    Kostronor

  23. Offline

    imaxorz

    Using
    ^/home help$: 0
    ^/home \S+$: 100 5

    /home - Was free
    /home help - Charged 100
    /home xxxxx - Charged 100

    2011-08-21 21:17:09 [INFO] imaxorz tried to use command /home
    2011-08-21 21:17:12 [INFO] [debug] found a regex
    2011-08-21 21:17:12 [INFO] /home help
    2011-08-21 21:17:12 [INFO] [debug]cooldown false
    2011-08-21 21:17:13 [INFO] [debug]player has account
    2011-08-21 21:17:13 [INFO] [debug]cost > 0 deduct
    2011-08-21 21:17:19 [INFO] imaxorz tried to use command /home help
    2011-08-21 21:17:34 [INFO] [debug] found a regex
    2011-08-21 21:17:34 [INFO] /home aalsdjf
    2011-08-21 21:17:34 [INFO] [debug]cooldown false
    2011-08-21 21:17:35 [INFO] [debug]player has account
    2011-08-21 21:17:35 [INFO] [debug]cost > 0 deduct

    Using
    (?(/home help)false|^/home .+$)^/home .+$: 100 5
    I got errors with this one
    Show Spoiler

    2011-08-21 21:23:48 [INFO] imaxorz tried to use command /home
    2011-08-21 21:23:59 [SEVERE] Could not pass event PLAYER_COMMAND_PREPROCESS to Command iConomy
    java.util.regex.PatternSyntaxException: Unknown inline modifier near index 2
    (?(/home help)false|^/home .+$)^/home .+$
    ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.group0(Unknown Source)
    at java.util.regex.Pattern.sequence(Unknown Source)
    at java.util.regex.Pattern.expr(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at com.ryanmichela.cmdiconomy.CIListener.chargePlayerForCommand(CIListener.java:69)
    at com.ryanmichela.cmdiconomy.CIListener.onPlayerCommandPreprocess(CIListener.java:46)
    at org.bukkit.plugin.java.JavaPluginLoader$5.execute(JavaPluginLoader.java:272)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:730)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:701)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:694)
    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:89)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:436)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:454)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    2011-08-21 21:23:59 [INFO] imaxorz tried to use command /home help
    2011-08-21 21:24:04 [SEVERE] Could not pass event PLAYER_COMMAND_PREPROCESS to Command iConomy
    java.util.regex.PatternSyntaxException: Unknown inline modifier near index 2
    (?(/home help)false|^/home .+$)^/home .+$
    ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.group0(Unknown Source)
    at java.util.regex.Pattern.sequence(Unknown Source)
    at java.util.regex.Pattern.expr(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at com.ryanmichela.cmdiconomy.CIListener.chargePlayerForCommand(CIListener.java:69)
    at com.ryanmichela.cmdiconomy.CIListener.onPlayerCommandPreprocess(CIListener.java:46)
    at org.bukkit.plugin.java.JavaPluginLoader$5.execute(JavaPluginLoader.java:272)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:730)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:701)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:694)
    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:89)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:436)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:454)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    2011-08-21 21:24:04 [INFO] imaxorz tried to use command /home adsf
     
  24. Offline

    LlmDl

    Nevermind, nothing to see here.
     
  25. Offline

    Kostronor

    ok, the error is with the plugin not knowing that /home help should cost 0...
    will look at it now

    @imaxorz redownload and try it now please
    now the debug is at startup

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

    imaxorz

    Which version?
     
  27. Offline

    Kostronor

  28. Offline

    Kamilio

    This is my exact price configuration, but when I type the commands , they don't charge me. Did I do something wrong?


    Code:
    ^/home$: 50
    ^/sethome$: 50
    ^/ptp \S+$: 50

    And here is my regular config


    Code:
    Verbose: false
    ChargeForChat: false
    #PayTo: accountName
    
    NoAccountMessage: No bank account.
    InsuficientFundsMessage: Insuficent funds. {cost} needed.
    AccountDeductedMessage: Charged {cost}
    Is it maybe because I have no account name to pay to? Do I need one?
     
  29. Offline

    Kostronor

    No, you do not need one, if there is no account to pay to, it just ignores this.
    do you have the permissionnode CommandIConomy.Free?
     
  30. Offline

    Kamilio

    Well I dont use any permissions at all... Do I need to get the Permissions plugin?
     
  31. Offline

    Kostronor

    no you do not, just to ask if that could be the case of not charging.
    try enabling verbose=true and tell me your server.log after testing some commands
     

Share This Page