Register - Now accepting all Payment Methods (Economy API) [Stable]

Discussion in 'Resources' started by Nijikokun, May 10, 2011.

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

    narrowtux

    One of my users reported this:
    Code:
    [SEVERE] Error occurred while enabling Register v1.2 (Is it up to date?):
     com.nijikokun.register.payment.Methods.setPreferred(Ljava/lang/String;)Z
     java.lang.NoSuchMethodError:
     com.nijikokun.register.payment.Methods.setPreferred(Ljava/lang/String;)Z 	at
     com.nijikokun.register.Register.hasPreferred(Register.java:38) 	at
     com.nijikokun.register.Register.onEnable(Register.java:54) 	at
     org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:126) 	a
    t org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:920) 	at
     org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:278) 	at
     org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:173) 	at
     org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:156) 	at
     net.minecraft.server.MinecraftServer.e(MinecraftServer.java:297) 	at
     net.minecraft.server.MinecraftServer.a(MinecraftServer.java:284) 	at
     net.minecraft.server.MinecraftServer.init(MinecraftServer.java:152) 	at
     net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348) 	at
     net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    
    Is someone here who put it into a stand-alone plugin?
     
  2. Offline

    ltguide

    I'd bet they have Register.jar in their /lib folder still. I noticed that earlier today when I was testing my plugin. I'm including the Register source in mine now because there's too many older versions and implementations by other plugin devs.

    In Methods.java setMethod() I think you should change
    if (plugin == null) continue;
    to
    if (plugin == null || !plugin.isEnabled()) continue;
    I wouldn't think someone would want a disabled plugin to be selected.

    The plugin should have a different package name because of colliding with the library.
    Also, adding server listeners would be a good idea.
    Code:java
    1. public void onPluginDisable(PluginDisableEvent event) {
    2. if (Methods.hasMethod() && Methods.getMethod().getPlugin().equals(event.getPlugin())) {
    3. Methods.reset();
    4. }
    5. }
    6. //...


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

    Codisimus

    Is there a reason why everything in Methods.java is now static?
    Plugins cannot work off of the same Register.jar if they want to use different Economies.

    Also I can't get it to link to iConomy when both iConomy and BOSEconomy are enabled. (Yes I set preferred to iconomy)

    @Nijikokun
    Looking through the source I noticed this in Methods.java
    Code:
    if (count == 0)
        if (preferred.equalsIgnoreCase(attached.getName()))
            Method = attached;
    
    else
        Method = attached;
    I may be wrong, but the way it is formatted it looks like there should be brackets for the first if statement.

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

    Nijikokun

    It's a JAR HELL thing, I would advise all devs that use Register in their plugins to convert over to supporting the JAR instead of internal unless you change the classpath to something other than com.nijikokun.register

    @Gabriel333

    If you have myhome, that usually fudges it up for now that's the only one I know of.

    Will look into it later on today, and yes you can actually use a specific economy with register if you wanted, I just forgot how, i'll post later on.

    Added listeners in 1.3,

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

    Gabriel333

    I just looked at Myhome. Myhome does not support the Register.jar. He has imported your source code into his. I dont what to do that, because I dont want to maintain the code (if there is any bugs left :p ). So I need another example, where a developer just imports the JAR.
     
  6. Offline

    KingHarper

    I'm using the latest iConomy 6 & Register API, in my Config.yml for iConomy I set both Minor & Seperate to false but when I format coins in my plugin it still outputs "1 Dollars, 90 Coins" instead of 1.90 Dollars.

    My format line:
    Code:
    String text = Methods.getMethod().format(doubleCoins);
    Config.yml:
    Show Spoiler
    Code:
    System:
      Default:
        Currency:
          # Major is the first segment [Major].Minor
          Major: [ 'Dollar', 'Dollars' ]                # Major ([Major].Minor) 1.00 Dollar (With Seperate 1 Dollar)
          Minor: [ 'Coin', 'Coins' ]                    # Minor (Major.[Minor]) 0.23 Coins  (With Seperate 0 Dollars, 23 Coins)
    
        Account:
          # Default account balance when created
          Holdings: 30.0
    
      # Controls how money is formatted through methods
      Formatting:
        # Minor allows you to use the Minor amounts for amounts <1
        # Example (true) 0.23 Coins and 1.23 Dollars (false) 0.23 Dollars and 1.23 Dollars
        Minor: false
    
        # Seperate allows your money to be shown in an alternative way,
        # instead of 1.32 it will show as 1 Dollar 23 Coins
        # !!! NOTICE: This only works if Minor is set to true !!!
        Seperate: false                               # Example (true) 1 Dollar, 23 Coins (false) 1.23 Dollars (Only if Minor is true)
    
        # Single shows your money in another alternative way.
        # Instead of 1.23 Dollars you will see: 1 Dollar.
        # If your money is 0.23 you will see 0 Dollars if Minor is false, 23 Coins if Minor is true.
        # !!! Notice: This overrides seperate !!!
        Single: false


    Do you know why it's doing this? or know a solution?

    Thanks a lot,
    Harper
     
  7. Offline

    matejdro

    Not completely ontopic, but where do I see updates? I'm watching this for a few days and I saw today that you made an update several hours ago.

    But i did not received any notifications. Where notifications go?

    Also, ontopic: should i include this to my project source or use it as separate plugin? I'm kinda confused, since you said i should hook it to source, but there is plugin.yml and all other plugin stuff inside.
     
  8. Getting this:

    Code:
    09:05:28 [SEVERE] Could not pass event PLUGIN_ENABLE to Register
    java.lang.IncompatibleClassChangeError: Expected static method com.nijikokun.register.payment.Methods.hasMethod()Z
            at com.nijikokun.register.listeners.server.onPluginEnable(server.java:37)
            at org.bukkit.plugin.java.JavaPluginLoader$46.execute(JavaPluginLoader.java:562)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:927)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:278)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:173)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:156)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:297)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:284)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:152)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    09:05:28 [INFO] MagicSpells v1.2 loaded!
    09:05:28 [SEVERE] Could not pass event PLUGIN_ENABLE to Register
    java.lang.IncompatibleClassChangeError: Expected static method com.nijikokun.register.payment.Methods.hasMethod()Z
            at com.nijikokun.register.listeners.server.onPluginEnable(server.java:37)
            at org.bukkit.plugin.java.JavaPluginLoader$46.execute(JavaPluginLoader.java:562)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:927)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:278)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:173)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:156)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:297)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:284)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:152)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    
    Some API change or so?
     
  9. Bonjour,

    J'ai installé le plugin Faction, je souhaite associé à celui-ci le plugin Iconomy. Il est demandé d'installer "Register" pour pouvoir l'utiliser, mais je ne comprends pas l'installation.

    - J'ai mis Register.jar dans plugins : rien.
    - J'ai essayé décompressé iconomy.jar et rajouté les fichiers dl dans ce post : rien.
    - J'ai fait des tests dans le dossier lib de mon serveur : rien.

    Auriez-vous une idée sur la question ?


    Traduction Google :

    Hello,

    I installed the plugin Faction, I want it associated with the plugin Iconomy. Are asked to install "Register" to use it, but I do not understand the installation.

    - I put in Register.jar plugins: nothing.
    - I tried to unzip the files and added iconomy.jar dl in this post: nothing.
    - I did some tests in the lib folder of my server: nothing.

    Do you have an idea on this?
     
  10. Offline

    Nijikokun

    Last edited by a moderator: Jul 16, 2016
  11. Offline

    desht

    Are there up-to-date docs anywhere on using this as an external plugin, or failing that examples of plugins which are using it as an external plugin? Would really like to see a definitive reference. Right now I'm using 1.2 statically built-in to my plugins (with a modified package name) but would prefer to use it as a plugin if possible.
     
  12. Offline

    Gabriel333

    @nijikokun
    Im happy you cleaned up in the static/non-static mess!!! :)

    I need some updated documentation too, by plugin fails onEnable.... :'(
     
  13. Offline

    matejdro

  14. Offline

    Gabriel333

    Yes, you should NOT include the source code for Register in own plugins source code. Let the serveradmins decide which version of register they want to run, like for all other plugins.
     
  15. Offline

    MrSpider

    I am getting an exception with the latest Register.jar (1.5), the latest version of iConomy and self-written plugin,
    Code:
    22:51:51 [SCHWERWIEGEND] com.nijikokun.register.payment.Methods.setPreferred(Ljava/lang/String;)Z initializing Register v1.5 (Is it up to date?)
    java.lang.NoSuchMethodError: com.nijikokun.register.payment.Methods.setPreferred(Ljava/lang/String;)Z
            at com.nijikokun.register.Register.hasPreferred(Register.java:41)
            at com.nijikokun.register.Register.onLoad(Register.java:55)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:141)
            at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:103)
            at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:52)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:136)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    I used the Register.jar from the github repo and also tried compiling the code myself - neither one worked.

    A little bit later I get that error

    Code:
    22:51:53 [SEVERE] Could not pass event PLUGIN_ENABLE to Register
    java.lang.IncompatibleClassChangeError: Expected static method com.nijikokun.register.payment.Methods.hasMethod()Z
            at com.nijikokun.register.listeners.server.onPluginEnable(server.java:37)
            at org.bukkit.plugin.java.JavaPluginLoader$46.execute(JavaPluginLoader.java:562)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:927)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:278)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:173)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:156)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:297)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:284)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:152)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
     
  16. Where exactly are we supposed to link users of our plugins that require Register?
    This thread, or rather the bukkit dev page, since this here is a rather programming related?
    Or the direct jar?

    By the way, I like that linking to it as an external plugin is now recommended, that method makes it so much easier to do the basic stuff with the API. Thanks! (I finally got it :p)
     
  17. Offline

    matejdro

  18. I get the error below file with the Matador and The Official here.
    Caused by: java.lang.IncompatibleClassChangeError: Expected static method com.nijikokun.register.payment.Methods.hasMethod()Z

    Error :
    org.bukkit.command.CommandException: Unhandled exception executing command 'f' in plugin Factions v1.5.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:41)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:163)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:353)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:756)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:721)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:714)
    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:92)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:500)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:464)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.IncompatibleClassChangeError: Expected static method com.nijikokun.register.payment.Methods.hasMethod()Z
    at com.massivecraft.factions.Econ.enabled(Econ.java:98)
    at com.massivecraft.factions.FPlayer.attemptClaim(FPlayer.java:623)
    at com.massivecraft.factions.commands.FCommandClaim.perform(FCommandClaim.java:22)
    at com.massivecraft.factions.commands.FBaseCommand.execute(FBaseCommand.java:65)
    at com.massivecraft.factions.Factions.handleCommand(Factions.java:485)
    at com.massivecraft.factions.Factions.onCommand(Factions.java:470)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:39)
    ... 13 more
     
  19. Offline

    okami35

    Hello,
    I want to use register for my next plugin, but I don't understand how to start.
    Do you have any parts of code wich uses register? Because on the main page, the examples are not concretes.

    Thank you
     
  20. Offline

    Lehl

    @Nijikokun hi there.

    is there a way to support 3co in register?
    dont know if this is asked already (too many pages to read)
    would be really thankful if this possible
     
  21. Offline

    staxx6

    same :<
     
  22. I agree with Codisimus there are some missing brackets in this bit of code. The Register doesn't select the preferred plugin correctly without the missing brackets.

    Code:
                            if (count == 0) {
                                if (preferred.equalsIgnoreCase(attached.getName()))
                                    Method = attached;
                            } else {
                                Method = attached;
                            }
    
     
    AOD_Batman likes this.
  23. Offline

    RTRD

    Anyone got a tutorial on this!? xD
     
  24. Offline

    AOD_Batman

    Thank you, @Codisimus & @Steeleyes! I have been banging my head on this for half a hour and was about to drop register and implement my own method.
     
  25. Offline

    Don Redhorse

    can I second this? there are some beginners on here who don't want to write another tnt plugin..
     
    RTRD likes this.
  26. Offline

    RPGWorld

    @RTRD
    @Don Redhorse
    Ok,it's really easy to use this! ^^
    You do all your stuff with
    Methods.getMethod().getAccount(player.getName())!
    For banks,just use getBankAccount,also never tried, so i don't know how it works :p
     
  27. Offline

    Don Redhorse

    well... but you need to make that you use this method only if Register is there and loaded.. so if you only want to PERHAPS use it you need to use the plugin manager and a boolean variable to make sure you only do that if Register is running..

    so I can do stuff like this?

    Code:
    double Amount = Methods.getMethod().getAccount(player.getName()).Balance();
    and before that I need to
    import com.nijikokun.register.payment.Methods;

    and I must make sure via plugin manager and a boolean value that register is up and running.

    right?
     
  28. Offline

    RTRD

    @RPGWorld
    How would i fix it here:
    marked in red is showing a error...
     
  29. Offline

    RPGWorld

    What are you trying to do,exactly? :confused:
    you get the balance,but you don't assign it anywhere...

    You can add a depend or softdepend on Register,and then the plugin will only load after Register!
    But yeah,that will work!
    To check if a plugin is enabled,do this.getServer().getPluginManager.isPluginEnabled("Register");

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

    RTRD

    LOL :p

    I am trying to show the balance using %balance in a txt file...
     
Thread Status:
Not open for further replies.

Share This Page