Skip to content

Commit

Permalink
Create timeshow.js
Browse files Browse the repository at this point in the history
  • Loading branch information
liumingedwin authored May 5, 2020
1 parent fedf998 commit 2ce4cf5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mod/timeshow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var inter;
module.exports.onmessage=function(choise,message,conn){
if(choise=="create")
{
inter=setInterval(function(){
var time1 = new Date().format("yyyy-MM-dd HH:mm:ss");
conn.sendcommand(`/title @a actionbar 时间:${time1}`);
},2000);
return true;
}
else{
if(message.body&&message.body.eventName&&message.body.eventName=="PlayerMessage"){
var lmessage=message.body.properties.Message;
if(lmessage=="clearinterval")
clearInterval(inter);
}
}
}

0 comments on commit 2ce4cf5

Please sign in to comment.