10-13-2014, 06:02 AM
@ambushed01 If the plugin checked the entire list every time the player places or breaks a block, the performance would be terrible:
- When the player connects, the server has to load all the blocks that they aren't allowed to modify
- Each time the plugin has to check this entire list of blocks
Now, suppose there have been 50 players on a server who built something; each player placed about 10.000 blocks (20*10*50 cube - clearly a mid estimate) that would mean loading and checking a list of 500.000 items *each time*. There's no way a plugin can manage that.
STR_Warrior is right, what I meant is to keep track of the protected blocks only in a small area around the player, and update that list when the player moves out of that area. It is still block based, but this time you're not checking 500k blocks, but only 32*32*32 = 32k blocks at most; much less if the plugin is smarter. But you still need a way for the DB to quickly be able to spit out the correct list of blocks rather fast, that's where the chunk coords may come in handy.
- When the player connects, the server has to load all the blocks that they aren't allowed to modify
- Each time the plugin has to check this entire list of blocks
Now, suppose there have been 50 players on a server who built something; each player placed about 10.000 blocks (20*10*50 cube - clearly a mid estimate) that would mean loading and checking a list of 500.000 items *each time*. There's no way a plugin can manage that.
STR_Warrior is right, what I meant is to keep track of the protected blocks only in a small area around the player, and update that list when the player moves out of that area. It is still block based, but this time you're not checking 500k blocks, but only 32*32*32 = 32k blocks at most; much less if the plugin is smarter. But you still need a way for the DB to quickly be able to spit out the correct list of blocks rather fast, that's where the chunk coords may come in handy.