It's the hooks that'll be slow - either you read an entire INI file whenever a player digs / places a block, or you keep all that data in memory (and risk losing it).
This is exactly the kind of situation that you want to use database for.
What do you think about the way I store bans in my ReWrite project for the Core. I load them in a table, and create an object with functions to edit/read it. Then I return the object.
I dont know how to use SQLite. If i learn I may rewrite storage.
I noticed my plugin is usseless, because you could break blocks from a protected chunk being out, Is there any way of getting the chunk pos of a coordinates? If no, it would be fine if you make a cWorld:GetChunkXat() and cWorld:GetChunkZat() functions. I made an issue on github
(10-03-2013, 05:22 AM)STR_Warrior Wrote: [ -> ]What do you think about the way I store bans in my ReWrite project for the Core. I load them in a table, and create an object with functions to edit/read it. Then I return the object.
That's fine for a few (tens) of items, but not for several hundred or even thousands - that will consume a lot of memory and will become very time-consuming to search for a match.
(10-03-2013, 06:08 PM)tonibm19 Wrote: [ -> ]I noticed my plugin is usseless, because you could break blocks from a protected chunk being out, Is there any way of getting the chunk pos of a coordinates? If no, it would be fine if you make a cWorld:GetChunkXat() and cWorld:GetChunkZat() functions. I made an issue on github
As I've written in the GitHub, response a function for this would be too expensive to call, compared to the simple calculation that you can do directly in Lua. Just use math.floor(BlockX / 16)