zhuowei / MCPELauncher

Source code for BlockLauncher, a launcher that patches Minecraft for Android
Apache License 2.0
684 stars 188 forks source link

Using scripts on the server #709

Open KsyMC opened 8 years ago

KsyMC commented 8 years ago
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);

DiegoGTRatty commented 8 years ago

Interesting...

cptcepk commented 8 years ago

How to put in blocklauncher ?

KsyMC commented 8 years ago

@cptcepk make a js file.

DarkTornado commented 7 years ago

!