Noob question: How do I edit the java files for plugins?

Discussion in 'Bukkit Help' started by Typical_Name, Mar 25, 2012.

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

    Typical_Name

    There's a bug in a plugin I'm trying to use for my server. Specifically, the DrugMeUp plugin's effects on chat appear to last infinitely. I'm sure there's a way to fix it without adjusting the programming, but I never really liked the scrambled text feature anyway, so I wanted to delete this part from the code.
    I found the part I need to delete here: https://github.com/hammale/DrugMeUp...src/me/hammale/drugs/DrugsPlayerListener.java

    However, I can't seem to edit the java files in the plugin. Whenever I try to get them into Eclipse so I can modify them, Eclipse freaks out and gives me this error message:
    What am I doing wrong?
     
  2. Offline

    ZeroZX4

    1st of all to decompile jar files simply use any archiver like winrar

    but i suggest tugzip

    http://www.tugzip.com/Downloads.html

    now u would want to edit class files i use for that dirtyJOE

    http://dirty-joe.com/

    i was able to change text message displayed by plugins for example by plugin called anyonesleep (it make that only 1 player in game need to go to bed to make day)

    so like when someone take a nap there was message in english on that "PLAYER NAME take a nap"

    look here how to do it

    !st after u extracted ur jar file u need to find playerlister in this case it was here

    http://i.imgur.com/HgBRs.png

    next in dirty joe u just hit file and navigate to it than u click tab constant pool and in box active search u input part of text u r searching (SIZE of LETTERS while searching IS IMPORTANT) it looks like this

    http://i.imgur.com/x6rkO.png

    than u just save the changes and now you dont add to jar whole folder u extracted from jar but the content of that folder look this is how it should look

    http://i.imgur.com/5K28H.png

    but problem is idk how to edit anything else than chat messages well its cause idk how java works hope this helps u and u will have more luck in doing what u want
     
  3. Offline

    Typical_Name

    I didn't understand any of that...


    I have programs to open jar files and edit java files, but the files give error messages when I try to load them into the program.
     
  4. Offline

    Typical_Name

    Ok, I tried using the program you recommended instead of Eclipse, and while I have absolutely no idea how to operate it (it doesn't appear to let me edit code directly), I was able figure out how to delete methods wholesale, which is all I needed this time around.

    Thanks! :D
     
  5. Offline

    Typical_Name

    I want to edit the plugin again, but this time, instead of just deleting a feature, I want to actually modify it.
    I know where the code I want is, but I have absolutely no idea how to edit it with dirtyJOE.

    The code in the relevant method looks like this:
    Whatever this is, it sure isn't java.

    Help please?

    Ok, I've figured out how to get the data into Eclipse by downloading the source code from https://github.com/hammale/DrugMeUp/downloads. However, now that I've edited the .java file, I can't figure out how to recompile it so that it becomes a .class file. From what I've found from google, it appears that Eclipse should be automatically generating .class files in the bin directory (which I eventually managed to find), however, this is not happening.

    Help please?

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

    ZeroZX4

  7. Offline

    Typical_Name

    Ok, thanks, but... I don't know how to read whatever kind of code this is in. How do I translate it into readable java while still maintaining the functionality of the file?
     
  8. Offline

    ZeroZX4

    so just changing that text there isnt what u need ?
     
  9. Offline

    Typical_Name

    ... I have no clue how to read this non-java code. It doesn't really do me a whole lot of good to be able to edit something if it isn't readable. :(
     
  10. Offline

    ZeroZX4

  11. Offline

    WAZANATOR3998

    Heh i see this on google and i'm doing something similar for a plugin i use, but i don't know any effective way to recompile the java files in eclipse. Anyone have a good way to do it?
     
  12. Offline

    Gravity Retired Staff

    Go to the github page, hit download, download as zip file. Then, download NetBeans (hey! it's an actual java IDE!) click file->open project, and select the folder you got from extracting the zip file. There's your project. To build it, right click and hit clean and build.
     
  13. Offline

    WAZANATOR3998

    h31ix this doesent seem to work, i got netbeans and when i hit open project and click on the folder i extracted it like opens the folder and goes to the last thing of the folder and wont open? Any idea why this is happening?
     
  14. Offline

    Gravity Retired Staff

    wat
     
  15. Offline

    WAZANATOR3998

    h31ix i cant open the src in netbeans....
     
  16. Offline

    Gravity Retired Staff

    I would make a new project and then drop the source that you downloaded into the project, unfortunately it isn't a maven project so you can't just open it up.
     
  17. Offline

    WAZANATOR3998

    h31ix so like rebuild the plugin?
     
  18. Offline

    Gravity Retired Staff

    No not rebuild it, just make a new project, go to the project folder, and put all the sourcefiles from github into the project you created. Also, you can just reply to me you don't need to tag me every time ;)
     
  19. Offline

    WAZANATOR3998

    Thanks for the help. Sorry, i'm pretty new to the fourms.
     
  20. Offline

    riyyi

    What I like to use is JD-GUI (to decompile) and then just copy the entire folder to Eclipse, edit the plugin, and then recompile the plugin.
     

    Attached Files:

Thread Status:
Not open for further replies.

Share This Page