Using the CBDC-Injector
As of DisguiseCraft version 2.6, this is no longer needed to have disguise PVP on your server!
This page will teach you how to use the CBDC-Injector program to enable disguise PVP on your server.
The injector program puts the necessary class files into your CraftBukkit jar. The DisguiseCraft plugin is then capable of detecting the modified jar and will activate PVP automatically. (You will be notified via the console.)
This is a standalone Java program, not a Bukkit plugin.
How To Use:
Here is the quick and simple. If it doesn't work for you, you may want to continue reading.
- Put your unmodified CraftBukkit jar file into an empty folder
- Place the CBDC-Injector program into the same folder
- Run the injector program by either double-clicking its icon or using "java -jar CBDC-Injector.jar"
- A new CraftBukkit jar file with "-DC" in its name has been created
- Use this new file to run your server
Will it work with your CraftBukkit build?
An up-to-date changes archive is needed for every DisguiseCraft update. This is because we compile the plugin against the injected jar. (Our Jenkins even injects a jar for every build)
What does this mean for you?
It means that when you use the injector, it is inserting the files for the CraftBukkit version that the most recent DisguiseCraft file was listed to work with.
What about other newer/older CraftBukkit versions?
So long as there is no difference between the NetServerHandler class in the build that the changes archive was made with and the build you are injecting, the injector will work fine. The injection will also fail if there was a change in Vanilla MineCraft server obfuscation. This generally means that the injections should work over whole MineCraft server versions and not break over different CraftBukkit builds for the same version.
Explanation:
After cloning Bukkit and CraftBukkit's source code from GitHub, we add in the necessary changes to allow for the melee attacking of disguised players. We then compile all of this using Maven. Afterwards, we place all of of the modified class files into an archive file which is then uploaded to our website.
The injector program downloads this file and decompresses it along with the CraftBukkit file placed in the folder alongside it. First it checks the changes properties file (CBDC.txt) for any special changes such as file deletions. Then it copies over all the previously archived modified files. These are mainly the new class files. After they are all copied, the program compresses all the files into a new jar archive with the name ending with "-DC" as an indicator. Before exiting, the injector deletes all now unnecessary temporary files and folders.
Upon loading, DisguiseCraft checks if the PlayerInvalidInteractEvent
class has been loaded up by the JVM. If it has, then the CraftBukkit jar file must have been modified for disguise PVP. DisguiseCraft then begins listening for this disguise-hit event.
That's how it all works :)
Important Notes:
- If your server host does not allow you to edit the run script and your server jar has a completely different name (e.g. server.jar), then you'll want to have two copies of the modified server file in your server directory. One would be the conventionally named file which DisguiseCraft would detect, and the other would be the server file actually being run.
- We plan to remedy this soon by finding the best method of detecting the running jar file.
- We plan to remedy this soon by finding the best method of detecting the running jar file.
Trivial Notes:
- Our Jenkins downloads the latest CraftBukkit stable build and runs the injector before every time it compiles DisguiseCraft
- We must update our changes archive for new CraftBukkit builds before we can actually start compiling DisguiseCraft for them
- This means that new features and releases now come out slower, but archive file updates are guaranteed
- This whole injector work-around is a result of the CraftBukkit devs not accepting our ticket and pull requests
- Their decision did make sense as they are providing a framework, not features
- As of CB 1.2.5-R4.0, the program also deletes files as well as injects them. This was necessary in order to bypass the CraftBukkit jar's archive checksum verification.
- The manifest file is also changed so that the version of CraftBukkit running (as stated in the console) ends with "-DC"
- As of DC 2.4, DisguiseCraft now checks for a modified CraftBukkit jar through reflection (detecting the injected event).
Don't trust the injector?
Here's a link to the program's source code. Feel free to look through for malicious code. With this, you should keep in mind that you use the injector at your own risk.
Still don't understand?
Feel free to use the comment section of this page to ask for assistance. Hopefully one of the developers or other server admins will be around to help you.
If there was some sort of error, be sure to run the program from the console so that you can supply us with a log.
He didn't state that it is an executable jar file, that means you click on it and use it, its not for putting in your "plugins" folder. First put CBDC-Injector in the folder where your CraftBukkit jar is located, which should be in the root of your server folder. Once that is done then shut your server down if it isn't already and double click on the jar. This takes your old CraftBukkit jar and modifies it for PVP, naming it [yourcraftbukkitnamehere]-DC.jar should also add 2 folders one called the name of the new CraftBukkit jar and one called, "changes" for me there was nothing in either folder and I have no idea what they are for, maybe Devil_Boy can explain it for you. Once this is done then just delete your old CraftBukkit jar and rename [yourcraftbukkitnamehere]-DC.jar to [yourcraftbukkitnamehere].jar then you should be able to start your server back up again with no problem! Last here is the download for CBDC-Injector:
http://dl.dropbox.com/u/35121667/DC/CBDC-Injector.jar
I hope this helps all that are as confused as I was!
Edit:
CBDC-Injector only supports up to "git-Bukkit-1.2.5-R1.0-b2149jnks" as far as I know. That means if you have a beta build or dev build then it probably wont be able to edit your CraftBukkit jar correctly. I don't know if you can do it manually but there is a class in "CBDC-Injector.jar\pgDev\DisguiseCraft\Injector" and you might be able to just drag it into the CraftBukkit jar I don't know.
Note: There are some more classes in "CBDC-Injector.jar\org\eclipse\jdt\internal\jarinjarloader" but I don't know what those are for either.
Any updates for CB#2203?
@predawnia
Just updated ;)
@Nabakin
Brilliant observations :) I haven't even gotten this documentation started XD
Those folders are where the .jar files are decompressed into so that they can be manipulated. I just forgot to have them completely deleted afterwards. The latest version of the injector should delete them.
The injector downloads this archive of necessary changes: http://dev.pinoygamers.info/cbdc/changes.zip
If you want to implement them manually just extract the changes archive into the craftbukkit jar.
Ugh, this is driving me mad.
I really like the DC plugin for my private server with ym friends, but its something of a cheap way out of pvp because of the way it works.
i downloaded the injector, but it wont work when i double click it, it just opens the jar with winrar.
i want to try the second way of running it, but i have no idea what it means.
using "java -jar CBDC-Injector.jar"
how do i do this?
:<
also, i tried to inject the change files manually like the comment below suggests, i download the .jar and dragged all the files from it to my craftbukkit.jar, but then the whole thing just failed to launch.
help please?
@Flameswy
After R4.0, in order to do it manually, you must also delete the BUKKIT.RA and BUKKIT.SF files from the CraftBukkit jar's META-INF folder.
For the second way of running it, you enter that command through the console or make a batch file that executes it for you. Make sure that batch file is in the same folder as the injector ;)
What in Craftbukkit is missing to allow for this to be a plugin instead of an injection?
@megabytes
https://bukkit.atlassian.net/browse/BUKKIT-1145
We keep the injector a separate program rather than a plugin, because we wish to make sure that people understand what they are doing. This way, they aren't surprised if a plugin with unconventional hooks like ours begins to act unusually.
@Devil_Boy
Is the source available? I'd like to see what exactly is happening/necessary here.
@megabytes
I wrote exactly what is happening on the page above :P
https://gitorious.org/disguisecraft/dc-injector
When I run the server it says it's corrupted.
@Devil_Boy
there is no bukkit.ra
@agent5514
Sorry, I meant BUKKIT.RSA. It is inside the META-INF folder.
Would it be possible to add more support for
??? When this modifies craftbukkit it just lags like hell... And ends up crashing
@kahlilnc
You'd really want to just modify and compile it's source on your own. If needed, I can send you the diffs.
@kahlilnc
By version 2.6 you will no longer need to use this injector program. According the md_5, our method will be compatible with custom CraftBukkit versions such as CB
++
and CB--
I get errors when I use this... I get "java.net.ConnectException: Connection timed out: connect" which is followed by a very large error.
@coolo1
You don't need this anymore ;)