WorldPermissionsModule
WorldPermissionsModule can prevent the player from placing, breaking, or interacting with blocks in the world.
Block Breaking
Two module parameters have an effect on players’ abilities to break blocks.
- If
allowBlockBreakisfalse, players will not be able to break any blocks (PlayerBlockBreakEventwill be cancelled). - If
allowBreakMapisfalse, players will not be able to break blocks that are included with the map (PlayerBlockBreakEventwill be cancelled). Any player-placed blocks will still be breakable as long asallowBlockBreakis notfalse.
Block Placing
Two module parameters have an effect on players’ abilities to place blocks.
- If
allowBlockPlaceisfalse, players will not be able to place any blocks (PlayerBlockPlaceEventwill be cancelled). - If
allowBlockInteractisfalse, players will not be able to place any blocks (PlayerBlockInteractEventwill be cancelled).
Block Interacting
- If
allowBlockInteractisfalse, players will not be able to interact with any blocks (PlayerBlockInteractEventwill be cancelled).
Block Exceptions
The module has an exceptions parameter, which is a list of blocks that will be completely ignored by the module. This means the module will not prevent players from placing, breaking, or interacting with any block on the exceptions list. BlueDragon uses this feature to allow beds to be broken in BedWars, even though the rest of the map cannot be removed.
Usage
Import the module:
import com.bluedragonmc.server.module.gameplay.gameplay.WorldPermissionsModuleUse the module in your game’s initialize function:
use(WorldPermissionsModule( allowBlockBreak = false, allowBlockPlace = false, allowBlockInteract = false, allowBreakMap = false, exceptions = listOf(Block.OAK_PLANKS)))In this example, no blocks can be placed or broken, except oak planks.
See Also
- If you’re looking to restrict players’ inventory management abilities, use InventoryPermissionsModule