Solved Code limit... (Fixed my self)

Discussion in 'Plugin Development' started by LeonTG77, Sep 17, 2014.

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

    LeonTG77

    So I got
    Code:
    The code of method onCommand2(CommandSender, Command, String, String[]) is exceeding the 65535 bytes limit
    When I coded a command that is fairly long, but It needs to be that long, I was wondering what that means and how to fix?

    On command code starts at line 237 and ends at 9599
     
  2. Offline

    Garris0n

    It doesn't need to be that long. There is absolutely no possible situation in which a method ever needs to be that long.

    If you want help shortening it or splitting it up, post the class at pastebin.com or gist.github.com.
     
    Gamecube762 and Rocoty like this.
  3. LeonTG77 Wow, never seen anyone manage to get that on here before. No matter. I disagree with your "it needs to be that long". Break down your method a bit. Please post your code somewhere (I prefer gist) if you'd like some advice on how to do that.

    Edit: Ninja'd by a good 2 minutes. Remind me not to leave pages open.
     
    Rocoty likes this.
  4. Offline

    ChipDev

    Meh, Chuck norris could code that in about a minute.
    Maybe split it into more than one class? :/
    Just NEED to put in sig :3
     
  5. Offline

    Skionz

    Whats the command do? I'm curious :0
     
    ChipDev likes this.
  6. Offline

    Da_Co0k1eZ

    How did you even manage this.
    Can we see code?
     
    Nedinator likes this.
  7. Offline

    mazentheamazin

    LeonTG77
    Excuse me for being harsh, but any programmer with a decent mind would know that having that many lines of code is absolute stupidity. Quite frankly, code should be split out and organized throughout classes and not dumped all into one method. If you do think it needs to be that long, I recommend you to go back, learn some Java and how programming works.

    ....
    and then there's ROTN
     
  8. Offline

    themuteoneS

    I'd love to see the offending code. Though really, there must be some serious copy paste going on for that error message. Either that or the entire method wasn't written like Java was supposed to written which come to think of it is the case anyway. (No offence :p)

    Oh and lol ROTN
     
  9. Offline

    Gamecube762

    A minute?!? That's an understatement!
     
    ChipDev likes this.
  10. Offline

    Dudemister1999

    Who knows! Maybe he made a complete LUA parser and made the player input the code itself! I've been sitting here for a few minutes, trying to conceive of such an amazing command, it requires OVER NINE THOUSAAAAAAND! (Needed that in there somewhere, sorry.) lines of code. I really do want to see it.
     
  11. Offline

    themuteoneS

    <sarcasm>Are you saying that's not a thing people do? Implementing LUA compilers?</sarcasm>

    EDIT: For those who don't get it, lua is a scripting language (not compiled)
     
  12. Offline

    Dudemister1999

    themuteoneS <sarcasm level="Too much"> But what if he just wanted a LUA compiler, a G++ / C++ compiler, and an Android API compatible compiler, to be run by a single command depending on arguments? I can't blame him for that, I do that all the time! Why do you think my plugin(s) (Maybe not existant) are so popular? All your compilers are belong to my command! </sarcasm>
     
    shmkane likes this.
  13. Offline

    themuteoneS

  14. Offline

    Cirno

    General rule of thumb is that if use more than 70ish lines inside a single method (minus anonymous classes and such), it's too long, IMO.
     
    Gamecube762 and Dudemister1999 like this.
  15. Offline

    RawCode

    why there is no unsee and dislike buttons?

    this thread is trollish joke.
     
    1 person likes this.
  16. Offline

    thomasb454

    I'd love to see that class...
     
  17. Offline

    Techy4198

    Yeah, show us the code. I dare you.
     
  18. Offline

    Epicballzy

    Is your whole plugin in that one command? Wow... If you have things that can be put into a method inside a different class... DO IT!
     
  19. Offline

    Skionz

    Been waiting a day and now I am just more curious :(
     
  20. Offline

    Rocoty

    LeonTG77 You're writing history, man. Show us the code, that we can help you figure out how to clean it up.
     
  21. Offline

    BetaNyan

    There's a thing called creating a new class. You should try that. If you can't figure out how to do that, create another method, and put it inside your onCommand method.
     
  22. Offline

    Monkey_Swag

    I'm pretty sure we're not going to see his code.
     
    es359 likes this.
  23. Offline

    Techy4198

    Monkey_Swag You're probably right, he hasn't commented once since the original post. This is probably just a huge troll. If so, he was actually rather successful in trolling us all.
     
  24. Offline

    Rocoty

    BetaNyan You can't declare a method directly within another method. I'm sure you meant calling the new method from the onCommand method though. So I'm pointing this out to avoid confusion.
     
  25. Offline

    RawCode

    you can define method inside method, but you will need nested class declaration for this.

    also lambda exprs do this at lower level
     
  26. Offline

    mythbusterma

    RawCode

    You can't declare an inner class inside a method, however you can implement an interface via anonymous inner classes, or the simplified form thereof, lambda expressions.

    Nevermind, still not good practice, however.
     
  27. Offline

    xTrollxDudex

  28. Offline

    Rocoty

    Yes. Like I said. You cannot DIRECTLY declare a method inside a method.
     
  29. Offline

    LeonTG77

    I already solved it myself this same day as I made the thread, so I ain't bothering to read all the comments xD
     
  30. Offline

    Skionz

    LeonTG77 Can you post the original code? I'm still interested. 9000 lines would give me headache.
     
    thomasb454 likes this.
Thread Status:
Not open for further replies.

Share This Page