File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ export default class GameServer {
147147 this . arena = new ArenaClass ( this ) ;
148148
149149 this . _tickInterval = setInterval ( ( ) => {
150- if ( this . clients . size ) this . tickLoop ( ) ;
150+ if ( this . clients . size ) this . tickLoop ( ) ; // Don't tick empty games
151151 } , config . mspt ) ;
152152 }
153153
@@ -159,6 +159,10 @@ export default class GameServer {
159159 public broadcastPlayerCount ( ) {
160160 this . broadcast ( ) . vu ( ClientBound . PlayerCount ) . vu ( GameServer . globalPlayerCount ) . send ( ) ;
161161 }
162+ /** Sends a notification to all clients connected to this game server. */
163+ public broadcastMessage ( text : string , color = 0x000000 , time = 5000 , id = "" ) {
164+ this . broadcast ( ) . u8 ( ClientBound . Notification ) . stringNT ( text ) . u32 ( color ) . float ( time ) . stringNT ( id ) . send ( ) ;
165+ }
162166
163167 /** Ends the game instance. */
164168 public end ( ) {
You can’t perform that action at this time.
0 commit comments