permission-based jailed player interactions (#2503)

This commit is contained in:
latiku 2020-03-30 23:32:12 -04:00 committed by GitHub
parent 76f4dff14c
commit dbc0562fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onJailBlockBreak(final BlockBreakEvent event) {
final User user = ess.getUser(event.getPlayer());
if (user.isJailed()) {
if (user.isJailed() && !user.isAuthorized("essentials.jail.allow-break")) {
event.setCancelled(true);
}
}
@ -165,7 +165,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onJailBlockPlace(final BlockPlaceEvent event) {
final User user = ess.getUser(event.getPlayer());
if (user.isJailed()) {
if (user.isJailed() && !user.isAuthorized("essentials.jail.allow-place")) {
event.setCancelled(true);
}
}
@ -173,7 +173,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onJailBlockDamage(final BlockDamageEvent event) {
final User user = ess.getUser(event.getPlayer());
if (user.isJailed()) {
if (user.isJailed() && !user.isAuthorized("essentials.jail.allow-block-damage")) {
event.setCancelled(true);
}
}
@ -195,7 +195,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onJailPlayerInteract(final PlayerInteractEvent event) {
final User user = ess.getUser(event.getPlayer());
if (user.isJailed()) {
if (user.isJailed() && !user.isAuthorized("essentials.jail.allow-interact")) {
event.setCancelled(true);
}
}