mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-28 13:15:23 +01:00
Deny teleport to non-trusted users if no permission.
* Allow teleports to non-trusted if claim is for sale and they have permission to teleport.
This commit is contained in:
parent
0ec94bb2cb
commit
039087cac7
@ -989,15 +989,27 @@ public static Consumer<CommandSender> createTeleportConsumer(CommandSender src,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = (Player) src;
|
Player player = (Player) src;
|
||||||
GDClaim gpClaim = (GDClaim) claim;
|
GDClaim gdClaim = (GDClaim) claim;
|
||||||
GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
||||||
if (!playerData.canIgnoreClaim(gpClaim) && !playerData.canManageAdminClaims) {
|
if (!playerData.canIgnoreClaim(gdClaim) && !playerData.canManageAdminClaims) {
|
||||||
// if not owner of claim, validate perms
|
// if not owner of claim, validate perms
|
||||||
if (!player.getUniqueId().equals(claim.getOwnerUniqueId())) {
|
if (!player.getUniqueId().equals(claim.getOwnerUniqueId())) {
|
||||||
if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_OTHERS) && !gpClaim.isUserTrusted(player, TrustTypes.ACCESSOR)) {
|
if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_OTHERS)) {
|
||||||
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!gdClaim.isUserTrusted(player, TrustTypes.ACCESSOR)) {
|
||||||
|
if (GriefDefenderPlugin.getInstance().getVaultProvider() != null) {
|
||||||
|
// Allow non-trusted to TP to claims for sale
|
||||||
|
if (!gdClaim.getEconomyData().isForSale()) {
|
||||||
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_BASE)) {
|
} else if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_BASE)) {
|
||||||
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
return;
|
return;
|
||||||
|
@ -1000,15 +1000,27 @@ public static Consumer<CommandSource> createTeleportConsumer(CommandSource src,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = (Player) src;
|
Player player = (Player) src;
|
||||||
GDClaim gpClaim = (GDClaim) claim;
|
GDClaim gdClaim = (GDClaim) claim;
|
||||||
GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
||||||
if (!playerData.canIgnoreClaim(gpClaim) && !playerData.canManageAdminClaims) {
|
if (!playerData.canIgnoreClaim(gdClaim) && !playerData.canManageAdminClaims) {
|
||||||
// if not owner of claim, validate perms
|
// if not owner of claim, validate perms
|
||||||
if (!player.getUniqueId().equals(claim.getOwnerUniqueId())) {
|
if (!player.getUniqueId().equals(claim.getOwnerUniqueId())) {
|
||||||
if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_OTHERS) && !gpClaim.isUserTrusted(player, TrustTypes.ACCESSOR)) {
|
if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_OTHERS)) {
|
||||||
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!gdClaim.isUserTrusted(player, TrustTypes.ACCESSOR)) {
|
||||||
|
if (GriefDefenderPlugin.getInstance().economyService.isPresent()) {
|
||||||
|
// Allow non-trusted to TP to claims for sale
|
||||||
|
if (!gdClaim.getEconomyData().isForSale()) {
|
||||||
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_BASE)) {
|
} else if (!player.hasPermission(GDPermissions.COMMAND_CLAIM_INFO_TELEPORT_BASE)) {
|
||||||
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user