Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Programming' started by ItzSomebody, May 11, 2017.
Title says it all, how do you do it?
By pressing keys on your keyboard?
More specific this time:
How do you add a method to your compiled class file.
I sense the XY problem. What is the end goal?
I am attempting to setup my own anti-piracy so I don't have to add code to a plugin. Instead, I just run my program that has my anti-piracy code that adds a method and runs it through onEnable().
You learn the absolute beginner basics of java, then keep learning until you feel like a fool for asking this question..
Which, i am almost sure is a troll post anyway..
Edit: Compiled class file? If you mean while java is running, just forget it. Otherwise, decompile it and edit it, or use ASM in your program to add code to it before it is loaded.
ASM is a library that can modify java bytecode, but it cannot modify a loaded class. You would have to loa ASM before the class in question, read the bytecode from the file, modify it, and load it normally with a classloader.
So you're trying to add anti piracy after it's compiled and not reveal in your source code what your anti piracy methods are? A quick run through a decompiler will reveal how you're doing it so it's a waste of time to try to patch it in to the compiled class file.
Just write it in and deal with it getting bypassed because that's what will happen anyways.
Sent from my iPhone using Tapatalk
I noticed Spigot's Antipiracy doesn't show up under a decompile. How do they do that?
EDIT: But of course the it shows up under ByteCode