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

148 lines
6.6 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.CommandCompletion;
2019-07-24 05:31:17 +02:00
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Optional;
2019-07-24 05:31:17 +02:00
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.griefdefender.GDPlayerData;
import com.griefdefender.GriefDefenderPlugin;
import com.griefdefender.api.GriefDefender;
import com.griefdefender.api.Tristate;
import com.griefdefender.api.claim.TrustType;
import com.griefdefender.api.claim.TrustTypes;
import com.griefdefender.api.permission.Context;
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.MessageStorage;
2019-07-24 05:31:17 +02:00
import com.griefdefender.event.GDCauseStackManager;
import com.griefdefender.event.GDGroupTrustClaimEvent;
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
import com.griefdefender.permission.GDPermissionGroup;
2019-07-24 05:31:17 +02:00
import com.griefdefender.permission.GDPermissions;
import com.griefdefender.util.PermissionUtil;
import net.kyori.text.Component;
import net.kyori.text.adapter.bukkit.TextAdapter;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bukkit.entity.Player;
@CommandAlias("%griefdefender")
@CommandPermission(GDPermissions.COMMAND_TRUST_GROUP)
public class CommandTrustGroup extends BaseCommand {
@CommandCompletion("@gdgroups @gdtrusttypes @gddummy")
2019-07-24 05:31:17 +02:00
@CommandAlias("trustgroup")
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-group")
@Syntax("<group> [<accessor|builder|container|manager>]")
2019-07-24 05:31:17 +02:00
@Subcommand("trust group")
public void execute(Player player, String groupName, @Optional String type) {
TrustType trustType = null;
if (type == null) {
trustType = TrustTypes.BUILDER;
} else {
trustType = CommandHelper.getTrustType(type);
if (trustType == null) {
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().TRUST_INVALID);
return;
}
2019-07-24 05:31:17 +02:00
}
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
final GDPermissionGroup group = PermissionHolderCache.getInstance().getOrCreateGroup(groupName);
2019-07-24 05:31:17 +02:00
if (group == null) {
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
GriefDefenderPlugin.sendMessage(player, MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.COMMAND_INVALID_GROUP, ImmutableMap.of(
"group", groupName)));
2019-07-24 05:31:17 +02:00
return;
}
if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(player.getWorld().getUID())) {
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_DISABLED_WORLD);
2019-07-24 05:31:17 +02:00
return;
}
// determine which claim the player is standing in
GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation());
if (!playerData.canIgnoreClaim(claim) && claim.allowEdit(player) != null) {
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().PERMISSION_COMMAND_TRUST);
2019-07-24 05:31:17 +02:00
return;
}
//check permission here
if(claim.allowGrantPermission(player) != null) {
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
final Component message = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.PERMISSION_TRUST,
ImmutableMap.of(
1.3.1 Update * Fix wrong type being displaying in /claiminfo. * Fix claim teleport in nether. * Fix claim visuals in/out of liquids. * Fix inventory check on interaction. * Fix walkspeed, gamemode, and weather options not resetting back to default on claim exit. * Fix option gui not displaying decimals for doubles. * Fix entity dupe on schematic restore. * Fix claim schematic creation dates on load. * Fix wither causing damage when spawned by players. * Fix ice/snow form flags. * Fix visuals not showing on snow. * Fix inability to attack tameable entities with no owner. * Fix claim cleanup task exiting prematurely. * Fix scaffolding not breaking fully. * Fix Flag GUI preset/advanced translations. * Fix '/cog <group>' not displaying options for group. * Fix option GUI toggle value hover. * Fix block burn across blocks not triggering block-spread. * Fix monsters such as phantom and ghast not being ignored during entity-damage checks. * Fixed tamed entity protection when source is not entity. * Fix snow-melt showing up as block-modify instead of block-break * Fix player buckets not checking place or break. * Fix 'fire-spread' and 'vehicle-use' flag definitions. * Fix NPE when changing claim type * Fix visuals loading unloaded chunks. * Fix player options not being set while in claim. * Fix isTileInventory check. * Fix user playerdata in PlaceHolderProvider. * Fix claim resize exploit. * Fix flag definitions GUI not showing inheritance values. * Fix entity explosion getting wrong user sometimes. * Fix tracking data not always being saved. * Fix #crops tag not working. * Fix tnt chain explosions. * Add 'player-fly-speed' option. * Add support for decimal values in option GUI. * Add missing translation when deleting all player claims. * Add restore claim in progress message. * Add pl_PL language support. Thanks to Maul for contribution * Add permission 'griefdefender.admin.bypass.pvp-creative' to bypass pvp creative protection. * Add permission 'griefdefender.user.claim.rent.base' for new '/claimrent' command. * Add permission 'griefdefender.user.claim.rent.sign' to control rent sign usage. * Add permission 'griefdefender.user.claim.sell.sign' to control sell sign usage. * Add flag definition 'turtle-egg-hatch' * Add flag definition 'falling-block-break' . * Add flag definition 'fire-entity-damage'. * Add flag/option enable control to respective configs. * Add group context support for flag definitions. * Add new context gd_claim_default=user and gd_claim_override=user which applies to all claim types except wilderness and admin. * Add owner override support with gd_claim_override=claim context. You can use this context to have owners be affected in claims. They also have the ability to toggle these. * Add villager-trade and villager-farm definitions. * Add /claimtax command. * Add /claimrent command. Note: To create a rental via command ex. /claimrent 10h - creates rental for $10 per hour ex. /claimrent 10h 5 - creates rental for $10 per hour w/ max 5 days. * Add claim restore functionality for 1.14+ servers. Note: To restore a claim, use /claimrestore * Add toggle support for isExpired in /claiminfo * Add Rent/Sell signs. * Add item frame rotation protection. * Add support for 'AsyncWorldEdit'. * Add /claimrent command for displaying rentable claims. * Add PvP config to manage pvp control. * Add PvP protection when flying during PvP. * Add PvP protection when in creative mode. * Add override support for options. * Add gd_claim_override=claim support for /cf command. * Add entity-damage logs for monster damage. * Add tracking support for piston item spawns. * Add client visual queue to avoid sending too much traffic in a single tick. Default 12 block changes per tick. See 'client-visuals-per-tick' in global.conf to change. * Add 'filler-spacing' to visual config. Default 10 * Add explosion surface blacklists for block/entities. * Add new flag 'inventory-item-move' * Add falling block tracking. * Add rent-schematic-restore-admin for controlling rent restores in admin claims. * Add explosion-cancel-block-limit for controlling explosion block size limit in devents. * Enhance claim visual functionality. * Refactor visual backend to be more efficient with server resources. * Ensure block transactions are never sent more than once to client during a single visual update. * Further enhance visual functionality with left/right clicks. * Improve '/gddebug' by adding a fully functional filter. Ex. '/gddebug record creeper' would show all actions with creeper. Ex. '/gddebug record claim' will show only claim you are standing in. * Cleanup option permission lookups. * Implement visual API. * Improve claim getChunks call. * Improve context display in debug paste. * Allow renters to interact with living entities. * Allow bank/tax systems to be used separately. * Allow pistons to be protected in wilderness. * Confirm buttons will now be invalidated after first click. * Deny owner item spawns in claim that is rented and can restore. * Deny '/giveblocks' on self. * Check max accrued blocks during /giveblocks. * Only adjust accrued blocks when using /giveblocks. * Optimize tracking data saves. * Force last active date save on player login. * Ignore drowning damage. * Move 'pvp' user definition to admin. * Change 'player-health-regen' option default to 0. * Change 'player-walk-speed' option default to 0. * Change 'tax-rate' option default to 0.1 * Change 'fall-entity-damage' to global default context. * Change 'fall-player-damage' to global default context.
2020-06-06 01:26:14 +02:00
"owner", claim.getOwnerDisplayName()));
2019-07-24 05:31:17 +02:00
GriefDefenderPlugin.sendMessage(player, message);
return;
}
GDCauseStackManager.getInstance().pushCause(player);
GDGroupTrustClaimEvent.Remove event =
new GDGroupTrustClaimEvent.Remove(claim, ImmutableList.of(group.getName()), TrustTypes.NONE);
GriefDefender.getEventManager().post(event);
GDCauseStackManager.getInstance().popCause();
if (event.cancelled()) {
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
TextAdapter.sendComponent(player, event.getMessage().orElse(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.TRUST_PLUGIN_CANCEL,
ImmutableMap.of("target", group))));
2019-07-24 05:31:17 +02:00
return;
}
final String permission = CommandHelper.getTrustPermission(trustType);
Set<Context> contexts = new HashSet<>();
contexts.add(claim.getContext());
final List<String> groupTrustList = claim.getGroupTrustList(trustType);
if (!groupTrustList.contains(group.getName())) {
groupTrustList.add(group.getName());
} else {
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
final Component message = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.TRUST_ALREADY_HAS,
ImmutableMap.of(
"target", group.getName(),
"type", trustType.getName()));
GriefDefenderPlugin.sendMessage(player, message);
return;
2019-07-24 05:31:17 +02:00
}
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
PermissionUtil.getInstance().setPermissionValue(group, permission, Tristate.TRUE, contexts);
2019-07-24 05:31:17 +02:00
claim.getInternalClaimData().setRequiresSave(true);
claim.getInternalClaimData().save();
2019-07-24 05:31:17 +02:00
Update for 1.2.0 release. * Implement custom flag system to allow admins to create any flag they desire with contexts. See wiki for more info. * Rewrite option and flag GUI's to be more user friendly. * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling * Refactor option system to support generics. * Add many new options. See https://github.com/bloodmc/GriefDefenderAPI/blob/master/src/main/java/com/griefdefender/api/permission/option/Options.java * Add new permission 'griefdefender.user.claim.option' to control what options user's can use in their claims. Ex. If a user tries to use 'player-deny-fly', GD will check 'griefdefender.user.claim.option.player-deny-fly' * Added the following permissions to allow admins to designate a player to manage options 'griefdefender.admin.claim.command.option.group.{type}' 'griefdefender.admin.claim.command.option.player.{type}' * Add new claim restore setting 'auto-schematic-restore'. This setting will allow servers to have newly created claims auto-generate a schematic. When these claims expire, the auto-generated schematic will be used for restore. Note: This setting is only designed for newly created worlds where players cannot build in the wilderness. Use with caution and read comments carefully. * Add new message setting 'enter-exit-chat-type'. This setting is used to control the default chat type (Chat/ActionBar/Title) used when sending enter/exit claim messages to players. Note: This can be overridden by plugins. * Add support for controlling raids. You can find the new toggle in /raid * Add various GP command aliases to make it easier for users transitioning to GD * Add confirmations for all claim delete commands. * Add GPFlags migrator. Note: When the GP Bukkit migrator is enabled, GD will automatically look for GPFlags data and migrate with claim data. * Add support for EntityCombustByBlockEvent, EntityCombustByEntityEvent, and EntityDamageByBlockEvent. * Add EssentialsX hook to deny '/fly' command when 'player-deny-flight' is true for a user * Add event result cache. * Add contexts to hover in '/cf' command * Add /givepet command * Add confirmations to abandon and delete commands * Add support for /sellblocks in economy mode * Add new messages for economy mode * Fix NPE during checkSizeLimits * Fix interactions with custom inventories. * Fix custom flags not showing up in '/cf' command. * Fix interact-inventory denying action when interact-block-secondary is true * Fix interact-inventory not checking entity ids. * Fix shovel location being reset with insufficient blocks * Fix GP Bukkit migrator not handling subdivisions properly. * Fix 'block-break' flag being ignored in wilderness * Fix invalid playerdata UUID files being loaded causing errors in console. * Fix HashSet error in TaxApplyTask * Fix 'command-execute' flag * Fix PvP setting in /claiminfo. * Fix claim overrides not checking default group. * Fix various message issues * Fix 'minecraft:air' showing up as used_item context. * Fix EntityChangeBlockEvent user tracking. * Fix abandonclaims not returning blocks to player. * Fix players not being able to use pet inventories in other claims. * Fix players being kicked when using gd callbacks. * Fix '/cf' display issues * Fix '/cf' mod id not being set properly with contexts * Fix '/cf' item id context lookups * Fix '/scb' command * Fix '/gddebug' start/end time. * Fix economy plugin detection * Fix economy mode buy/sell not applying proper funds * Fix ClaimBlocks task not depositing funds while in economy mode * Prevent /buyblocks working in economy mode * Remove economy mode check from /scb and /acb * Rewrite option and flag GUI's to be more user friendly. * Improve PermissionHolderCache * Refactor permission handling to support more permission plugins. * Refactor permission lookups to use storage directly for better context handling Note: '/lp verbose' will no longer be able to track GD flag lookups. * Increase cache to 30min * Change gddebug paste site to griefdefender.github.io
2019-08-23 22:49:00 +02:00
final Component message = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.TRUST_GRANT, ImmutableMap.of(
2019-07-24 05:31:17 +02:00
"target", group.getName(),
"type", trustType.getName()));
2019-07-24 05:31:17 +02:00
GriefDefenderPlugin.sendMessage(player, message);
}
}