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();
if(!parser) return;
if(!parser || parser.data.roomId !== roomId) return;
setRoomChatlog(parser.data);
}, [setRoomChatlog]);
}, [roomId, setRoomChatlog]);
CreateMessageHook(ModtoolRoomChatlogEvent, onModtoolRoomChatlogEvent);

View File

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

View File

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

View File

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