Anti Griefing - Brian-Wuest/MC-Prefab GitHub Wiki

This page is to provide modders information about how this mod handles anti-griefing and how they can help implement these processes.

Forge Events

The primary way which this mod implements and anti-griefing model is by using the following Forge Events:

  1. BlockEvent.PlaceEvent
    1. Determines if the player is allowed to place a block at the specified location. If this event is canceled, block placement is not allowed and items will not be lost.
  2. BlockEvent.BreakEvent
    1. Determines if the player is allowed to break the block at the specified location. If this event is canceled, block breakage at this location is not allowed and the block will remain in the world.

These events are triggered for each block position in which the building will be spawned. This happens while the item is still in the players hand and before the building is added to the building queue. This is also done server side to make sure that all block positions are accurate.

Both of these events are cancellable and if a mod cancels either one of these events as a part of this processing, The player will not be able to place the building and will get the following message in their chat: Cannot build structure due to protected blocks/area.

Do not cancel either of these events unless the player is not allowed to place a block in the specified position or they are not allowed to break the block in the specified position.