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;
|
||||
}
|
||||
Player player = (Player) src;
|
||||
GDClaim gpClaim = (GDClaim) claim;
|
||||
GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
||||
if (!playerData.canIgnoreClaim(gpClaim) && !playerData.canManageAdminClaims) {
|
||||
GDClaim gdClaim = (GDClaim) claim;
|
||||
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
||||
if (!playerData.canIgnoreClaim(gdClaim) && !playerData.canManageAdminClaims) {
|
||||
// if not owner of claim, validate perms
|
||||
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));
|
||||
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)) {
|
||||
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||
return;
|
||||
|
@ -1000,15 +1000,27 @@ public static Consumer<CommandSource> createTeleportConsumer(CommandSource src,
|
||||
return;
|
||||
}
|
||||
Player player = (Player) src;
|
||||
GDClaim gpClaim = (GDClaim) claim;
|
||||
GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
||||
if (!playerData.canIgnoreClaim(gpClaim) && !playerData.canManageAdminClaims) {
|
||||
GDClaim gdClaim = (GDClaim) claim;
|
||||
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
||||
if (!playerData.canIgnoreClaim(gdClaim) && !playerData.canManageAdminClaims) {
|
||||
// if not owner of claim, validate perms
|
||||
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));
|
||||
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)) {
|
||||
TextAdapter.sendComponent(player, MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_FEATURE.color(TextColor.RED));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user