var multi = false;
function serverCheck(){
new java.lang.Thread({
run : function(){
if(!multi&&Server.getAddress()!=null){
serverConnectedHook(Server.getAddress(), Server.getPort());
multi = true;
}
else if(multi&&Server.getAddress()==null){
serverDisconnectedHook();
multi = false;
}
java.lang.Thread.sleep(100);
serverCheck();
}
}).start();
}
serverCheck();
function serverConnectedHook(ip, port){
print("(ip : "+ip+", port "+port+")");
java.lang.Thread.sleep(400);
net.zhuoweizhang.mcpelauncher.ScriptManager.setLevelFakeCallback(true, false);
makeGUI("S",50,50,3,0,330,test);
}
function serverDisconnectedHook(){
print("disconnected");
}
or
ctx.getWindow().getDecorView().addView(surface);
or
ctx.getWindow().getDecorView().addView(surface);