GriefDefender/sponge/src/main/java/com/griefdefender/provider/LuckPermsProvider.java

1116 lines
52 KiB
Java
Raw Normal View History

2019-11-24 23:01:05 +01: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.provider;
import com.google.common.collect.ImmutableSet;
import com.griefdefender.GDPlayerData;
import com.griefdefender.GriefDefenderPlugin;
import com.griefdefender.api.Tristate;
import com.griefdefender.api.claim.Claim;
import com.griefdefender.api.permission.Context;
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
import com.griefdefender.api.permission.ContextKeys;
2019-11-24 23:01:05 +01:00
import com.griefdefender.api.permission.PermissionResult;
import com.griefdefender.api.permission.ResultTypes;
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
import com.griefdefender.api.permission.flag.FlagData;
import com.griefdefender.api.permission.flag.FlagDefinition;
2019-11-24 23:01:05 +01:00
import com.griefdefender.api.permission.option.Option;
import com.griefdefender.cache.PermissionHolderCache;
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
import com.griefdefender.claim.ClaimContextCalculator;
2019-11-24 23:01:05 +01:00
import com.griefdefender.claim.GDClaim;
import com.griefdefender.listener.LuckPermsEventHandler;
import com.griefdefender.permission.GDPermissionGroup;
2019-11-24 23:01:05 +01:00
import com.griefdefender.permission.GDPermissionHolder;
import com.griefdefender.permission.GDPermissionResult;
import com.griefdefender.permission.GDPermissionUser;
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
import com.griefdefender.registry.OptionRegistryModule;
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
import com.griefdefender.util.PermissionUtil;
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
import net.kyori.text.TextComponent;
2019-12-28 18:23:50 +01:00
import net.luckperms.api.LuckPerms;
import net.luckperms.api.cacheddata.CachedMetaData;
import net.luckperms.api.cacheddata.CachedPermissionData;
import net.luckperms.api.context.ContextSet;
import net.luckperms.api.context.ImmutableContextSet;
import net.luckperms.api.context.MutableContextSet;
import net.luckperms.api.model.PermissionHolder;
import net.luckperms.api.model.PermissionHolder.Identifier;
import net.luckperms.api.model.data.DataMutateResult;
import net.luckperms.api.model.data.DataType;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.user.User;
import net.luckperms.api.node.Node;
import net.luckperms.api.node.NodeType;
import net.luckperms.api.node.types.MetaNode;
import net.luckperms.api.node.types.PermissionNode;
import net.luckperms.api.query.QueryMode;
import net.luckperms.api.query.QueryOptions;
import net.luckperms.api.query.dataorder.DataQueryOrder;
import net.luckperms.api.query.dataorder.DataQueryOrderFunction;
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
import net.luckperms.api.query.dataorder.DataTypeFilter;
import net.luckperms.api.query.dataorder.DataTypeFilterFunction;
2019-11-24 23:01:05 +01:00
import java.util.ArrayList;
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
import java.util.Arrays;
2019-12-28 18:23:50 +01:00
import java.util.Collection;
2019-11-24 23:01:05 +01:00
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.UUID;
import java.util.Map.Entry;
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
import java.util.concurrent.CompletableFuture;
2019-11-24 23:01:05 +01:00
import java.util.concurrent.ExecutionException;
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
import java.util.function.Predicate;
2019-11-24 23:01:05 +01: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
import org.checkerframework.checker.nullness.qual.NonNull;
2019-12-28 18:23:50 +01:00
import org.spongepowered.api.Sponge;
import org.spongepowered.api.service.ProviderRegistration;
2019-11-24 23:01:05 +01:00
public class LuckPermsProvider implements PermissionProvider {
public static Comparator<Set<Context>> CONTEXT_COMPARATOR = new Comparator<Set<Context>>() {
@Override
public int compare(Set<Context> s1, Set<Context> s2) {
if (s1.size() > s2.size()) {
return -1;
}
if (s1.size() < s2.size()) {
return 1;
}
return s1.equals(s2) ? 0 : -1;
}
};
2019-12-28 18:23:50 +01:00
private final LuckPerms luckPermsApi;
private final static DefaultDataQueryOrderFunction DEFAULT_DATA_QUERY_ORDER = new DefaultDataQueryOrderFunction();
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 final static DefaultPersistentOnlyDataFilter DEFAULT_PERSISTENT_ONLY = new DefaultPersistentOnlyDataFilter();
private final static DefaultTransientOnlyDataFilter DEFAULT_TRANSIENT_ONLY = new DefaultTransientOnlyDataFilter();
private final static UserPersistentOnlyDataFilter USER_PERSISTENT_ONLY = new UserPersistentOnlyDataFilter();
2019-11-24 23:01:05 +01:00
public LuckPermsProvider() {
2019-12-28 18:23:50 +01:00
final ProviderRegistration<LuckPerms> service = Sponge.getServiceManager().getRegistration(LuckPerms.class).orElse(null);
this.luckPermsApi = service.getProvider();
new LuckPermsEventHandler(this.luckPermsApi);
2019-11-24 23:01:05 +01:00
}
2019-12-28 18:23:50 +01:00
public LuckPerms getApi() {
2019-11-24 23:01:05 +01:00
return this.luckPermsApi;
}
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
@Override
public String getServerName() {
return this.luckPermsApi.getServerName();
}
2019-11-24 23:01:05 +01:00
@Override
public boolean hasGroupSubject(String identifier) {
return this.getGroupSubject(identifier) != null;
}
public PermissionHolder getLuckPermsHolder(GDPermissionHolder holder) {
if (holder instanceof GDPermissionUser) {
return this.getLuckPermsUser(holder.getIdentifier());
}
return this.getLuckPermsGroup(holder.getIdentifier());
}
public User getLuckPermsUser(String identifier) {
User user = null;
2019-11-24 23:01:05 +01:00
UUID uuid = null;
if (identifier.length() == 36) {
try {
uuid = UUID.fromString(identifier);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
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
} else {
user = this.luckPermsApi.getUserManager().getUser(identifier);
if (user == null) {
try {
uuid = this.luckPermsApi.getUserManager().lookupUniqueId(identifier).get();
} catch (Throwable t) {
// ignore
}
}
2019-11-24 23:01:05 +01:00
}
if (uuid != null) {
user = this.getUserSubject(uuid);
}
return user;
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
public boolean createDefaultGroup(String identifier) {
Group group = this.luckPermsApi.getGroupManager().getGroup(identifier);
if (group == null) {
try {
GriefDefenderPlugin.getInstance().getLogger().info("Creating group '" + identifier + "' in LuckPerms...");
final String dataType = identifier.replaceAll("griefdefender_", "");
group = this.luckPermsApi.getGroupManager().createAndLoadGroup(identifier).get();
GriefDefenderPlugin.getInstance().getLogger().info("Group created successfully.");
if (group != null) {
final Group defaultGroup = this.luckPermsApi.getGroupManager().getGroup("default");
if (defaultGroup != null) {
GriefDefenderPlugin.getInstance().getLogger().info("Migrating legacy " + dataType + " permissions from 'default' to '" + identifier + "'...");
final Node node = this.luckPermsApi.getNodeBuilderRegistry().forInheritance().group(group).build();
// move all existing GD permissions to new group
List<Node> nodesToRemove = new ArrayList<>();
for (Node permNode : defaultGroup.data().toCollection()) {
if (!permNode.getKey().contains("griefdefender")) {
continue;
}
if (permNode.getType() == NodeType.META) {
if (permNode.getKey().contains("griefdefender") && identifier.equals(GriefDefenderPlugin.GD_OPTION_GROUP_NAME)) {
GriefDefenderPlugin.getInstance().getLogger().info("Found legacy option node [Key: " + permNode.getKey() + ", Value: " + permNode.getValue() + ", Contexts: " + permNode.getContexts() + "].\nAdding option node to group '" + identifier + "'...");
group.data().add(permNode);
nodesToRemove.add(permNode);
}
continue;
}
if (permNode.getType() != NodeType.PERMISSION) {
continue;
}
if (identifier.equals(GriefDefenderPlugin.GD_OVERRIDE_GROUP_NAME)) {
if (permNode.getContexts().containsKey(ContextKeys.CLAIM_OVERRIDE)) {
GriefDefenderPlugin.getInstance().getLogger().info("Found legacy override permission node [Key: " + permNode.getKey() + ", Value: " + permNode.getValue() + ", Contexts: " + permNode.getContexts() + "].\nAdding permission node to group '" + identifier + "'...");
group.data().add(permNode);
nodesToRemove.add(permNode);
}
continue;
} else if (identifier.equals(GriefDefenderPlugin.GD_CLAIM_GROUP_NAME)) {
if (permNode.getContexts().containsKey(ContextKeys.CLAIM)) {
GriefDefenderPlugin.getInstance().getLogger().info("Found legacy claim permission node [Key: " + permNode.getKey() + ", Value: " + permNode.getValue() + ", Contexts: " + permNode.getContexts() + "].\nAdding permission node to group '" + identifier + "'...");
group.data().add(permNode);
nodesToRemove.add(permNode);
}
continue;
} else if (identifier.equals(GriefDefenderPlugin.GD_DEFAULT_GROUP_NAME)) {
if (!permNode.getContexts().isEmpty()) {
GriefDefenderPlugin.getInstance().getLogger().info("Found legacy default permission node [Key: " + permNode.getKey() + ", Value: " + permNode.getValue() + ", Contexts: " + permNode.getContexts() + "].\nAdding permission node to group '" + identifier + "'...");
group.data().add(permNode);
nodesToRemove.add(permNode);
}
}
}
if (!nodesToRemove.isEmpty()) {
GriefDefenderPlugin.getInstance().getLogger().info("Removing legacy permission nodes from 'default' group...");
}
for (Node rem : nodesToRemove) {
defaultGroup.data().remove(rem);
}
if (!nodesToRemove.isEmpty()) {
GriefDefenderPlugin.getInstance().getLogger().info("Cleanup complete.");
}
final DataMutateResult result = defaultGroup.data().add(node);
GriefDefenderPlugin.getInstance().getLogger().info("Saving permission changes to 'default'...");
this.luckPermsApi.getGroupManager().saveGroup(defaultGroup).get();
GriefDefenderPlugin.getInstance().getLogger().info("Saving permission changes to '" + identifier + "'...");
this.luckPermsApi.getGroupManager().saveGroup(group).get();
GriefDefenderPlugin.getInstance().getLogger().info("Migration to group '" + identifier + "' complete.");
}
}
} catch (Throwable t) {
t.printStackTrace();
}
2019-11-24 23:01:05 +01:00
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return group != null;
}
2019-11-24 23:01:05 +01:00
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
public Group getLuckPermsGroup(String identifier) {
return this.luckPermsApi.getGroupManager().getGroup(identifier);
2019-11-24 23:01:05 +01:00
}
public Group getGroupSubject(String identifier) {
final Group group = this.luckPermsApi.getGroupManager().getGroup(identifier);
if (group != null) {
return group;
}
try {
return this.luckPermsApi.getGroupManager().loadGroup(identifier).get().orElse(null);
} catch (InterruptedException e) {
return null;
} catch (ExecutionException e) {
return null;
}
}
public UUID lookupUserUniqueId(String name) {
final User user = this.getLuckPermsUser(name);
if (user != null) {
2019-12-28 18:23:50 +01:00
return user.getUniqueId();
2019-11-24 23:01:05 +01:00
}
return null;
}
public User getUserSubject(UUID uuid) {
User user = this.luckPermsApi.getUserManager().getUser(uuid);
if (user != null) {
return user;
}
try {
user = this.luckPermsApi.getUserManager().loadUser(uuid).get();
if (user != null) {
return user;
}
} catch (InterruptedException e) {
return null;
} catch (ExecutionException e) {
return null;
}
return null;
}
public List<String> getAllLoadedPlayerNames() {
List<String> subjectList = new ArrayList<>();
for (User user : this.luckPermsApi.getUserManager().getLoadedUsers()) {
2019-12-28 18:23:50 +01:00
final String name = user.getUsername();
2019-11-24 23:01:05 +01:00
if (name != null) {
subjectList.add(name);
}
}
if (!subjectList.contains("public")) {
subjectList.add("public");
}
return subjectList;
}
public List<String> getAllLoadedGroupNames() {
List<String> subjectList = new ArrayList<>();
for (Group group : this.luckPermsApi.getGroupManager().getLoadedGroups()) {
final String name = group.getName();
if (name != null) {
subjectList.add(name);
}
}
if (!subjectList.contains("public")) {
subjectList.add("public");
}
return subjectList;
}
public void addActiveContexts(Set<Context> contexts, GDPermissionHolder permissionHolder) {
addActiveContexts(contexts, permissionHolder, null, null);
}
public void addActiveContexts(Set<Context> contexts, GDPermissionHolder permissionHolder, GDPlayerData playerData, Claim claim) {
if (playerData != null) {
playerData.ignoreActiveContexts = true;
}
final PermissionHolder luckPermsHolder = this.getLuckPermsHolder(permissionHolder);
if (luckPermsHolder instanceof Group) {
contexts.addAll(this.getGDContexts(this.luckPermsApi.getContextManager().getStaticContext().mutableCopy()));
return;
}
2019-12-28 18:23:50 +01:00
ImmutableContextSet contextSet = this.luckPermsApi.getContextManager().getContext((User) luckPermsHolder).orElse(null);
2019-11-24 23:01:05 +01:00
if (contextSet == null) {
contextSet = this.luckPermsApi.getContextManager().getStaticContext();
}
if (contextSet == null) {
return;
}
MutableContextSet activeContexts = contextSet.mutableCopy();
if (playerData != null && claim != null) {
final Claim parent = claim.getParent().orElse(null);
if (parent != null && claim.getData() != null && claim.getData().doesInheritParent()) {
activeContexts.remove(parent.getContext().getKey(), parent.getContext().getValue());
} else {
activeContexts.remove(claim.getContext().getKey(), claim.getContext().getValue());
}
}
contexts.addAll(this.getGDContexts(activeContexts));
}
public void clearPermissions(GDClaim claim) {
// check default holder
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
this.clearPermission(claim.getUniqueId(), GriefDefenderPlugin.GD_CLAIM_HOLDER);
// check loaded groups
for (Group group : this.luckPermsApi.getGroupManager().getLoadedGroups()) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (group.getName().equalsIgnoreCase(GriefDefenderPlugin.DEFAULT_GROUP_NAME) || group.getName().startsWith("griefdefender_")) {
continue;
}
final GDPermissionHolder holder = PermissionHolderCache.getInstance().getOrCreateGroup(group.getName());
if (holder == null) {
continue;
}
this.clearPermission(claim.getUniqueId(), holder);
}
// check user trusts
for (UUID uuid : claim.getUserTrusts()) {
if (uuid.equals(GriefDefenderPlugin.PUBLIC_UUID) || uuid.equals(GriefDefenderPlugin.WORLD_USER_UUID) || uuid.equals(GriefDefenderPlugin.ADMIN_USER_UUID)) {
continue;
}
final GDPermissionHolder holder = PermissionHolderCache.getInstance().getOrCreateUser(uuid);
if (holder == null) {
continue;
}
this.clearPermission(claim.getUniqueId(), holder);
}
}
private void clearPermission(UUID claimUniqueId, GDPermissionHolder holder) {
Map<Set<Context>, Map<String, Boolean>> permissionMap = this.getPermanentPermissions(holder);
2019-11-24 23:01:05 +01:00
for (Entry<Set<Context>, Map<String, Boolean>> mapEntry : permissionMap.entrySet()) {
for (Context context : mapEntry.getKey()) {
if (context.getKey().equalsIgnoreCase("gd_claim") && context.getValue().equalsIgnoreCase(claimUniqueId.toString())) {
this.clearPermissions(holder, mapEntry.getKey());
break;
}
}
}
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
Map<Set<Context>, Map<String, List<String>>> optionMap = this.getPermanentOptions(holder);
for (Entry<Set<Context>, Map<String, List<String>>> mapEntry : optionMap.entrySet()) {
for (Context context : mapEntry.getKey()) {
if (context.getKey().equalsIgnoreCase("gd_claim") && context.getValue().equalsIgnoreCase(claimUniqueId.toString())) {
this.clearPermissions(holder, mapEntry.getKey());
2019-11-24 23:01:05 +01:00
break;
}
}
}
}
public void clearPermissions(GDPermissionHolder holder, Context context) {
clearPermissions(holder, ImmutableSet.of(context));
}
public void clearPermissions(GDPermissionHolder holder, Set<Context> contexts) {
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return;
}
2019-12-28 18:23:50 +01:00
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
permissionHolder.data().clear(set);
2019-11-24 23:01:05 +01:00
this.savePermissionHolder(permissionHolder);
}
public boolean holderHasPermission(GDPermissionHolder holder, String permission) {
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return false;
}
2019-12-28 18:23:50 +01:00
final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).build();
return permissionHolder.getCachedData().getPermissionData(query).checkPermission(permission).asBoolean();
2019-11-24 23:01:05 +01:00
}
public Map<String, Boolean> getPermissions(GDPermissionHolder holder, Set<Context> contexts) {
2019-12-28 18:23:50 +01:00
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
2019-11-24 23:01:05 +01:00
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new HashMap<>();
}
2019-12-28 18:23:50 +01:00
final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build();
CachedPermissionData cachedData = permissionHolder.getCachedData().getPermissionData(query);
return cachedData.getPermissionMap();
2019-11-24 23:01:05 +01:00
}
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
public Map<String, List<String>> getOptions(GDPermissionHolder holder, Set<Context> contexts) {
2019-12-28 18:23:50 +01:00
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
2019-11-24 23:01:05 +01:00
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new HashMap<>();
}
2019-12-28 18:23:50 +01:00
final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build();
CachedMetaData cachedData = permissionHolder.getCachedData().getMetaData(query);
// TODO
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
Map<String, List<String>> metaMap = new HashMap<>();
2019-12-28 18:23:50 +01:00
for (Map.Entry<String, List<String>> mapEntry : cachedData.getMeta().entrySet()) {
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
metaMap.put(mapEntry.getKey(), mapEntry.getValue());
2019-12-28 18:23:50 +01:00
}
return metaMap;
2019-11-24 23:01:05 +01:00
}
public Map<Set<Context>, Map<String, Boolean>> getPermanentPermissions(GDPermissionHolder holder) {
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new HashMap<>();
}
2019-12-28 18:23:50 +01:00
final Collection<Node> nodes = permissionHolder.data().toCollection();
2019-11-24 23:01:05 +01:00
Map<Set<Context>, Map<String, Boolean>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, Boolean>>(CONTEXT_COMPARATOR);
for (Node node : nodes) {
2019-12-28 18:23:50 +01:00
if (node.getType() != NodeType.PERMISSION) {
2019-11-24 23:01:05 +01:00
continue;
}
2019-12-28 18:23:50 +01:00
final PermissionNode permissionNode = (PermissionNode) node;
final Set<Context> contexts = getGPContexts(node.getContexts());
2019-11-24 23:01:05 +01:00
Map<String, Boolean> permissionEntry = permanentPermissionMap.get(contexts);
if (permissionEntry == null) {
permissionEntry = new HashMap<>();
2019-12-28 18:23:50 +01:00
permissionEntry.put(permissionNode.getPermission(), node.getValue());
2019-11-24 23:01:05 +01:00
permanentPermissionMap.put(contexts, permissionEntry);
} else {
2019-12-28 18:23:50 +01:00
permissionEntry.put(permissionNode.getPermission(), node.getValue());
2019-11-24 23:01:05 +01:00
}
}
return permanentPermissionMap;
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
public Map<Set<Context>, Map<String, Boolean>> getAllPermanentPermissions() {
Map<Set<Context>, Map<String, Boolean>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, Boolean>>(CONTEXT_COMPARATOR);
this.addAllPermanentPermissions(this.getLuckPermsHolder(GriefDefenderPlugin.GD_CLAIM_HOLDER), permanentPermissionMap);
this.addAllPermanentPermissions(this.getLuckPermsHolder(GriefDefenderPlugin.GD_DEFAULT_HOLDER), permanentPermissionMap);
this.addAllPermanentPermissions(this.getLuckPermsHolder(GriefDefenderPlugin.GD_DEFINITION_HOLDER), permanentPermissionMap);
this.addAllPermanentPermissions(this.getLuckPermsHolder(GriefDefenderPlugin.GD_OPTION_HOLDER), permanentPermissionMap);
this.addAllPermanentPermissions(this.getLuckPermsHolder(GriefDefenderPlugin.GD_OVERRIDE_HOLDER), permanentPermissionMap);
return permanentPermissionMap;
}
private Map<Set<Context>, Map<String, Boolean>> addAllPermanentPermissions(PermissionHolder holder, Map<Set<Context>, Map<String, Boolean>> permanentPermissionMap) {
final Collection<Node> nodes = holder.data().toCollection();
for (Node node : nodes) {
if (node.getType() != NodeType.PERMISSION) {
continue;
}
final PermissionNode permissionNode = (PermissionNode) node;
final Set<Context> contexts = getGPContexts(node.getContexts());
Map<String, Boolean> permissionEntry = permanentPermissionMap.get(contexts);
if (permissionEntry == null) {
permissionEntry = new HashMap<>();
permissionEntry.put(permissionNode.getPermission(), node.getValue());
permanentPermissionMap.put(contexts, permissionEntry);
} else {
permissionEntry.put(permissionNode.getPermission(), node.getValue());
}
}
return permanentPermissionMap;
}
2019-11-24 23:01:05 +01:00
public Map<Set<Context>, Map<String, Boolean>> getTransientPermissions(GDPermissionHolder holder) {
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new HashMap<>();
}
2019-12-28 18:23:50 +01:00
final Collection<Node> nodes = permissionHolder.transientData().toCollection();
2019-11-24 23:01:05 +01:00
Map<Set<Context>, Map<String, Boolean>> transientPermissionMap = new TreeMap<Set<Context>, Map<String, Boolean>>(CONTEXT_COMPARATOR);
for (Node node : nodes) {
2019-12-28 18:23:50 +01:00
if (node.getType() != NodeType.PERMISSION) {
2019-11-24 23:01:05 +01:00
continue;
}
2019-12-28 18:23:50 +01:00
final PermissionNode permissionNode = (PermissionNode) node;
final Set<Context> contexts = getGPContexts(node.getContexts());
2019-11-24 23:01:05 +01:00
Map<String, Boolean> permissionEntry = transientPermissionMap.get(contexts);
if (permissionEntry == null) {
permissionEntry = new HashMap<>();
2019-12-28 18:23:50 +01:00
permissionEntry.put(permissionNode.getPermission(), node.getValue());
2019-11-24 23:01:05 +01:00
transientPermissionMap.put(contexts, permissionEntry);
} else {
2019-12-28 18:23:50 +01:00
permissionEntry.put(permissionNode.getPermission(), node.getValue());
2019-11-24 23:01:05 +01:00
}
}
return transientPermissionMap;
}
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
public Map<Set<Context>, Map<String, List<String>>> getPermanentOptions(GDPermissionHolder holder) {
2019-11-24 23:01:05 +01:00
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new HashMap<>();
}
2019-12-28 18:23:50 +01:00
final Collection<Node> nodes = permissionHolder.data().toCollection();
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
Map<Set<Context>, Map<String, List<String>>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, List<String>>>(CONTEXT_COMPARATOR);
2019-11-24 23:01:05 +01:00
for (Node node : nodes) {
2019-12-28 18:23:50 +01:00
if (node.getType() != NodeType.META) {
2019-11-24 23:01:05 +01:00
continue;
}
2019-12-28 18:23:50 +01:00
final MetaNode metaNode = (MetaNode) node;
final Set<Context> contexts = getGPContexts(node.getContexts());
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
Map<String, List<String>> metaEntry = permanentPermissionMap.get(contexts);
2019-11-24 23:01:05 +01:00
if (metaEntry == null) {
metaEntry = new HashMap<>();
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
final List<String> values = new ArrayList<>();
values.add(metaNode.getMetaValue());
metaEntry.put(metaNode.getMetaKey(), values);
2019-11-24 23:01:05 +01:00
permanentPermissionMap.put(contexts, metaEntry);
} else {
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
List<String> values = metaEntry.get(metaNode.getMetaKey());
if (values == null) {
values = new ArrayList<>();
values.add(metaNode.getMetaValue());
metaEntry.put(metaNode.getMetaKey(), values);
} else {
values.add(metaNode.getMetaValue());
}
2019-11-24 23:01:05 +01:00
}
}
return permanentPermissionMap;
}
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
public Map<Set<Context>, Map<String, List<String>>> getTransientOptions(GDPermissionHolder holder) {
2019-11-24 23:01:05 +01:00
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new HashMap<>();
}
2019-12-28 18:23:50 +01:00
final Collection<Node> nodes = permissionHolder.transientData().toCollection();
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
Map<Set<Context>, Map<String, List<String>>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, List<String>>>(CONTEXT_COMPARATOR);
2019-11-24 23:01:05 +01:00
for (Node node : nodes) {
2019-12-28 18:23:50 +01:00
if (node.getType() != NodeType.META) {
2019-11-24 23:01:05 +01:00
continue;
}
2019-12-28 18:23:50 +01:00
final MetaNode metaNode = (MetaNode) node;
final Set<Context> contexts = getGPContexts(node.getContexts());
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
Map<String, List<String>> metaEntry = permanentPermissionMap.get(contexts);
2019-11-24 23:01:05 +01:00
if (metaEntry == null) {
metaEntry = new HashMap<>();
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
final List<String> values = new ArrayList<>();
values.add(metaNode.getMetaValue());
metaEntry.put(metaNode.getMetaKey(), values);
2019-11-24 23:01:05 +01:00
permanentPermissionMap.put(contexts, metaEntry);
} else {
Update for 1.5.10 release. * Fix ClaimBlockTask prematurely exiting if a player had max claim blocks. * Fix TaxApplyTask not pulling funds from claim bank first. * Fix ClaimContextCalculator overwriting option claim contexts. * Fix player option commands running during a command causing a loop. * Fix player-command-enter running command from subclaim. * Fix player-command-exit running command to subclaim. * Fix player contexts not being added in all cases where a player is involved. * Fix flag definitions not accepting any context. * Fix elytra enter-claim bypass. * Add 'claim-create-radius-limit' to global config. * Add Simplified Chinese language support (zh_CN). * Add enter-claim flag permission check on player login. * Add enter/exit-claim support for player respawns. If denied, GD will respawn player back in source claim in a safe location. * Add TE NBT id support for mods such as gregtech. * (Hybrid) Fix mohist EntityType mod registration. * (Hybrid/Sponge) Add TE NBT id support for mods such as gregtech. See new setting 'tile-id-nbt-map' under mod category in global.conf * (Sponge) Add 'interact-item-force-list' to global config. Used to force interact-item flag checks when a player left/right-clicks with an item in hand. * (Sponge) Add check to prevent re-registration of worlds. * (Sponge) Add workaround during collisions when user is wrapped in ProjectileSource. * (Sponge) Add EntityThrowable support for getEntityOwner. * (Sponge) Add method to get internal DamageSource type name. * (Sponge) Fix NPE when cancelling claim with '/claimrent cancel' * (Sponge) Fix wrong block being checked during bucket interactions such as lava and water. * (Sponge) Fix block-pre not handing certain mod permission checks such as AE2 cables. * (Sponge) Fix 'block-id-convert-list' feature not using correct id during player interactions. * (Sponge) Fix item-pickup flag not checking trust.
2021-02-06 00:06:14 +01:00
List<String> values = metaEntry.get(metaNode.getMetaKey());
if (values == null) {
values = new ArrayList<>();
values.add(metaNode.getMetaValue());
metaEntry.put(metaNode.getMetaKey(), values);
} else {
values.add(metaNode.getMetaValue());
}
2019-11-24 23:01:05 +01:00
}
}
return permanentPermissionMap;
}
public Map<Set<Context>, Map<String, Boolean>> getAllPermissions(GDPermissionHolder holder) {
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new HashMap<>();
}
2019-12-28 18:23:50 +01:00
final Collection<Node> nodes = permissionHolder.getNodes();
2019-11-24 23:01:05 +01:00
Map<Set<Context>, Map<String, Boolean>> permissionMap = new HashMap<>();
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
for (Node node : nodes) {
Set<Context> contexts = null;
if (contextMap.get(node.getContexts()) == null) {
contexts = getGPContexts(node.getContexts());
contextMap.put(node.getContexts(), contexts);
} else {
contexts = contextMap.get(node.getContexts());
}
Map<String, Boolean> permissionEntry = permissionMap.get(contexts);
if (permissionEntry == null) {
permissionEntry = new HashMap<>();
2019-12-28 18:23:50 +01:00
permissionEntry.put(node.getKey(), node.getValue());
2019-11-24 23:01:05 +01:00
permissionMap.put(contexts, permissionEntry);
} else {
2019-12-28 18:23:50 +01:00
permissionEntry.put(node.getKey(), node.getValue());
2019-11-24 23:01:05 +01:00
}
}
return permissionMap;
}
public Set<Context> getGPContexts(ContextSet contextSet) {
final Set<Context> gpContexts = new HashSet<>();
2019-12-28 18:23:50 +01:00
for (net.luckperms.api.context.Context context : contextSet.toSet()) {
gpContexts.add(new Context(context.getKey(), context.getValue()));
2019-11-24 23:01:05 +01:00
}
return gpContexts;
}
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
@Override
public Tristate getPermissionValue(GDPermissionHolder holder, String permission, Set<Context> contexts) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return this.getPermissionValue(holder, permission, contexts, PermissionDataType.PERSISTENT);
2019-11-24 23:01:05 +01: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
@Override
public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts) {
return this.getPermissionValue(holder, permission, contexts);
2019-11-24 23:01:05 +01: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
@Override
public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts, PermissionDataType type) {
return this.getPermissionValue(holder, permission, contexts, type);
2019-11-24 23:01:05 +01: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
public Tristate getPermissionValue(GDPermissionHolder holder, String permission) {
final Set<Context> contexts = new HashSet<>();
this.checkServerContext(contexts);
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
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
return this.getPermissionValue(holder, permission, set);
2019-11-24 23:01:05 +01: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
public Tristate getPermissionValue(GDPermissionHolder holder, String permission, MutableContextSet contexts) {
return this.getPermissionValue(holder, permission, this.getGDContexts(contexts));
2019-11-24 23:01:05 +01: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
public Tristate getPermissionValue(GDPermissionHolder holder, String permission, Set<Context> contexts, PermissionDataType type) {
this.checkServerContext(contexts);
2019-12-28 18:23:50 +01:00
ImmutableContextSet contextSet = this.getLPContexts(contexts).immutableCopy();
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
return this.getPermissionValue(holder, permission, contextSet, type);
2019-11-24 23:01:05 +01:00
}
public Tristate getPermissionValue(GDPermissionHolder holder, String permission, ContextSet contexts) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return this.getPermissionValue(holder, permission, contexts, PermissionDataType.PERSISTENT);
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
}
public Tristate getPermissionValue(GDPermissionHolder holder, String permission, ContextSet contexts, PermissionDataType type) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
final PermissionHolder permissionHolder = type == PermissionDataType.TRANSIENT ? this.getLuckPermsHolder(GriefDefenderPlugin.GD_DEFAULT_HOLDER) : this.getLuckPermsHolder(holder);
2019-11-24 23:01:05 +01:00
if (permissionHolder == null) {
return Tristate.UNDEFINED;
}
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
QueryOptions query = null;
if (type == PermissionDataType.TRANSIENT) {
query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, DEFAULT_TRANSIENT_ONLY).context(contexts).build();
} else if (type == PermissionDataType.PERSISTENT) {
query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, DEFAULT_PERSISTENT_ONLY).context(contexts).build();
} else if (type == PermissionDataType.USER_PERSISTENT) {
query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, USER_PERSISTENT_ONLY).context(contexts).build();
} else {
query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(contexts).build();
}
2019-12-28 18:23:50 +01:00
CachedPermissionData cachedData = permissionHolder.getCachedData().getPermissionData(query);
return getGDTristate(cachedData.checkPermission(permission));
2019-11-24 23:01:05 +01:00
}
// To set options, pass "meta.option".
@Override
public String getOptionValue(GDPermissionHolder holder, Option option, Set<Context> contexts) {
// If no server context exists, add global
this.checkServerContext(contexts);
2019-12-28 18:23:50 +01:00
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
2019-11-24 23:01:05 +01:00
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return null;
}
2019-12-28 18:23:50 +01:00
final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build();
CachedMetaData metaData = permissionHolder.getCachedData().getMetaData(query);
return metaData.getMetaValue(option.getPermission());
2019-11-24 23:01:05 +01:00
}
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
@Override
public List<String> getOptionValueList(GDPermissionHolder holder, Option option, Set<Context> contexts) {
// If no server context exists, add global
this.checkServerContext(contexts);
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return null;
}
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
// First check user persistent data
QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, USER_PERSISTENT_ONLY).context(set).build();
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
CachedMetaData metaData = permissionHolder.getCachedData().getMetaData(query);
List<String> list = metaData.getMeta().get(option.getPermission());
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
if (list != null) {
return list;
}
// Now check default persistent data
query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, DEFAULT_PERSISTENT_ONLY).context(set).build();
metaData = permissionHolder.getCachedData().getMetaData(query);
list = metaData.getMeta().get(option.getPermission());
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
if (list == null) {
return new ArrayList<>();
}
return list;
}
public CompletableFuture<PermissionResult> setOptionValue(GDPermissionHolder holder, String key, String value, Set<Context> contexts, boolean check) {
if (check) {
// If no server context exists, add global
this.checkServerContext(contexts);
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
holder = GriefDefenderPlugin.GD_OPTION_HOLDER;
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
final Node node = MetaNode.builder().key(key).value(value).context(set).build();
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return this.createOptionFuture(holder, node, key, value, false);
}
public CompletableFuture<PermissionResult> setPermissionValue(GDPermissionHolder holder, String permission, Tristate value, Set<Context> contexts, boolean check, boolean save) {
if (check) {
// If no server context exists, add global
this.checkServerContext(contexts);
}
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
final Node node = this.luckPermsApi.getNodeBuilderRegistry().forPermission().permission(permission).value(value.asBoolean()).context(set).build();
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return this.createPermissionFuture(PermissionUtil.getInstance().getGDPermissionHolder(holder, contexts), Arrays.asList(node), value, false);
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
@Override
public CompletableFuture<PermissionResult> setFlagDefinition(GDPermissionHolder holder, FlagDefinition definition, Tristate value, Set<Context> contexts, boolean isTransient) {
final List<Node> nodes = new ArrayList<>();
for (FlagData flagData : definition.getFlagData()) {
for (Context context : contexts) {
Set<Context> permissionContexts = new HashSet<>(flagData.getContexts());
permissionContexts.add(context);
// If no server context exists, add global
this.checkServerContext(permissionContexts);
ImmutableContextSet set = this.getLPContexts(permissionContexts).immutableCopy();
final Node node = this.luckPermsApi.getNodeBuilderRegistry().forPermission().permission(flagData.getFlag().getPermission()).value(value.asBoolean()).context(set).build();
nodes.add(node);
}
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return this.createPermissionFuture(GriefDefenderPlugin.GD_DEFINITION_HOLDER, nodes, value, isTransient);
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
public CompletableFuture<PermissionResult> setTransientOption(GDPermissionHolder holder, String key, String value, Set<Context> contexts) {
// If no server context exists, add global
this.checkServerContext(contexts);
MutableContextSet contextSet = this.getLPContexts(contexts);
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
holder = GriefDefenderPlugin.GD_OPTION_HOLDER;
}
Node node = null;
if (value == null) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
node = MetaNode.builder().key(key).context(contextSet).build();
} else {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
node = MetaNode.builder().key(key).value(value).context(contextSet).build();
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return this.createOptionFuture(holder, node, key, value, true);
}
public CompletableFuture<PermissionResult> setTransientPermission(GDPermissionHolder holder, String permission, Tristate value, Set<Context> contexts) {
// If no server context exists, add global
this.checkServerContext(contexts);
MutableContextSet contextSet = this.getLPContexts(contexts);
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
holder = GriefDefenderPlugin.GD_OPTION_HOLDER;
}
final Node node = this.luckPermsApi.getNodeBuilderRegistry().forPermission().permission(permission).value(value.asBoolean()).context(contextSet).build();
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return this.createPermissionFuture(PermissionUtil.getInstance().getGDPermissionHolder(holder, contexts), Arrays.asList(node), value, true);
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
private CompletableFuture<PermissionResult> createOptionFuture(GDPermissionHolder holder, Node node, String key, String value, boolean isTransient) {
if (holder instanceof GDPermissionGroup) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return CompletableFuture.supplyAsync(() -> {
Group group = null;
try {
group = this.luckPermsApi.getGroupManager().loadGroup(holder.getFriendlyName()).get().orElse(null);
} catch (Throwable t) {
t.printStackTrace();
}
if (group != null) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (isTransient) {
return this.applyTransientOptionNode(holder, group, node, value);
}
return this.applyOptionNode(holder, group, node, key, value);
}
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append("COULD NOT LOAD GROUP " + holder.getFriendlyName()).build());
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
}, GriefDefenderPlugin.getInstance().executor);
} else {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
return CompletableFuture.supplyAsync(() -> {
User user = null;
try {
user = this.luckPermsApi.getUserManager().loadUser(((GDPermissionUser) holder).getUniqueId()).get();
} catch (Throwable t) {
t.printStackTrace();
}
if (user != null) {
if (isTransient) {
return this.applyTransientOptionNode(holder, user, node, value);
}
return this.applyOptionNode(holder, user, node, key, value);
}
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append("COULD NOT LOAD USER " + holder.getFriendlyName()).build());
}, GriefDefenderPlugin.getInstance().executor);
}
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
private CompletableFuture<PermissionResult> createPermissionFuture(GDPermissionHolder holder, List<Node> nodes, Tristate value, boolean isTransient) {
if (holder instanceof GDPermissionGroup) {
return CompletableFuture.supplyAsync(() -> {
Group group = null;
try {
group = this.luckPermsApi.getGroupManager().loadGroup(holder.getFriendlyName()).get().orElse(null);
} catch (Throwable t) {
t.printStackTrace();
}
if (group != null) {
if (isTransient) {
return this.applyTransientPermissionNodes(holder, group, nodes, value);
}
return this.applyPermissionNodes(holder, group, nodes, value, true);
}
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append("COULD NOT LOAD GROUP " + holder.getFriendlyName()).build());
}, GriefDefenderPlugin.getInstance().executor);
} else {
return CompletableFuture.supplyAsync(() -> {
User user = null;
try {
user = this.luckPermsApi.getUserManager().loadUser(((GDPermissionUser) holder).getUniqueId()).get();
} catch (Throwable t) {
t.printStackTrace();
}
if (user != null) {
if (isTransient) {
return this.applyTransientPermissionNodes(holder, user, nodes, value);
}
return this.applyPermissionNodes(holder, user, nodes, value, true);
}
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append("COULD NOT LOAD USER " + holder.getFriendlyName()).build());
}, GriefDefenderPlugin.getInstance().executor);
}
}
public PermissionResult applyOptionNode(GDPermissionHolder holder, PermissionHolder lpHolder, Node node, String key, String value) {
final Option option = OptionRegistryModule.getInstance().getById(key).orElse(null);
if (option == null) {
new GDPermissionResult(ResultTypes.FAILURE);
}
DataMutateResult result = null;
2019-11-24 23:01:05 +01:00
if (!value.equalsIgnoreCase("undefined")) {
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
if (!option.multiValued()) {
this.clearMeta(lpHolder, option.getPermission(), node.getContexts());
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
}
result = lpHolder.data().add(node);
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
} else {
this.clearMeta(lpHolder, option.getPermission(), node.getContexts());
this.savePermissionHolder(lpHolder);
return new GDPermissionResult(ResultTypes.SUCCESS);
2019-11-24 23:01:05 +01:00
}
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
if (result != null) {
if (result.wasSuccessful()) {
this.savePermissionHolder(lpHolder);
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
return new GDPermissionResult(ResultTypes.SUCCESS, TextComponent.builder().append(result.name()).build());
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append(result.name()).build());
2019-11-24 23:01:05 +01:00
}
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
return new GDPermissionResult(ResultTypes.FAILURE);
2019-11-24 23:01:05 +01:00
}
public PermissionResult applyTransientOptionNode(GDPermissionHolder holder, PermissionHolder lpHolder, Node node, String value) {
2019-11-24 23:01:05 +01:00
DataMutateResult result = null;
if (value == null) {
result = lpHolder.transientData().remove(node);
} else {
result = lpHolder.transientData().add(node);
}
if (result != null) {
if (result.wasSuccessful()) {
return new GDPermissionResult(ResultTypes.SUCCESS, TextComponent.builder().append(result.name()).build());
}
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append(result.name()).build());
2019-11-24 23:01:05 +01:00
}
return new GDPermissionResult(ResultTypes.FAILURE);
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
public PermissionResult applyPermissionNodes(GDPermissionHolder holder, PermissionHolder lpHolder, List<Node> nodes, Tristate value, boolean save) {
DataMutateResult result = null;
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
for (Node node : nodes) {
if (value == Tristate.UNDEFINED) {
result = lpHolder.data().remove(node);
2019-11-24 23:01:05 +01:00
} else {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
result = lpHolder.data().add(node);
2019-11-24 23:01:05 +01:00
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
}
2019-11-24 23:01:05 +01:00
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (result.wasSuccessful()) {
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
if (save) {
this.savePermissionHolder(lpHolder);
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
}
return new GDPermissionResult(ResultTypes.SUCCESS, TextComponent.builder().append(result.name()).build());
2019-11-24 23:01:05 +01:00
}
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append(result.name()).build());
2019-11-24 23:01:05 +01:00
}
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
public PermissionResult applyTransientPermissionNodes(GDPermissionHolder holder, PermissionHolder lpHolder, List<Node> nodes, Tristate value) {
DataMutateResult result = null;
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
for (Node node : nodes) {
if (value == null || value == Tristate.UNDEFINED) {
result = lpHolder.transientData().remove(node);
} else {
result = lpHolder.transientData().add(node);
}
}
if (result.wasSuccessful()) {
return new GDPermissionResult(ResultTypes.SUCCESS, TextComponent.builder().append(result.name()).build());
}
return new GDPermissionResult(ResultTypes.FAILURE, TextComponent.builder().append(result.name()).build());
2019-11-24 23:01:05 +01:00
}
public void savePermissionHolder(PermissionHolder holder) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
// Always wait for completion to avoid save race conditions
2019-11-24 23:01:05 +01:00
if (holder instanceof User) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
try {
this.luckPermsApi.getUserManager().saveUser((User) holder).get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
2019-11-24 23:01:05 +01:00
} else {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
try {
this.luckPermsApi.getGroupManager().saveGroup((Group) holder).get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
2019-11-24 23:01:05 +01:00
}
}
public void refreshCachedData(GDPermissionHolder holder) {
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return;
}
2019-12-28 18:23:50 +01:00
permissionHolder.getCachedData().invalidate();
2019-11-24 23:01:05 +01:00
}
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
@Override
public CompletableFuture<Void> save(GDPermissionHolder holder) {
final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder);
if (permissionHolder == null) {
return new CompletableFuture<>();
}
if (permissionHolder instanceof User) {
return this.luckPermsApi.getUserManager().saveUser((User) permissionHolder);
} else {
return this.luckPermsApi.getGroupManager().saveGroup((Group) permissionHolder);
}
}
2019-12-28 18:23:50 +01:00
public Set<Context> getGDContexts(ContextSet contexts) {
2019-11-24 23:01:05 +01:00
final Set<Context> gdContexts = new HashSet<>();
2019-12-28 18:23:50 +01:00
contexts.forEach(entry -> {
2019-11-24 23:01:05 +01:00
gdContexts.add(new Context(entry.getKey(), entry.getValue()));
});
return gdContexts;
}
2019-12-28 18:23:50 +01:00
public MutableContextSet getLPContexts(Set<Context> contexts) {
MutableContextSet lpContexts = MutableContextSet.create();
contexts.forEach(entry -> {
lpContexts.add(entry.getKey(), entry.getValue());
});
return lpContexts;
}
public Tristate getGDTristate(net.luckperms.api.util.Tristate state) {
if (state == net.luckperms.api.util.Tristate.TRUE) {
2019-11-24 23:01:05 +01:00
return Tristate.TRUE;
}
2019-12-28 18:23:50 +01:00
if (state == net.luckperms.api.util.Tristate.FALSE) {
2019-11-24 23:01:05 +01:00
return Tristate.FALSE;
}
return Tristate.UNDEFINED;
}
2019-12-28 18:23:50 +01:00
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
private void clearMeta(PermissionHolder holder, String metaKey, ContextSet set) {
if (set.size() == 1 && set.containsKey("server")) {
if (set.getAnyValue("server").get().equalsIgnoreCase("global")) {
// LP does not remove meta if passing only global context so we need to make sure to pass none
holder.data().clear(NodeType.META.predicate(node -> node.getMetaKey().equals(metaKey)));
return;
}
}
Finish implementing options for next major release. * Fixed '/cfg' and '/cog' commands. * Fixed 'create-mode' not working as intended. * Fixed 'any' usage with flag commands. * Fixed 'command-execute' usage. * Fixed 'command-execute-pvp' usage. * Fixed option removal/save with LP v5. * Added context support for controlling user flag command usage. * Added context support to option GUI. * Added permission 'griefdefender.user.claim.command.flag.arg' which controls if a user can use flag command with arguments. * Added permission 'griefdefender.user.claim.command.flag.gui' which controls if a user can use flag GUI. * Added new group context '#all' which can be used to represent all sources or targets. * Removed 'max-claim-inspection-distance' from config as it is now controlled by 'radius-inspect' option. * Removed 'combat-timeout' from config as it is now controlled by 'pvp-combat-timeout' option. * Implemented the folloing new options 'player-command-enter' - Handles executing commands when a player enters a claim. 'player-command-exit' - Handles executing commands when a player exits a claim. Note: both command options support the following placeholders : %player%, %owner%, %uuid%, %world%, %server%, %location% 'player-gamemode' - Used to determine the gamemode of a player when entering a claim. 'player-deny-godmode' - Used to determine if a player can be in godmode when entering a claim. 'player-walk-speed' - Controls the player walk speed when entering a claim. 'player-weather' - Controls player local weather when entering a claim. 'pvp-combat-command' - Used to determine if a player can use commands during PvP combat. 'pvp-combat-teleport' - Used to determine if a player can teleport during PvP combat. 'pvp-combat-timeout' - Used to determine how many seconds PvP combat is considered to continue after the most recent damage. 'radius-inspect' - Controls the radius in blocks to search within when inspecting for claims. 'spawn-limit' - Used to control the spawn limit for a specific set of entities in a claim. * Only save once when toggling flag definitions that include multiple definitions.
2019-12-31 00:25:55 +01:00
holder.data().clear(set, NodeType.META.predicate(node -> node.getMetaKey().equals(metaKey)));
}
private void checkServerContext(Set<Context> contexts) {
for (Context context : contexts) {
if (context.getKey().equalsIgnoreCase("server")) {
return;
}
}
final String serverName = this.luckPermsApi.getServerName();
if (serverName != null) {
contexts.add(new Context("server", serverName));
} else {
contexts.add(new Context("server", "global"));
}
}
2019-12-28 18:23:50 +01:00
private static class DefaultDataQueryOrderFunction implements DataQueryOrderFunction {
@Override
public Comparator<DataType> getOrderComparator(Identifier identifier) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (identifier.getType() == Identifier.GROUP_TYPE && (identifier.getName().equalsIgnoreCase(GriefDefenderPlugin.DEFAULT_GROUP_NAME) || identifier.getName().startsWith("griefdefender_"))) {
2019-12-28 18:23:50 +01:00
return DataQueryOrder.TRANSIENT_LAST;
}
return DataQueryOrder.TRANSIENT_FIRST;
}
}
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 class DefaultTransientOnlyDataFilter implements DataTypeFilterFunction {
@Override
public @NonNull Predicate<DataType> getTypeFilter(@NonNull Identifier identifier) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (identifier.getType() == Identifier.GROUP_TYPE && (identifier.getName().equalsIgnoreCase(GriefDefenderPlugin.DEFAULT_GROUP_NAME) || identifier.getName().startsWith("griefdefender_"))) {
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
return DataTypeFilter.TRANSIENT_ONLY;
}
return DataTypeFilter.ALL;
}
}
private static class DefaultPersistentOnlyDataFilter implements DataTypeFilterFunction {
@Override
public @NonNull Predicate<DataType> getTypeFilter(@NonNull Identifier identifier) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (identifier.getType() == Identifier.GROUP_TYPE && (identifier.getName().equalsIgnoreCase(GriefDefenderPlugin.DEFAULT_GROUP_NAME) || identifier.getName().startsWith("griefdefender_"))) {
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
return DataTypeFilter.NORMAL_ONLY;
}
return DataTypeFilter.ALL;
}
}
private static class UserPersistentOnlyDataFilter implements DataTypeFilterFunction {
@Override
public @NonNull Predicate<DataType> getTypeFilter(@NonNull Identifier identifier) {
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
if (identifier.getType() == Identifier.GROUP_TYPE && (identifier.getName().equalsIgnoreCase(GriefDefenderPlugin.DEFAULT_GROUP_NAME) || identifier.getName().startsWith("griefdefender_"))) {
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
return DataTypeFilter.NONE;
}
return DataTypeFilter.NORMAL_ONLY;
}
}
2019-11-24 23:01:05 +01:00
}