GriefDefender/bukkit/src/main/java/com/griefdefender/command/CommandTrustList.java

495 lines
28 KiB
Java
Raw Normal View History

2019-07-24 05:31:17 +02:00
/*
* This file is part of GriefDefender, licensed under the MIT License (MIT).
*
* Copyright (c) bloodmc
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.griefdefender.command;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Subcommand;
import com.google.common.collect.ImmutableMap;
2019-07-24 05:31:17 +02:00
import com.griefdefender.GDPlayerData;
import com.griefdefender.GriefDefenderPlugin;
import com.griefdefender.api.claim.TrustType;
import com.griefdefender.api.claim.TrustTypes;
import com.griefdefender.cache.MessageCache;
2019-07-24 05:31:17 +02:00
import com.griefdefender.cache.PermissionHolderCache;
import com.griefdefender.claim.GDClaim;
import com.griefdefender.configuration.IClaimData;
import com.griefdefender.configuration.MessageStorage;
2019-07-24 05:31:17 +02:00
import com.griefdefender.internal.pagination.PaginationList;
import com.griefdefender.permission.GDPermissionUser;
import com.griefdefender.permission.GDPermissions;
import com.griefdefender.text.action.GDCallbackHolder;
import com.griefdefender.util.ChatCaptureUtil;
import com.griefdefender.util.PermissionUtil;
2019-07-24 05:31:17 +02:00
import net.kyori.text.Component;
import net.kyori.text.TextComponent;
import net.kyori.text.event.ClickEvent;
import net.kyori.text.event.HoverEvent;
import net.kyori.text.format.TextColor;
import net.kyori.text.format.TextDecoration;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.time.Instant;
2019-07-24 05:31:17 +02:00
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
@CommandAlias("%griefdefender")
@CommandPermission(GDPermissions.COMMAND_LIST_TRUST)
public class CommandTrustList extends BaseCommand {
@CommandAlias("trustlist")
Update for 1.5.5 release. * Add potion effects support. * Add item enchantment support. * Add pvp lookup methods for claim and playerdata. * Add 'block-tileentity-id-list' used to override mod block id's that are used for many TE's. - Ex. IC2 uses a base block id 'ic2:te' for all TE's. When the id is detected during block/item usage, it will be converted to the actual id. * Add TileEntity registry to better support hybrid servers. * Add '/claiminfo' UUID click support to copy text to chat. * Add support for overriding option 'player-command-exit/enter' on player. * Add command description translation support. * Add zh_HK language support. * Fix event cause not clearing on push. * Fix abandon claim within town returning funds to owner in economy mode. * Fix player afk detection during claim block task. * Fix async chunk load during visual revert. * Fix '/gd claim we' command. * Fix advanced flag GUI toggle with definitions. * Fix rent sign update not checking all children claims. * Fix rent sign not being updated when cancelled via '/claimrent cancel'. * Fix '/claimsell' on admin claim. * Fix NPE when attempting to purchase an admin claim for sale. * Fix command description translations. * Fix isInvulnerable NPE on 1.8.8 servers. * Fix '/abandonworld' exiting when no economy data found for player. * Fix '/deletealladmin' only deleting admin claims in current world when passing no world argument. * Fix '/claimcontract' and '/claimexpand' NPE in economy mode. * Fix GD claim enter/exit prefix. The prefix will now use '[<playername>]'. Note: This can be configured in lang file under 'claim-prefix-enter' and 'claim-prefix-exit' * Clean up advanced flag GUI code. * Disable /buyblocks command when economy-block-cost is <= 0 * Deny town claim abandon if basic claims exist owned by owner. * Allow to input string as option value. * Improve pvp source contexts. * Clean up '/acb' command code. * (Bukkit) Add potion splash protection support. * (Bukkit) Fix tamed entities being hit by projectiles. * (Bukkit) Fix enderman block place protection. * (Hybrid) Fix wrong EnumCreatureType being registered for entities. * (Hybrid) Add TileEntity registry. * (Hybrid) Add mod command support for 'command-execute' flag. * (Sponge) Add PlaceHolderAPI support. * (Sponge) Add Nucleus v2 support. * (Sponge) Add IgniteEntityEvent support. * (Sponge) Fix '/cpp' and '/cpg' command. * (Sponge) Fix player block placement deny not sending message. Fixes #4 Fixes #200, Fixes #206, Fixes #222 Fixes #232, Fixes #237, Fixes #267 Fixes #269, Fixes #276, Fixes #296 Fixes #310, Fixes #311, Fixes #317 Fixes #324, Fixes #333, Fixes #334 Fixes #335, Fixes #336, Fixes #347
2020-12-28 23:28:12 +01:00
@Description("%trust-list")
2019-07-24 05:31:17 +02:00
@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);
2019-07-24 05:31:17 +02:00
}
public static void showTrustList(Player src, GDClaim claim, GDPlayerData playerData, TrustType type, List<Component> messages, Component returnCommand) {
2019-07-24 05:31:17 +02:00
final Component whiteOpenBracket = TextComponent.of("[", TextColor.AQUA);
final Component whiteCloseBracket = TextComponent.of("]", TextColor.AQUA);
final Component showAllText = MessageCache.getInstance().TRUST_CLICK_SHOW_LIST;
final Component showAccessorText = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.UI_CLICK_FILTER_TYPE,
ImmutableMap.of("type", MessageCache.getInstance().TITLE_ACCESSOR.color(TextColor.YELLOW)));
final Component showContainerText = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.UI_CLICK_FILTER_TYPE,
ImmutableMap.of("type", MessageCache.getInstance().TITLE_CONTAINER.color(TextColor.LIGHT_PURPLE)));
final Component showBuilderText = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.UI_CLICK_FILTER_TYPE,
ImmutableMap.of("type", MessageCache.getInstance().TITLE_BUILDER.color(TextColor.GREEN)));
final Component showManagerText = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.UI_CLICK_FILTER_TYPE,
ImmutableMap.of("type", MessageCache.getInstance().TITLE_MANAGER.color(TextColor.GOLD)));
2019-07-24 05:31:17 +02:00
final Component allTypeText = TextComponent.builder("")
.append(type == TrustTypes.NONE ? TextComponent.builder("")
.append(whiteOpenBracket)
.append(MessageCache.getInstance().TITLE_ALL)
2019-07-24 05:31:17 +02:00
.append(whiteCloseBracket)
.build() : TextComponent.builder("")
.append(MessageCache.getInstance().TITLE_ALL.color(TextColor.GRAY))
2019-07-24 05:31:17 +02:00
.build())
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustConsumer(src, claim, playerData, TrustTypes.NONE, returnCommand))))
2019-07-24 05:31:17 +02:00
.hoverEvent(HoverEvent.showText(showAllText)).build();
final Component accessorTrustText = TextComponent.builder("")
.append(type == TrustTypes.ACCESSOR ? TextComponent.builder("")
.append(whiteOpenBracket)
.append(MessageCache.getInstance().TITLE_ACCESSOR.color(TextColor.YELLOW))
2019-07-24 05:31:17 +02:00
.append(whiteCloseBracket)
.build() : MessageCache.getInstance().TITLE_ACCESSOR.color(TextColor.GRAY))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustConsumer(src, claim, playerData, TrustTypes.ACCESSOR, returnCommand))))
2019-07-24 05:31:17 +02:00
.hoverEvent(HoverEvent.showText(showAccessorText)).build();
final Component builderTrustText = TextComponent.builder("")
.append(type == TrustTypes.BUILDER ? TextComponent.builder("")
.append(whiteOpenBracket)
.append(MessageCache.getInstance().TITLE_BUILDER.color(TextColor.GREEN))
2019-07-24 05:31:17 +02:00
.append(whiteCloseBracket)
.build() : MessageCache.getInstance().TITLE_BUILDER.color(TextColor.GRAY))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustConsumer(src, claim, playerData, TrustTypes.BUILDER, returnCommand))))
2019-07-24 05:31:17 +02:00
.hoverEvent(HoverEvent.showText(showBuilderText)).build();
final Component containerTrustText = TextComponent.builder("")
.append(type == TrustTypes.CONTAINER ? TextComponent.builder("")
.append(whiteOpenBracket)
.append(MessageCache.getInstance().TITLE_CONTAINER.color(TextColor.LIGHT_PURPLE))
2019-07-24 05:31:17 +02:00
.append(whiteCloseBracket)
.build() : MessageCache.getInstance().TITLE_CONTAINER.color(TextColor.GRAY))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustConsumer(src, claim, playerData, TrustTypes.CONTAINER, returnCommand))))
2019-07-24 05:31:17 +02:00
.hoverEvent(HoverEvent.showText(showContainerText)).build();
final Component managerTrustText = TextComponent.builder("")
.append(type == TrustTypes.MANAGER ? TextComponent.builder("")
.append(whiteOpenBracket)
.append(MessageCache.getInstance().TITLE_MANAGER.color(TextColor.GOLD))
2019-07-24 05:31:17 +02:00
.append(whiteCloseBracket)
.build() : MessageCache.getInstance().TITLE_MANAGER.color(TextColor.GRAY))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createTrustConsumer(src, claim, playerData, TrustTypes.MANAGER, returnCommand))))
2019-07-24 05:31:17 +02:00
.hoverEvent(HoverEvent.showText(showManagerText)).build();
final Component claimTrustHead = TextComponent.builder()
.append(" ")
.append(MessageCache.getInstance().LABEL_DISPLAYING.color(TextColor.AQUA))
.append(" ")
2019-07-24 05:31:17 +02:00
.append(allTypeText)
.append(" ")
.append(accessorTrustText)
.append(" ")
.append(builderTrustText)
.append(" ")
.append(containerTrustText)
.append(" ")
.append(managerTrustText)
.build();
List<UUID> userIdList = new ArrayList<>(claim.getUserTrusts());
List<Component> trustList = new ArrayList<>();
trustList.add(TextComponent.empty());
if (returnCommand != null) {
trustList.add(returnCommand);
}
2019-07-24 05:31:17 +02:00
if (type == TrustTypes.NONE) {
// check highest trust first
for (UUID uuid : claim.getInternalClaimData().getManagers()) {
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
trustList.add(TextComponent.builder("")
.append(user.getName(), TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getManagers(), uuid))))
.build())
.append("]", TextColor.WHITE)
.build());
2019-07-24 05:31:17 +02:00
userIdList.remove(user.getUniqueId());
}
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
for (String group : claim.getInternalClaimData().getManagerGroups()) {
trustList.add(TextComponent.builder("")
.append(group, TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveGroupConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getManagerGroups(), group))))
.build())
.append("]", TextColor.WHITE)
.build());
}
2019-07-24 05:31:17 +02:00
for (UUID uuid : claim.getInternalClaimData().getBuilders()) {
if (!userIdList.contains(uuid)) {
continue;
}
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
trustList.add(TextComponent.builder("")
.append(user.getName(), TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getBuilders(), uuid))))
.build())
.append("]", TextColor.WHITE)
.build());
2019-07-24 05:31:17 +02:00
userIdList.remove(uuid);
}
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
for (String group : claim.getInternalClaimData().getBuilderGroups()) {
trustList.add(TextComponent.builder("")
.append(group, TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveGroupConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getBuilderGroups(), group))))
.build())
.append("]", TextColor.WHITE)
.build());
}
2019-07-24 05:31:17 +02:00
for (UUID uuid : claim.getInternalClaimData().getContainers()) {
if (!userIdList.contains(uuid)) {
continue;
}
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
trustList.add(TextComponent.builder("")
.append(user.getName(), TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getContainers(), uuid))))
.build())
.append("]", TextColor.WHITE)
.build());
2019-07-24 05:31:17 +02:00
userIdList.remove(uuid);
}
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
for (String group : claim.getInternalClaimData().getContainerGroups()) {
trustList.add(TextComponent.builder("")
.append(group, TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveGroupConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getContainerGroups(), group))))
.build())
.append("]", TextColor.WHITE)
.build());
}
2019-07-24 05:31:17 +02:00
for (UUID uuid : claim.getInternalClaimData().getAccessors()) {
if (!userIdList.contains(uuid)) {
continue;
}
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
trustList.add(TextComponent.builder("")
.append(user.getName(), TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getAccessors(), uuid))))
.build())
.append("]", TextColor.WHITE)
.build());
2019-07-24 05:31:17 +02:00
userIdList.remove(uuid);
}
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
for (String group : claim.getInternalClaimData().getAccessorGroups()) {
trustList.add(TextComponent.builder("")
.append(group, TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveGroupConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), claim.getInternalClaimData().getAccessorGroups(), group))))
.build())
.append("]", TextColor.WHITE)
.build());
}
2019-07-24 05:31:17 +02:00
} else {
final List<UUID> trusts = claim.getUserTrustList(type);
trustList.add(TextComponent.builder("")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("+", TextColor.GREEN)
.hoverEvent(HoverEvent.showText(TextComponent.of("Click here to add")))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createInputConsumer(src, claim, playerData, type, messages, returnCommand))))
.build())
.append("]", TextColor.WHITE)
.build());
for (UUID uuid : trusts) {
2019-07-24 05:31:17 +02:00
if (!userIdList.contains(uuid)) {
continue;
}
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
trustList.add(TextComponent.builder("")
.append(user.getName(), TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), trusts, uuid))))
.build())
.append("]", TextColor.WHITE)
.build());
2019-07-24 05:31:17 +02:00
userIdList.remove(uuid);
}
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
final List<String> groupList = claim.getGroupTrustList(type);
for (String group : groupList) {
trustList.add(TextComponent.builder("")
.append(group, TextColor.GOLD)
.append(" ")
.append("[", TextColor.WHITE)
.append(TextComponent.builder()
.append("x", TextColor.RED)
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_REMOVE))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createRemoveGroupConsumer(src, claim, playerData, type, returnCommand, claim.getInternalClaimData(), groupList, group))))
.build())
.append("]", TextColor.WHITE)
.build());
}
2019-07-24 05:31:17 +02:00
}
Component footer = null;
2019-07-24 05:31:17 +02:00
int fillSize = 20 - (trustList.size() + 2);
if (src.hasPermission(GDPermissions.CHAT_CAPTURE)) {
fillSize = 20 - (trustList.size() + 3);
if (messages != null && !messages.isEmpty()) {
footer = TextComponent.builder()
.append(ChatCaptureUtil.getInstance().createRecordChatComponent(src, claim, playerData, "trustlist", returnCommand))
.append(TextComponent.of("\n"))
.build();
for (Component message : messages) {
footer = footer.append(message);
fillSize -= 1;
}
messages.clear();
} else {
footer = TextComponent.builder()
.append(ChatCaptureUtil.getInstance().createRecordChatComponent(src, claim, playerData, "trustlist", returnCommand))
.build();
}
} else {
footer = TextComponent.empty();
if (messages != null && !messages.isEmpty()) {
for (Component message : messages) {
footer = footer.append(message);
fillSize -= 1;
}
messages.clear();
}
}
2019-07-24 05:31:17 +02:00
for (int i = 0; i < fillSize; i++) {
trustList.add(TextComponent.of(" "));
}
PaginationList.Builder paginationBuilder = PaginationList.builder()
.title(claimTrustHead).padding(TextComponent.of(" ").decoration(TextDecoration.STRIKETHROUGH, true)).contents(trustList).footer(footer);
2019-07-24 05:31:17 +02:00
paginationBuilder.sendTo(src);
}
private static Consumer<CommandSender> createTrustConsumer(Player src, GDClaim claim, GDPlayerData playerData, TrustType type, Component returnCommand) {
return consumer -> {
showTrustList(src, claim, playerData, type, new ArrayList<>(), returnCommand);
};
}
private static Consumer<CommandSender> createInputConsumer(Player src, GDClaim claim, GDPlayerData playerData, TrustType type, List<Component> messages, Component returnCommand) {
return consumer -> {
if (messages == null || messages.isEmpty()) {
playerData.commandInputTimestamp = Instant.now();
playerData.commandConsumer = createAddConsumer(src, claim, playerData, type, returnCommand);
}
messages.add(TextComponent.builder()
.append(TextComponent.of("Do you want to add a ")
.append(TextComponent.builder()
.append(MessageCache.getInstance().LABEL_PLAYER.color(TextColor.GOLD))
.clickEvent(ClickEvent.suggestCommand("player <name>"))
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_ADD_TARGET,
ImmutableMap.of("target", "player"))))
.build())
.append(TextComponent.of(" or "))
.append(TextComponent.builder()
.append(MessageCache.getInstance().LABEL_GROUP.color(TextColor.AQUA))
.clickEvent(ClickEvent.suggestCommand("group <name>"))
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.UI_CLICK_ADD_TARGET,
ImmutableMap.of("target", "group"))))
.build()))
.append(" ? ")
.append("[")
.append(TextComponent.builder()
.append(MessageCache.getInstance().LABEL_CANCEL.color(TextColor.RED))
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(
createCancelConsumer(src, claim, playerData, type, returnCommand))))
.build())
.append("]")
.build());
showTrustList(src, claim, playerData, type, messages, returnCommand);
};
}
private static Consumer<CommandSender> createAddConsumer(Player src, GDClaim claim, GDPlayerData playerData, TrustType type, Component returnCommand) {
return consumer -> {
String name = playerData.commandInput;
List<Component> messages = new ArrayList<>();
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
boolean isGroup = false;
if (playerData.commandInput.contains("player ")) {
name = name.replace("player ", "");
if (!name.equalsIgnoreCase("public") && PermissionUtil.getInstance().lookupUserUniqueId(name) == null) {
messages.add(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.COMMAND_INVALID_PLAYER,
ImmutableMap.of(
"player", name)));
messages.add(TextComponent.of("\n"));
createInputConsumer(src, claim, playerData, type, messages, returnCommand).accept(src);
return;
}
} else if (playerData.commandInput.contains("group ")) {
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
isGroup = true;
name = name.replace("group ", "");
if (!name.equalsIgnoreCase("public") && !PermissionUtil.getInstance().hasGroupSubject(name)) {
messages.add(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.COMMAND_INVALID_PLAYER,
ImmutableMap.of(
"player", name)));
messages.add(TextComponent.of("\n"));
createInputConsumer(src, claim, playerData, type, messages, returnCommand).accept(src);
return;
}
} else {
messages.add(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.COMMAND_INVALID_INPUT,
ImmutableMap.of(
"input", playerData.commandInput)));
messages.add(TextComponent.of("\n"));
createInputConsumer(src, claim, playerData, type, messages, returnCommand).accept(src);
return;
}
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
if (isGroup) {
CommandHelper.executeCommand(src, "trustgroup", name + " " + type.getName().toLowerCase());
} else {
CommandHelper.executeCommand(src, "trust", name + " " + type.getName().toLowerCase());
}
playerData.commandInputTimestamp = null;
playerData.commandConsumer = null;
showTrustList(src, claim, playerData, type, messages, returnCommand);
};
}
private static Consumer<CommandSender> createCancelConsumer(Player src, GDClaim claim, GDPlayerData playerData, TrustType type, Component returnCommand) {
return consumer -> {
playerData.commandInputTimestamp = null;
playerData.commandConsumer = null;
showTrustList(src, claim, playerData, type, new ArrayList<>(), returnCommand);
};
2019-07-24 05:31:17 +02:00
}
private static Consumer<CommandSender> createRemoveConsumer(Player src, GDClaim claim, GDPlayerData playerData, TrustType type, Component returnCommand, IClaimData data, List<UUID> trustList, UUID uuid) {
2019-07-24 05:31:17 +02:00
return consumer -> {
trustList.remove(uuid);
data.setRequiresSave(true);
data.save();
showTrustList(src, claim, playerData, type, new ArrayList<>(), returnCommand);
2019-07-24 05:31:17 +02:00
};
}
Update for 1.4.2 release. * Fix entity damage not passing source in all cases. * Fix vehicle destroy source. * Fix collision interactions being ignored. * Fix #vehicle context not being added on vehicle item use. * Fix 'any' context showing up as 'all'. * Fix context entity type format using '#' in front of name instead of modid. * Fix parent exit claim messages showing on subclaims. * Fix block-place using wrong target in some cases. * Fix NPE during chunk load on new world creation. * Fix claim resize/subdivide resetting on error. * Fix offline players not being found with some commands. * Fix NPE in migrator during claim migration of subclaims. * Fix accrued blocks not being set for players if value exceeded max during migration. * Fix playerdata migrate file not being created if parent folder did not exist. * Fix hover contexts for partial results in flag GUI. * Fix #pet tag not being formatted properly with contexts. * Fix entity-damage used_item context not being added. * Add new group context #hanging which represents hanging entities such as item frames. * Add lava source to fire-spread flag definition. * Add user context support for advanced flag GUI. * Add endercrystal-use and armorstand-use definitions. * Add entity-damage-source-blacklist. * Add active claim visual time to config. * Add tag support for used_item. * Add visual tracking for create block visuals. * (Bukkit) Add extra permission check when using item on a block. * Add gd_claim_override=claim context to water-flow flag definition. * Add new admin command '/abandonworld [<world>]' which will abandon all user claims in world specified. * Add support for world argument in commands '/abandonall', '/deleteall', and '/deletealladmin'. * Add MC 1.16.1 support. * Update kyori libraries to latest. * Don't process stair blocks on right-click. * Refactor ADMIN group handling in PRESET GUI. - All ADMIN flags will now be forced to claim only. - If you want to change flags globally then simply provide a default context in the definition which will be applied at startup. * Cleanup USER PRESET hover for normal users. * Improve persistent check done if a user is trusted. - Only non-claim owners that are trusted will have an additional permission check to see if an admin denied/allowed something via a flag not given by trust system. * (Hybrid) Add mod registry support for hybrid servers. * (Hybrid) Add mod category to 'global.conf' to identify fakeplayers and mod id's. * (Hybrid) Add initial fakeplayer support. * (Hybrid) Added pixelmon animal support. * (Hybrid) Added #pixelmon:animal tag for natural spawns. * Check user/group permission excluding default group before trust is checked. Note: This allows admins to allow/deny permissions while using trust. Note: Only '/cfp' and '/cfg' is supported. * Only check persistent permissions with overrides. * Change user context to support all claim types except wilderness. * Change global context to support all claim types including wilderness. * Rename /cfd command to /cfdebug to avoid accidental use. * Disable /cfdebug on logout.
2020-06-25 09:15:24 +02:00
private static Consumer<CommandSender> createRemoveGroupConsumer(Player src, GDClaim claim, GDPlayerData playerData, TrustType type, Component returnCommand, IClaimData data, List<String> trustList, String group) {
return consumer -> {
trustList.remove(group);
data.setRequiresSave(true);
data.save();
showTrustList(src, claim, playerData, type, new ArrayList<>(), returnCommand);
};
}
2019-07-24 05:31:17 +02:00
}