What is wrong with this?

Discussion in 'Plugin Development' started by Mrchasez, Oct 11, 2011.

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

    Mrchasez

    Kind of fixed
     
  2. Have you given yourself the required permission?
     
  3. And: Is the command registered in the plugin.yml? ;)
     
  4. If it wasn't wouldn't it give an error saying command not found? (or something similar :p )
     
  5. Offline

    Mrchasez

    @randomer679
    @V10lator

    Yes its in Plugin.yml
    and no errors a ( You dont have permission!) error
    was just added, and yes i have permissions. Nothing happens.
    On start up it says [Ptweaks] Ram logging enabled!
    In game everything seems to work , No console errors at all.
    Just when i /ram it sends /ram
     
  6. No... it just loops the command back to the sender... ;)
     
  7. Can you post your plugin.yml? :)

    Oh right :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
  8. @Mrchasez: Your onCommand doesn't handle the /ram command...
    //EDIT: Confused... why did you post 2 plugins? :confused:

    //EDIT²: The first 0one executes onEnable of the second one, so the second one isn't a real plugin? This is... confusing... and wrong because the onCommand of the second one will never be called!
     
  9. Offline

    Mrchasez

    Its not plugin.yml
    I do not have them integrated right. ( i have never integrated code before)

    What do i have to do to Ptweaks.java to make it register Ram.java
    I am sure that is the problem Plugin.yml has
    I am just new to integrating code like this.
    Code:
      ram:
        description: Logs Ram Usage
        usage: |
               /ram
        aliases: []
    Thats the issue, I am a noob at that.
    The two plugins should be registered as one.
    (i have never done it before though so i am lost)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
  10. Btw wouldn't it be better to use a PluginManager instance to enable your plugins? You seem to be running the onEnable method manually e.g.
    Code:
    PluginManager pm = this.getServer().getPluginManager();
    pm.enablePlugin(RAM);
    etc.

    I just wanted to see what you get when your plugin returns false for the onCommand (it just returns /ram)

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

    Mrchasez

    Like someone else told me, When i try to ditch Ram.java and just added it to Ptweaks.java
    I got a Oncommand error, That is why i made it a new class.
     
  12. Please merge the on* functions of the two classes into one or split them to two plugins...
     
  13. Offline

    Mrchasez

    That is where im having issues!
    I want to ditch ram.java and just have it be all inside Ptweaks.java
    But how do i do that?

    When i did that (to start with)
    I got an Oncommand error, So how would i go about doing it?
     
  14. Have you tried keeping the ram class but just make it a normal empty class with one method (getRam() for example) and use your onCommand in your main plugin to call it when the player types /ram (use else if to check it after checking for "ptml")
     
  15. Offline

    Mrchasez

    Thats what i dont know how to do though lol
    I have been coding with java for a while now, but only strarted with bukkit and minecraft not to long ago.
    This is my first time having to do something like this
     
  16. Quick&Dirty: http://pastie.org/2680485
     
  17. Offline

    Mrchasez

    With that should i even keep ram.java
    or just use it for a Onenable message?
     
  18. This are the two classes you posted merged into one! (And not-so-dirty: http://pastie.org/2680493).
    So forget about the ram.class ;)
     
  19. This is my own example just to add to it :p I've only edited it for RAM though because I haven't got your other classes :p
    http://pastie.org/2680500 and http://pastie.org/2680491
    EDIT: haha V10lator did the same thing in one class :p I think its better to keep other methods outside the main plugin class :)
     
  20. Offline

    Mrchasez

    @V10lator

    Thanks That is what i was trying to do, OH i forgot else if
    I Just tried to add a second command D:
    I knew i was missing something so simple!!

    I get an error with cmd though
    i did with logger but i just had to import java.util.logging.Logger;
    cmd cannot be resloved.

    Thank you so much for redoing the whole thing, you could have pointed out my dumb errors Dx

    hmm now /ptml dont seem to work for me *horrible luck*

    (yeah i thought so)
    /ram
    Code:
     Unexpected exception while parsing console command
    org.bukkit.command.CommandException: Unhandled exception executing command 'ram' in plugin Ptweaks v1.6
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:163)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:358)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:354)
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:506)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:485)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.Error: Unresolved compilation problem:
    cmd cannot be resolved
    
    /ptml info
    Code:
    null
    org.bukkit.command.CommandException: Unhandled exception executing command 'ram' in plugin Ptweaks v1.6
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:163)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:757)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:715)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:358)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:722)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:92)
    cmd cannot be resolved
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:471)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.Error: Unresolved compilation problem:
    at performancetweaks.bin.org.jbls.mrchasez.PerformanceTweaks.onCommand(PerformanceTweaks.java:46)
    ... 12 more
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
     
  21. Yea, quick&dirty... ;)
    Change cmd to command (line 42).
     
  22. Offline

    Mrchasez

    So /ptml is working again
    but /ram just sends /ram again -.-

    Which brings me back to square one
     
  23. Post your new class? :)
     
  24. Offline

    Mrchasez

  25. Offline

    Celeixen

    Remember you need to return true or then it will just send the player the correct usage in the plugin.yml.
     
  26. Did you update your permissions to ram.has? Because the new class has the permissions ram.has instead of the old permission which was just ram :)
     
  27. Offline

    Mrchasez

    Its been ram.has 0.0
     
  28. Were you still using just ram?
     
Thread Status:
Not open for further replies.

Share This Page