Skip to content

Instantly share code, notes, and snippets.

@FarisR99
Last active August 29, 2015 14:04
Show Gist options
  • Save FarisR99/d9b5a27081fa8cefdb7b to your computer and use it in GitHub Desktop.
Save FarisR99/d9b5a27081fa8cefdb7b to your computer and use it in GitHub Desktop.
MCSGBot bypass
import java.awt.*;
import java.awt.event.KeyEvent;
public class SystemOverride implements Runnable {
public static void main(String[] args) {
System.out.println("Launched SystemOverride.");
SystemOverride systemOverride = new SystemOverride();
systemOverride.start();
systemOverride.typeKeys("/leave");
systemOverride.pressKey(KeyEvent.VK_ENTER);
System.out.println("Shutting down SystemOverride...");
systemOverride.stop();
}
private boolean running = false;
private Thread thread = null;
private Robot robot = null;
public SystemOverride() {
try {
this.robot = new Robot();
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
public void run() {
System.out.println("Started SystemOverride!");
}
public synchronized void start() {
try {
System.out.println("Starting SystemOverride...");
this.thread = new Thread(this, "BotOverride");
this.thread.start();
this.running = true;
Thread.sleep(1000);
} catch (Exception ex) {
}
}
public synchronized void stop() {
this.running = false;
if (this.thread != null) {
try {
this.thread.join(5000);
} catch (Exception ex) {
}
}
System.exit(0);
}
public Robot getRobot() {
return this.robot;
}
public void pressKey(int keyCode) {
if (this.robot != null) {
this.robot.keyPress(keyCode);
}
}
public void typeKeys(String keys) {
try {
this.typeKeys(keys != null ? keys.toCharArray() : null);
} catch (Exception ex) {
}
}
public void typeKeys(char... keyCharacters) {
try {
if (this.robot != null) {
for (char character : keyCharacters) {
this.robot.keyPress(character);
Thread.sleep(500);
}
}
} catch (Exception ex) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment