I swore I would never make them again but I did it anyways, where is my restraint? (TBH I was going good for a year or two now, give me credit.)
A couple days ago, a friend of mine Mugi asked me to play some Minecraft with him, and after shaking myself out of shock because I haven't heard that name in a while, I decided to give it a go. Turns out, Minecraft Windows 10 Edition is far worse than normal Java Minecraft, and has way more exploits. In only the first couple days we found ways to instantly kill people and even duplicate items, effectively making us kings of the server. What was even better was that the majority of the user base was simply children playing on tablets, so no real competition here. In order to perfect our craft though, I needed to make a program. Instakill V0 a was a simple java robot that clicked around 600 times with a 2 millisecond delay was the first concoction I made in around 2 minutes just to test the exploit. This worked fine until I had realized I didn't want to keep restarting the program in my IDE to click, and realized I wanted to have a button to activate the spam clicking, so I ventured off into javadocs and google searches trying to figure out how I can globally listen to key presses. I really did not want to create a simple swing program to listen to key presses, and at first there would be no configuration, but after releasing the first program I realized that both Mugi and another friend that we played with had difficulty with the settings I had originally used, it needed to implement some sort of configuration. Then came JNativeHook which did the hard work of hooking into JNI and listening to key and mouse events. But there was one issue, it wasn't some sort of
Mouse.getState(MouseEvent.BUTTON1) where that function alone would return a boolean for the state of the mouse button, it was a simple handler that accepted ONLY listeners. I ended up just adding a volatile field like
private volatile boolean isClicking = false; and checking to see if I was holding down a specific button, and to my surprise that worked relatively well. After around 5 hours or so of tinkering with JavaFX (which is GOAT java ui library btw), I present to you NotHacks!
(Disregard the face, it was just a test image for whether or not I could use the icons elsewhere in the pane...)
This was an interesting projects for a few reasons:
- It was written in Java (while Minecraft for Window 10 is written in C++)
- It was a 'cheat' for a UWP game, which are virtually non-moddable.
- I finally got back into JavaFX and learned the beauty of FXML injection and remembered the singleton pattern.
That's pretty much it however. I won't be releasing the source for it but if you know at least 2% of the Java dev kit, you should be able to piece together your own.