[Plugin] CuboidPlus r4 - Building/Landscaping/Terraforming
#21
You know, a "please" would take you a long wayTongue

For the plugin author: The GetAllPlayers() method is not implemented in newer MCS versions and has been replaced with calls to ForEachPlayer() (due to multithreading issues). The Core plugin already uses this approach so you can see how it's used there.

Basically the issue is that GetAllPlayers() returned a player instance and another thread could invalidate that instance before the lua plugin could even touch it. So instead you provide a callback that is called for each player and the mechanism guarantees that the player instance is valid throughout the callback's execution. Note though that you should NOT store the player instance for later processing (same issue as with GetAllPlayers() ) and you should make the callback as fast as possible, avoiding heavy calculations or such, because a critical section is held during the callback which effectively stops all other MCS threads from touching the players list.
Reply
Thanks given by:


Messages In This Thread
RE: [Plugin] CuboidPlus r2 - by Luthrandel - 11-09-2011, 04:17 PM
RE: [Plugin] CuboidPlus r2 - by ThuGie - 11-10-2011, 11:45 PM
RE: [Plugin] CuboidPlus r2 - by Luthrandel - 11-11-2011, 10:42 AM
RE: [Plugin] CuboidPlus r2 - by rs2k - 11-11-2011, 01:08 AM
RE: [Plugin] CuboidPlus r3 - Building/Landscaping/Terraforming - by xoft - 03-20-2012, 11:29 PM



Users browsing this thread: 7 Guest(s)