EXILED icon indicating copy to clipboard operation
EXILED copied to clipboard

Feature quick player info access

Open Undid-Iridium opened this issue 2 years ago • 12 comments

[Potentially breaking change]

Instead of passing back IEnumerables after having to iterate every player again and again, instead use a dictionary that updates on player role change, and when a player leaves. That's the whole point - I am tired but from my testing it works fine. Feedback is appreciated. Thanks (Also for the dictionary add/remove, yes I could assign every possible role to a new dictionary but I was lazy and this at least allows dynamic updates in case someone messes up and does not update it)

Also it seems dev and 5.3 have some different changes, so you'll see some weird changes that were not my own, but rather the merge differences

Undid-Iridium avatar Jun 28 '22 08:06 Undid-Iridium

Do not merge until consensus is agreed upon

Undid-Iridium avatar Jun 28 '22 18:06 Undid-Iridium

can you try it ? now i thinks it's all done if all work perfectly

louis1706 avatar Jun 29 '22 17:06 louis1706

Way to prevent Player from being added (npcs) and option to reset & resync lists incase something happens / on round end?

moddedmcplayer avatar Jun 30 '22 12:06 moddedmcplayer

Way to prevent Player from being added (npcs) and option to reset & resync lists incase something happens / on round end?

Npc should not being in Player.List

louis1706 avatar Jun 30 '22 13:06 louis1706

Way to prevent Player from being added (npcs) and option to reset & resync lists incase something happens / on round end?

So, I got 4 hours of sleep again, because I took a nap like an idiot, and like a bigger idiot I forgot to set an alarm so, forgive me for my stupidity (I promise I will sleep correctly today)

So you want an NPC to not be added to a list of players by role - I cannot think of a scenario where someone would want to do that, but my previous logic would have allowed you to modify it after a player changed role. If you can give me a good scenario I will add it (Not trying to be rude I just can't think very well right now) Update: Pets? Maybe? I guess?

For the second half of your question, on server restart, everything gets wiped, no? However, I am not opposed to adding that functionality - Would you prefer a static api call for a resync, and a EventHander extra field to reset on round end?

Undid-Iridium avatar Jun 30 '22 13:06 Undid-Iridium

Yeah that would Work fine, also funny npcs API in exiled 6 (hopefully)

moddedmcplayer avatar Jun 30 '22 17:06 moddedmcplayer

@moddedmcplayer I have added what you've asked - see ReSyncAllInstantiatedContainers, ResetAllInstantiatedContainers, and ReSyncContainersToDefault. @IRacle1 Can you confirm my understanding of new Dictionary(previous dictionary) - This process is a shallow copy right, it won't copy the underlying reference, correct? (I added internal default dictionaries for this system)

Undid-Iridium avatar Jul 03 '22 16:07 Undid-Iridium

@moddedmcplayer I have added what you've asked - see ReSyncAllInstantiatedContainers, ResetAllInstantiatedContainers, and ReSyncContainersToDefault. @IRacle1 Can you confirm my understanding of new Dictionary(previous dictionary) - This process is a shallow copy right, it won't copy the underlying reference, correct? (I added internal default dictionaries for this system)

yea, truth

IRacle1 avatar Jul 03 '22 16:07 IRacle1

@moddedmcplayer I have added what you've asked - see ReSyncAllInstantiatedContainers, ResetAllInstantiatedContainers, and ReSyncContainersToDefault. @IRacle1 Can you confirm my understanding of new Dictionary(previous dictionary) - This process is a shallow copy right, it won't copy the underlying reference, correct? (I added internal default dictionaries for this system)

yea, truth

Ty ❤️

Undid-Iridium avatar Jul 03 '22 16:07 Undid-Iridium

But I'm not sure that the refs to HashSet's will change (more precisely, I'm 90% sure that the HashSet's will be copied into the dictionaries by ref)

IRacle1 avatar Jul 03 '22 16:07 IRacle1

I dont like those internals, they can be broken with updates easily.

Just make them a methods to generate them dynamicly.

Jesus-QC avatar Jul 10 '22 12:07 Jesus-QC

I dont like those internals, they can be broken with updates easily.

Just make them a methods to generate them dynamicly.

https://github.com/Exiled-Team/EXILED/pull/1300#discussion_r909194933

I made that point; however, if you believe I should revert back to dynamic, I can.

Undid-Iridium avatar Jul 10 '22 14:07 Undid-Iridium

Closing due to inactivity from reviewers. If someone wants this, re-open or create new PR.

Undid-Iridium avatar Oct 04 '22 16:10 Undid-Iridium