[PrivateLotto] Permission & iConomy Based Lottery (HELP)

Discussion in 'Plugin Development' started by iPhysX, Mar 15, 2011.

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


    13:51:10 [INFO] [iConomy] v4.4 (Arcadia) loaded.
    13:51:10 [INFO] [iConomy] Developed by: [Nijikokun, Coelho]
    13:51:10 [INFO] PrivateLotto version 1.21 is enabled
    13:51:10 [SEVERE] null loading PrivateLotto v1.21 (Is it up to date?)
    at com.iPhysX.PrivateLotto.PrivateLotto.onEnable(PrivateLotto.java:94)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:83)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:61)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:204)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:191)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:131)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:246)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    13:51:10 [INFO] Done (1.041s)! For help, type "help" or "?"
    13:51:28 [INFO] 143 recipes
    13:51:28 [INFO] iPhysX [/] logged in with entity id 177
    13:51:34 [INFO] iPhysX issued server command: lottery
    13:51:34 [INFO] Unknown console command. Type "help" for help.

    This is probably a reallly simple error. and a really simple fix.
    Thanks for any help :)

    (My source is included with the .jar) LOTTOSOURCE.zip

    Attached Files:

  2. Offline


    I'd like to help, but I've never used the command/executor interface!

    This is where you're crashing:
    getCommand("lottery").setExecutor(new CommandExecutor() {
    I won't try to push the Persistence command dispatch on you, since you're not using Persistence- but I will say that if you've only got one command, it's probably easier to just override onCommand rather than do all of that :)

    If you move all of that code to onCommand, it'd look something like this:

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
        if (!cmd.getName().equalsIgnoreCase("lottery")) return false;
    ... Here goes your command-handling code...
    I took the liberty of changing this in your code, and also adding a pom for you, if you want to use Maven. However, this is a bit of a pain when linking to other non-Maven plugins- I don't have iConomy, for instance, so I wasn't able to really build your code (which may mean that what I changed is broken, but it should give you the idea...)


    I'm not really sure what the executor interface is for, honestly- it seems a lot like the dispatch interface I made, but with a different javascripty API from the javascripty API I've got. Anyway, I don't think you need it- until they deprecate onCommand anyway :p
  3. Offline


    Thankyou! so so much!
    It seems to be working correctly :)
    You sir. Are a genius!


    [iConomy] Logging is currently disabled.
    [iConomy] v4.4 (Arcadia) loaded.
    [iConomy] Developed by: [Nijikokun, Coelho]
    PrivateLotto version 1.21 is enabled
    [Lotto] Successfully linked with iConomy.

    My commands dont do anything :(
    iPhysX issued server command: lotto
    Unknown console command. Type "help" for help.
  4. Offline


    Oops! I should've mentioned that you need a plugin.yml, since I didn't see one in your zip :)

    You've got to put your commands in there (just the root commands), and you may as well stick your permissions in there while you're at it, too- you'll need them soon enough.

    Here is NetherGate's plugin.yml, as an example.

    Something like this should do the trick for you, I think:

    name: PrivateLotto
    main: com.iPhysX.PrivateLotto
    version: 0.01
    website: http://forums.bukkit.org
    author: iPhysX
    description : Gambling!
        description: Administer the Lotto
        usage: lottery <params>
        description: Lottery permissions
        type: map
            description: Lottery console command permissions
            type: map
                description: If true, they can use lottery commands
                type: boolean
                default: false
    Though, due to the lameness of YML, you'll probably have issues just copy+pasting that- use it as reference, and consider it an exercise to write your own, I guess :)
  5. Offline


    Thanks alot!
    Everything is working perfect :)
    Real nice of you
Thread Status:
Not open for further replies.

Share This Page