Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
- var seconds = 3;
- function countdown() {
- ctx.runOnUiThread(new java.lang.Runnable({
- run: function() {
- new android.os.Handler()
- .postDelayed(new java.lang.Runnable({
- run: function() {
- if(seconds > 0) {
- clientMessage(seconds + "...");
- seconds--;
- eval(countdown());
- } if(seconds == 0) {
- clientMessage(seconds + "...");
- afterCountdownHook();
- }
- }
- }), 1000);
- }
- }))
- };
- //call countdown() whenever you want to start the countdown
- function afterCountdownHook() {
- //this hook will run when the countdown ends
- //add your own code here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement