FireSmartFox wrote:I created a HashMap to have an own user object called "Player". Every Place instance has a reference to the SFS user. I do this to assign some properties and other stuff to the player.
If you need to assign custom properties to a User you can use the User.getProperty()/setProperty() without having to rely on another data structure. Also you can use
hidden UserVariables (they exist only on the server side and are not sent to the client).
But sometimes when I literate through the list to send something to all players with a certain property, I get a ConcurrentModificationException.
That's because you're probably using a non thread-safe collection, such a HashMap. Use a
ConcurrentHashMap instead.
Is there a way to send data to all users in a zone with a certain property / variable and having a performant filter? For example if I use the properties assigned to users?
For security reason, I don't want to submit the data to all users in the zone.
You can use
MatchExpressions to filter Rooms or Users in the Zone based on custom parameters.
If you choose to do so, which I would recommend, you can use UserVariables to set the user's custom properties (setting them as "hidden", so they exist on server side only) and then you can filter the User via -->
SFSApi.findUsers()You can learn more on how to use the system here:
http://docs2x.smartfoxserver.com/Advanc ... i#matchExpAlso here:
http://docs2x.smartfoxserver.com/api-do ... ssion.htmlHope it helps