fix mod tools packet listener

This commit is contained in:
dank074 2021-10-19 16:41:13 -05:00
parent 8b4a09bdf6
commit c959bbc255
4 changed files with 9 additions and 8 deletions

View File

@ -20,10 +20,10 @@ export const ModToolsChatlogView: FC<ModToolsChatlogViewProps> = props =>
{ {
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if(!parser || parser.data.roomId !== roomId) return;
setRoomChatlog(parser.data); setRoomChatlog(parser.data);
}, [setRoomChatlog]); }, [roomId, setRoomChatlog]);
CreateMessageHook(ModtoolRoomChatlogEvent, onModtoolRoomChatlogEvent); CreateMessageHook(ModtoolRoomChatlogEvent, onModtoolRoomChatlogEvent);

View File

@ -32,13 +32,15 @@ export const ModToolsRoomView: FC<ModToolsRoomViewProps> = props =>
{ {
const parser = event.getParser(); const parser = event.getParser();
if(!parser || parser.id !== roomId) return;
setLoadedRoomId(parser.id); setLoadedRoomId(parser.id);
setName(parser.name); setName(parser.name);
setOwnerId(parser.ownerId); setOwnerId(parser.ownerId);
setOwnerName(parser.ownerName); setOwnerName(parser.ownerName);
setOwnerInRoom(parser.ownerInRoom); setOwnerInRoom(parser.ownerInRoom);
setUsersInRoom(parser.playerAmount); setUsersInRoom(parser.playerAmount);
}, [ setLoadedRoomId, setName, setOwnerId, setOwnerName, setOwnerInRoom, setUsersInRoom ]); }, [ setLoadedRoomId, setName, setOwnerId, setOwnerName, setOwnerInRoom, setUsersInRoom, roomId ]);
CreateMessageHook(ModtoolRoomInfoEvent, onModtoolRoomInfoEvent); CreateMessageHook(ModtoolRoomInfoEvent, onModtoolRoomInfoEvent);

View File

@ -20,11 +20,11 @@ export const ModToolsUserChatlogView: FC<ModToolsUserChatlogViewProps> = props =
{ {
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if(!parser || parser.userId !== userId) return;
setUsername(parser.username); setUsername(parser.username);
setUserChatlog(parser.roomVisits); setUserChatlog(parser.roomVisits);
}, [setUsername, setUserChatlog]); }, [setUsername, setUserChatlog, userId]);
CreateMessageHook(ModtoolUserChatlogEvent, onModtoolUserChatlogEvent); CreateMessageHook(ModtoolUserChatlogEvent, onModtoolUserChatlogEvent);

View File

@ -21,11 +21,10 @@ export const ModToolsUserView: FC<ModToolsUserViewProps> = props =>
{ {
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if(!parser || parser.data.userId !== userId) return;
console.log(parser);
setUserInfo(parser.data); setUserInfo(parser.data);
}, [setUserInfo]); }, [setUserInfo, userId]);
CreateMessageHook(ModtoolUserInfoEvent, onModtoolUserInfoEvent); CreateMessageHook(ModtoolUserInfoEvent, onModtoolUserInfoEvent);