Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

added permissions.interact to allows player interaction when build is false #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public void onPlayerQuit(PlayerQuitEvent event) {
plugin.unregisterPlayer(event.getPlayer());
}

// Prevent doing things in the event of permissions.build: false
// Prevent doing things in the event of permissions.build: false and permissions.interact: false

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.isCancelled()) return;
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_AIR) {
return;
}
if (!event.getPlayer().hasPermission("permissions.build")) {
if (!event.getPlayer().hasPermission("permissions.build")&&!event.getPlayer().hasPermission("permissions.interact")) {
bother(event.getPlayer());
event.setCancelled(true);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ permissions:
permissions.build:
description: Allows player to build.
default: true
permissions.interact:
description: Allows player to interact when build is false.
default: false
permissions.help:
description: Allows viewing of usage for /permissions.
permissions.reload:
Expand Down