package Ġnet . e ve 0 4 1 5 . mc . websocket integration Ċ Ċ import Ġnet . e ve 0 4 1 5 . mc . websocket integration . type . Log EventType Ċ import Ġnet . ky ori . ad venture . text . Component Ċ import Ġnet . ky ori . ad venture . text . serializer . plain . Plain Text Component Serializer Ċ import Ġorg . json . JSONObject Ċ import Ġjava . util .* Ċ Ċ class ĠWeb socket Builder Ġconstructor ( private Ġval Ġinstance : ĠWeb socket Manager ) Ġ{ ĊĠ Ġprivate Ġval Ġobj Ġ= ĠJSONObject () ĊĠ Ġprivate Ġval Ġruntime Ġ= ĠRuntime . get Runtime () ĊĊĠ Ġfun Ġbasic (): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġval Ġu ptime Ġ= ĠSystem . nano Time () Ġ- Ġinstance . server StartTime ĊĠĠĠ Ġval Ġtemp Sec Ġ= Ġu ptime Ġ/ Ġ( 1 0 0 0 Ġ* Ġ 1 0 0 0 Ġ* Ġ 1 0 0 0 ) ĊĠĠĠ Ġval Ġdays Ġ= Ġ( temp Sec Ġ/ Ġ( 2 4 Ġ* Ġ 6 0 Ġ* Ġ 6 0 )) Ġ% Ġ 2 4 ĊĠĠĠ Ġval Ġhours Ġ= Ġ( temp Sec Ġ/ Ġ( 6 0 Ġ* Ġ 6 0 )) Ġ% Ġ 2 4 ĊĠĠĠ Ġval Ġminutes Ġ= Ġ( temp Sec Ġ/ Ġ 6 0 ) Ġ% Ġ 6 0 ĊĠĠĠ Ġval Ġseconds Ġ= Ġtemp Sec Ġ% Ġ 6 0 ĊĠĠĠ Ġval Ġtime Ġ= Ġ"$ days :$ hours :$ minutes :$ seconds " ĊĊĠĠĠ Ġobj . put (" platform ", Ġinstance . platform Type . value ) ĊĠĠĠ Ġobj . put (" server Id ", Ġinstance . server ID ) ĊĠĠĠ Ġobj . put (" server Name ", Ġinstance . server Name ) ĊĠĠĠ Ġobj . put (" total Memory ", Ġ( runtime . total Memory () Ġ/ Ġ 1 0 4 8 5 7 6 L ). toString () Ġ+ Ġ" MB ") ĊĠĠĠ Ġobj . put ( ĊĠĠĠĠĠ Ġ" used Memory ", Ġ(( runtime . total Memory () Ġ- Ġruntime . free Memory ()) Ġ/ Ġ 1 0 4 8 5 7 6 L ). toString () Ġ+ Ġ" MB " ĊĠĠĠ Ġ) ĊĠĠĠ Ġobj . put (" free Memory ", Ġ( runtime . free Memory () Ġ/ Ġ 1 0 4 8 5 7 6 L ). toString () Ġ+ Ġ" MB ") ĊĠĠĠ Ġobj . put (" uptime ", Ġtime ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġmessage ( name : ĠString , Ġuuid : ĠUUID , Ġmessage : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" server Id ", Ġinstance . server ID ) ĊĠĠĠ Ġobj . put (" name ", Ġname ) ĊĠĠĠ Ġobj . put (" UUID ", Ġuuid ) ĊĠĠĠ Ġobj . put (" message ", Ġmessage . replace (" Â§ .", Ġ"")) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġmessage ( name : ĠString , Ġuuid : ĠUUID , Ġmessage : ĠComponent ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" server Id ", Ġinstance . server ID ) ĊĠĠĠ Ġobj . put (" name ", Ġname ) ĊĠĠĠ Ġobj . put (" UUID ", Ġuuid ) ĊĠĠĠ Ġobj . put ( ĊĠĠĠĠĠ Ġ" message ", ĊĠĠĠĠĠ ĠPlain Text Component Serializer . plain Text (). serialize ( message ). replace (" Â§ .", Ġ"") ĊĠĠĠ Ġ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġstatus ( online Players : ĠInt , Ġmax Players : ĠInt , Ġt ps : ĠDouble ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" online Players ", Ġonline Players ) ĊĠĠĠ Ġobj . put (" max Players ", Ġmax Players ) ĊĠĠĠ Ġobj . put (" tps ", Ġt ps ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġset ServerName ( port : ĠInt , Ġname : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put ( port . toString (), Ġname ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġlog ( event : ĠLog EventType , Ġname : ĠString , Ġuuid : ĠUUID ?, Ġip : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" server Id ", Ġinstance . server ID ) ĊĠĠĠ Ġobj . put (" event ", Ġevent . name ) ĊĠĠĠ Ġobj . put (" name ", Ġname ) ĊĠĠĠ Ġobj . put (" UUID ", Ġuuid ) ĊĠĠĠ Ġobj . put (" ip ", Ġip ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġset Address ( address : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" address ", Ġaddress ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġclient Type ( type : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" type ", Ġtype ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġclient Version ( version : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" version ", Ġversion ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġmods ( mods : ĠInt ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" mods ", Ġmods . toString ()) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġconnecting Server ( server : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" to Server ", Ġserver ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġprevious Server ( server : ĠString ?): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" from Server ", Ġserver ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġconnected Server ( server : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" current Server ", Ġserver ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġkick ( reason : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" reason ", Ġreason ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġkick ( reason : ĠComponent ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" reason ", ĠPlain Text Component Serializer . plain Text (). serialize ( reason )) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun Ġfulfill ( ful fill : ĠString ): ĠWeb socket Builder Ġ{ ĊĠĠĠ Ġobj . put (" ful fill ", Ġfulfill ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġfun ĠtoJSON (): ĠJSONObject Ġ{ ĊĠĠĠ Ġreturn Ġthis . obj ĊĠ Ġ} Ċ } Ċ