mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2025-02-18 02:11:23 +01:00
Fix users accessing trust without permission.
This commit is contained in:
parent
8f4d761c76
commit
b8c3bfe820
@ -563,30 +563,6 @@ public void execute(CommandSender src, String[] args) {
|
||||
.append(northWestCorner)
|
||||
.append(northEastCorner).build();
|
||||
}
|
||||
Component claimAccessors = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_ACCESSORS.color(TextColor.YELLOW).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.ACCESSOR))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_ACCESSORS))))
|
||||
.build();
|
||||
Component claimBuilders = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_BUILDERS.color(TextColor.GREEN).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.BUILDER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_BUILDERS))))
|
||||
.build();
|
||||
Component claimContainers = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_CONTAINERS.color(TextColor.LIGHT_PURPLE).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.CONTAINER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_CONTAINERS))))
|
||||
.build();
|
||||
Component claimCoowners = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_MANAGERS.color(TextColor.GOLD).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.MANAGER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_MANAGERS))))
|
||||
.build();
|
||||
Component dateCreated = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_CREATED.color(TextColor.YELLOW))
|
||||
.append(" : ")
|
||||
@ -621,15 +597,41 @@ public void execute(CommandSender src, String[] args) {
|
||||
.append(" ")
|
||||
.append(claimDenyMessages)
|
||||
.build());
|
||||
textList.add(TextComponent.builder()
|
||||
.append(claimAccessors)
|
||||
.append(" ")
|
||||
.append(claimBuilders)
|
||||
.append(" ")
|
||||
.append(claimContainers)
|
||||
.append(" ")
|
||||
.append(claimCoowners)
|
||||
.build());
|
||||
if (allowEdit == null) {
|
||||
Component claimAccessors = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_ACCESSORS.color(TextColor.YELLOW).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.ACCESSOR))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_ACCESSORS))))
|
||||
.build();
|
||||
Component claimBuilders = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_BUILDERS.color(TextColor.GREEN).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.BUILDER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_BUILDERS))))
|
||||
.build();
|
||||
Component claimContainers = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_CONTAINERS.color(TextColor.LIGHT_PURPLE).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.CONTAINER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_CONTAINERS))))
|
||||
.build();
|
||||
Component claimCoowners = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_MANAGERS.color(TextColor.GOLD).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.MANAGER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_MANAGERS))))
|
||||
.build();
|
||||
textList.add(TextComponent.builder()
|
||||
.append(claimAccessors)
|
||||
.append(" ")
|
||||
.append(claimBuilders)
|
||||
.append(" ")
|
||||
.append(claimContainers)
|
||||
.append(" ")
|
||||
.append(claimCoowners)
|
||||
.build());
|
||||
}
|
||||
textList.add(claimGreeting);
|
||||
textList.add(claimFarewell);
|
||||
textList.add(dateCreated);
|
||||
|
@ -67,11 +67,16 @@
|
||||
public class CommandTrustList extends BaseCommand {
|
||||
|
||||
@CommandAlias("trustlist")
|
||||
@Description("Lists permissions for the claim you're standing in.")
|
||||
@Description("Manages trust for the claim you're standing in.")
|
||||
@Subcommand("trust list")
|
||||
public void execute(Player player) {
|
||||
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
||||
final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation());
|
||||
final Component message = claim.allowGrantPermission(player);
|
||||
if (message != null) {
|
||||
GriefDefenderPlugin.sendMessage(player, message);
|
||||
return;
|
||||
}
|
||||
showTrustList(player, claim, playerData, TrustTypes.NONE, new ArrayList<>(), null);
|
||||
}
|
||||
|
||||
|
@ -555,30 +555,6 @@ public void execute(CommandSource src, String[] args) {
|
||||
.append(northWestCorner)
|
||||
.append(northEastCorner).build();
|
||||
}
|
||||
Component claimAccessors = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_ACCESSORS.color(TextColor.YELLOW).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.ACCESSOR))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_ACCESSORS))))
|
||||
.build();
|
||||
Component claimBuilders = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_BUILDERS.color(TextColor.GREEN).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.BUILDER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_BUILDERS))))
|
||||
.build();
|
||||
Component claimContainers = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_CONTAINERS.color(TextColor.LIGHT_PURPLE).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.CONTAINER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_CONTAINERS))))
|
||||
.build();
|
||||
Component claimCoowners = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_MANAGERS.color(TextColor.GOLD).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.MANAGER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_MANAGERS))))
|
||||
.build();
|
||||
Component dateCreated = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_CREATED.color(TextColor.YELLOW))
|
||||
.append(" : ")
|
||||
@ -611,15 +587,41 @@ public void execute(CommandSource src, String[] args) {
|
||||
.append(" ")
|
||||
.append(claimDenyMessages)
|
||||
.build());
|
||||
textList.add(TextComponent.builder()
|
||||
.append(claimAccessors)
|
||||
.append(" ")
|
||||
.append(claimBuilders)
|
||||
.append(" ")
|
||||
.append(claimContainers)
|
||||
.append(" ")
|
||||
.append(claimCoowners)
|
||||
.build());
|
||||
if (allowEdit == null) {
|
||||
Component claimAccessors = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_ACCESSORS.color(TextColor.YELLOW).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.ACCESSOR))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_ACCESSORS))))
|
||||
.build();
|
||||
Component claimBuilders = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_BUILDERS.color(TextColor.GREEN).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.BUILDER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_BUILDERS))))
|
||||
.build();
|
||||
Component claimContainers = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_CONTAINERS.color(TextColor.LIGHT_PURPLE).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.CONTAINER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_CONTAINERS))))
|
||||
.build();
|
||||
Component claimCoowners = TextComponent.builder()
|
||||
.append(MessageCache.getInstance().LABEL_MANAGERS.color(TextColor.GOLD).decoration(TextDecoration.ITALIC, true))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustListConsumer(player, gdClaim, playerData, TrustTypes.MANAGER))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_VIEW,
|
||||
ImmutableMap.of("target", MessageCache.getInstance().LABEL_MANAGERS))))
|
||||
.build();
|
||||
textList.add(TextComponent.builder()
|
||||
.append(claimAccessors)
|
||||
.append(" ")
|
||||
.append(claimBuilders)
|
||||
.append(" ")
|
||||
.append(claimContainers)
|
||||
.append(" ")
|
||||
.append(claimCoowners)
|
||||
.build());
|
||||
}
|
||||
textList.add(claimGreeting);
|
||||
textList.add(claimFarewell);
|
||||
textList.add(dateCreated);
|
||||
|
@ -66,11 +66,16 @@
|
||||
public class CommandTrustList extends BaseCommand {
|
||||
|
||||
@CommandAlias("trustlist")
|
||||
@Description("Lists permissions for the claim you're standing in.")
|
||||
@Description("Manages trust for the claim you're standing in.")
|
||||
@Subcommand("trust list")
|
||||
public void execute(Player player) {
|
||||
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
||||
final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation());
|
||||
final Component message = claim.allowGrantPermission(player);
|
||||
if (message != null) {
|
||||
GriefDefenderPlugin.sendMessage(player, message);
|
||||
return;
|
||||
}
|
||||
showTrustList(player, claim, playerData, TrustTypes.NONE, new ArrayList<>(), null);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user