add server message, server chown and chat clearing
This commit is contained in:
parent
3381420a82
commit
0799979fd2
3 changed files with 66 additions and 9 deletions
12
client.ts
12
client.ts
|
|
@ -17,6 +17,8 @@ type MessageEvents = {
|
|||
rooms: (rooms: proto.ServerMessage_Room[]) => void;
|
||||
join: (join: proto.ServerMessage_Join) => void;
|
||||
leave: (id: string) => void;
|
||||
chown: () => void;
|
||||
serverMessage: (serverMessage: string) => void;
|
||||
};
|
||||
|
||||
interface Player {
|
||||
|
|
@ -140,8 +142,16 @@ export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvent
|
|||
console.log(data);
|
||||
return;
|
||||
}
|
||||
|
||||
if(decode.event == SEventType.CHOWN) {
|
||||
this.room.owner = decode.chown;
|
||||
this.emit("chown");
|
||||
}
|
||||
if(decode.event == SEventType.MESSAGE) {
|
||||
this.emit("serverMessage", decode.message);
|
||||
}
|
||||
if (decode.event == SEventType.RATELIMIT) {
|
||||
console.log("Ratelimit reached! Type: " + decode.rateLimit);
|
||||
console.log("Ratelimit reached! Time left: " + decode.rateLimit);
|
||||
}
|
||||
if (decode.event == SEventType.JOIN) {
|
||||
this.players.set(decode.join!.id, decode.join!);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue