Skip to content

Block Events Allow/Dissallow #153

Description

@pietru2004

There should be a way to allow and disallow actions such as block break, place and interact.
This would be useful for both singleplayer and multiplayer.
In singleplayer it could be useful for making dungeon that can be modified only after player has conquered it or a village houses that player can only interact with but not modify them.
In multiplayer it would be usefull for stuff like plots, and restricted areas made by players or srv admins.

Example (if single returns false dissallow action):

        BlockEvents.registerBlockBreakContition("example_block_break_condition", piority_int, (player, blockState, zone, x, y, z) -> {
            return !(x==0 || y==0 || z==0);
        });
        BlockEvents.registerBlockPlaceContition("example_block_place_condition", piority_int,, (player, blockState, zone, x, y, z) -> {
            return !(x==0 || y==0 || z==0);
        });
        BlockEvents.registerBlockInteractContition("example_block_interact_condition", piority_int,, (player, blockState, zone, x, y, z) -> {
            return !(x==0 || y==0 || z==0);
        });

In those example there is no variable called was_canceled, but there could be use for option to check was event canceled cause mayby other condition might want to override it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions