Developing an example Protection plugin
#9
Second iteration
The second iteration finally brings some functional code. To test that the actual protecting will work, the cStorage class is prototyped, with the loading function always returning one hard-coded area, (10,10) - (20,20). This way, we can focus on the actual act of protecting - handling the hooks so that the area cannot be touched by a player.
Also, it became clear that the PlayerAreas map needs to map player IDs to areas, instead of player names, because if a player connects with two clients (perfectly legal in MCS), their areas would get mixed with the name approach. With the ID approach, everything should work fine, each player will get their own instance of the cPlayerAreas class.

This version of the code has been tested to actually do something - now no player can interact with the blocks in the hard-coded area. Both block placing and block breaking are disabled. However, player's tools are still damaged when breaking blocks. This might be a bug in MCServer, and needs further examination later on.

The version attached to this post is also committed to the main MCS repository in rev 1557.


Attached Files
.zip   ProtectionAreas1557.zip (Size: 5.76 KB / Downloads: 221)
Reply
Thanks given by:


Messages In This Thread
Developing an example Protection plugin - by xoft - 05-18-2013, 01:29 AM
RE: Developing an example Protection plugin - by xoft - 06-05-2013, 07:14 AM



Users browsing this thread: 1 Guest(s)