Solved How to "Handle Reloads"

Discussion in 'Plugin Development' started by Ambamore2000, Dec 23, 2013.

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

    ThunderWaffeMC

    Wow. Just wow. You can't just get someones coding in your plugin for everything you want to do. You must learn it yourself. I have no idea why on earth you would cast Object to that. Please learn the API!
     
  2. Offline

    Ambamore2000

    What da fwaq? Where do I learn the API?
     
  3. Offline

    ThunderWaffeMC

    Well for starters, do you know the basics of Java? And do you have any programs to help you with coding (for example; I use eclipse).
     
  4. Offline

    CeramicTitan

    That code in the tutorial is example code. It not going to do what you think its going to do.
    I have an example: https://github.com/CeramicTitan/Ble...a/com/chasechocolate/bleed/Bleed.java#L41-L69 Notice how I store all of the my entries on enable. This is what the tutorial tries to point out. The onEnable and onDisable methods are both called on a server reload. On a server reload hashmaps, lists, etc. are all cleared. As a counter measure from it being cleared you need to keep storing your entries on enable.
     
    mrkirby153 and ThunderWaffeMC like this.
  5. Offline

    mrkirby153

    @Ambamore200
    C'mon you shouldn't be begging people to help you. IMHO, a real developer stays committed and will post their stuff on the forums. How hard is it to hover over the red lines and see what it has to say and post it here? Btw didn't you say you could neither talk no hear on Skype?

    Also, you wanted to store a value into a hashmap on reloads? You can just write data to the hashmap onEnabled. Like CeramicTitan said, hashmaps arraylists and variables are cleared when your plugin is disabled. Correct mr if I'm wrong but I think it's part of java'a GC?
     
    ThunderWaffeMC likes this.
  6. Offline

    Ambamore2000

  7. Offline

    CeramicTitan

    You are correct. JavaGC is used to stop memory leaks.
     
  8. Offline

    Ambamore2000

    I still don't get it...
     
  9. Offline

    mrkirby153

  10. Offline

    CeramicTitan

    ThunderWaffeMC and mrkirby153 like this.
  11. Offline

    Ambamore2000

    I mean, I get the part that it is an example now and all that, but I don't get what I have to replace what with what.
     
  12. Offline

    mrkirby153

    @Ambamore20

    You've gotta trust us on this. Google is your best friend :) Along with StackOverflow for regular java issues.

    CeramicTitan
    I remember when I was a wee lad of a bukkit developer. I googled most of the simple problems FIRST and then asked some of the more complicated problems here. Ambamore20 I suggest you heed this advice
     
  13. Offline

    Ambamore2000

    :\ How do I google something like:

    "What do I replace in for (Player player : this.getServer().getOnlinePlayers()) {
    playerList.put(player, playerData(player));"

    I guess I'll be watching and doing it HIS way, and mess up alot, and hafta restart like 20 times. Thanks sooooo much/

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

    mrkirby153

    Ambamore2000
    I'm serious. You really just need to heed the advice we are giving you. No need to restart 20+ times
     
    ThunderWaffeMC likes this.
  15. Offline

    Ambamore2000

    But, I don't GET IT.
     
  16. Offline

    mrkirby153

    Ambamore2000

    So, you don't get hovering your mose over the red squiggly lines and seeing what pops up? Or click the "X" on the sidebar?
     
  17. Offline

    Ambamore2000

    I understand that, I just don't know which one to pick!
     
  18. Offline

    CeramicTitan

    I remember that as well :) I remember I got abused, laughed at and pretty much bullied when I first started out.
     
    jimuskin likes this.
  19. Offline

    Ambamore2000

    :\ Tell me how it ended. You made 10 plugins. That's what I'd want to do.
     
  20. Offline

    CeramicTitan

    I started off with small stuff. If you look at my stuff , it really isn't all that advanced. Through looking through the forums and chatting to developers, I acquired new skills and techniques. I am now confident I can do most things when it comes to Bukkit Programming.
     
  21. Offline

    mrkirby153

    Ambamore2000

    If you're debating between clicking the "X" and hovering over the squiggle, either one works. If there is more than one error, then you put ALL of the errors that show up
     
  22. Offline

    Not2EXceL

    Honestly if you go and learn Java to a decent proficiency, learning the Bukkit API will be a piece of cake. And you really won't ask any stupid questions.

    It sounds like you don't know Java, or at least to a decency, and therefore having trouble learning this API.
     
    Cirno, mrkirby153 and ThunderWaffeMC like this.
  23. Offline

    Cirno

    Another thing I would like to point out is that is misleading; It declares "handling reloads", but the given code shows you an example of how to create memory leaks because the CraftPlayer (well, technically just a Player) object is now stuck in memory, forever referenced, and likely will stick there due to the task that Bukkit creates to cancel all tasks for that plugin when said plugin is disabled.
     
  24. Offline

    DrJava

  25. Offline

    CeramicTitan



    No. He doesn't.
     
    DrJava likes this.
  26. Offline

    Bart

    I'm sorry to be rude but:

    Leave. Learn (at least the basics of) Java. Look at Bukkit API. Find simple things you can do. Build up from there.

    I understand you may want to get a plugin done as soon as possible for a server but making plugins isn't easy and you have to start from the bottom and move up to the top :)
     
  27. Offline

    Ambamore2000

    That's what I'm doing bitches.
     
  28. Offline

    arigatou

    I'm surprised so many people stayed so long trying to keep helping you.

    Next time you need help, don't be so unappreciative and keep begging and asking for direct code to do what you want when you don't even understand the code. At your current level, you will not be able to code any plugin, no matter how much someone on this forum, or any other forum, helps you.

    You have to know what you're doing to code a plugin, and it is evident you do not know the basics of Java nor Bukkit. At this point, watching videos will NOT help you because you do not already have an existing background knowledge of coding for any language. Most videos assume you know basic programming logic and you do not (see: unable to determine that you had not imported anything and tried to use functions not inside your program).

    As Bart said, take a break from trying to code plugins and go actually learn a language, you're not learning a language here by asking people for code and repeatedly saying "I don't get it, I don't get it" because no matter how many different ways it's explained to you, you WON'T get it, because you haven't studied Java nor Bukkit.

    And finally, falling back to cursing like that only shows your immaturity and unappreciative attitude.

    You won't get very far with that on this forum, or any for that matter.
     
    CeramicTitan and spoljo666 like this.
  29. Offline

    Ambamore2000

    <Learned XML, YML,>
     
  30. Offline

    NathanWolf

    XML and YML are file markup formats, completely different (and far less complex) than a programming language like Java.

    Learning a programming language is really akin to learning a foreign language. Each programming language has it's own vocabulary and syntax.

    Furthermore, there are basic concepts common to many languages, such as design patterns and constructs (if/else, imports, for/while, etc) that should be understood at a base level before trying to learn a specific language.

    I don't necessarily agree that jumping right into plugin programming is a bad way to go, but there are simpler methods. Finding a basic Java tutorial (google for Sun Java Tutorial or similar) and see if you can get a simple program to compile and run. Hello, World!

    You won't find a whole lot of help here until you at least understand the basics of Java, we are here to help with Bukkit specific issues and questions, we can't really teach you Java.

    And there's no reason to be disrespectful.
     
    Garris0n and spoljo666 like this.
Thread Status:
Not open for further replies.

Share This Page