Cuberite Forum
Question about FindAndDoWithPlayer - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Question about FindAndDoWithPlayer (/thread-1914.html)



Question about FindAndDoWithPlayer - bearbin - 05-07-2015

I'm working on fixing Core issue #135, and the documentation for FindAndDoWithPlayer seems lacking.

Is it case-sensitive or insensitive?


RE: Question about FindAndDoWithPlayer - NiLSPACE - 05-07-2015

It's case-insensitive. It uses the RateCompareString function, and that compares each character by making them uppercase first: https://github.com/mc-server/MCServer/blob/57d2a09c8cba990b639736b30e96aad89969bcd9/src/StringUtils.cpp#L303


RE: Question about FindAndDoWithPlayer - bearbin - 05-07-2015

Great, thanks for the solution.

Actually, thinking about this problem with plugins in general, I think we need a function DoWithClosestMatchedPlayer. Lots of functions require this and they all implement it slightly differently, inconsistently enough to be annoying to end users.

Do you think this is something that we need?


RE: Question about FindAndDoWithPlayer - NiLSPACE - 05-07-2015

Isn't that what FindAndDoWithPlayer does?


RE: Question about FindAndDoWithPlayer - bearbin - 05-07-2015

You're right, I read through the code and it does do that.

Then I need to change the documentation, it says that it'll run the callback on all matching players.