Skip to content

Instantly share code, notes, and snippets.

@md-5
Created July 16, 2012 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save md-5/3121917 to your computer and use it in GitHub Desktop.
Save md-5/3121917 to your computer and use it in GitHub Desktop.
Test javascript script for MC-Bot
importPackage(Packages.com.md_5.bot.mc);
importPackage(Packages.java.lang);
var connection = new Connection("127.0.0.1", 25565);
connection.setUsername("md_5");
if (connection.connect()){
// read thread
new Thread(function run(){
while (connection.isConnected()){
}
}).start();
// write thread
new Thread(function run(){
while (connection.isConnected()){
}
}).start();
} else {
out.println("Failed to connect.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment