Add permission for storing user's last location on teleportation (#3272)

This commit is contained in:
Josh Roy 2020-05-13 18:53:36 -04:00 committed by GitHub
parent 8f5b97b9d2
commit 302f0acbaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -458,7 +458,7 @@ public class EssentialsPlayerListener implements Listener {
}
final User user = ess.getUser(player);
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
if (backListener && (event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND)) {
if (user.isAuthorized("essentials.back.onteleport") && backListener && (event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND)) {
user.setLastLocation();
}
if (teleportInvulnerability && (event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND)) {

View File

@ -129,7 +129,9 @@ public class Teleport implements ITeleport {
return;
}
teleportee.setLastLocation();
if (teleportee.isAuthorized("essentials.back.onteleport")) {
teleportee.setLastLocation();
}
if (!teleportee.getBase().isEmpty()) {
if (!ess.getSettings().isTeleportPassengerDismount()) {

View File

@ -632,6 +632,12 @@ permissions:
essentials.balancetop.exclude:
default: false
description: Players with this permission are excluded from the balancetop
essentials.back.onteleport:
default: true
description: Players with this permission will have back location stored during any teleportation
essentials.back.ondeath:
default: false
description: Players with this permission will have back location stored during death
essentials.exempt:
default: false
description: Parent permission to be exempt from many moderator actions