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

419 lines
15 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 java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
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 org.checkerframework.checker.nullness.qual.Nullable;
import com.griefdefender.GDPlayerData;
import com.griefdefender.api.Tristate;
import com.griefdefender.api.claim.Claim;
import com.griefdefender.api.permission.Context;
import com.griefdefender.api.permission.PermissionResult;
import com.griefdefender.api.permission.flag.Flag;
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.FlagDefinition;
2019-11-24 23:01:05 +01:00
import com.griefdefender.api.permission.option.Option;
import com.griefdefender.claim.GDClaim;
import com.griefdefender.permission.GDPermissionHolder;
/**
* Represents a provider of permission data.
*
* <p>This is the interface that a permissions plugin must implement and
* to provide permissions lookups for GriefDefender.</p>
*/
public interface PermissionProvider {
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 enum PermissionDataType {
ALL,
TRANSIENT,
PERSISTENT,
USER_PERSISTENT
}
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
/**
* Get server name.
*
* @return The server name
*/
String getServerName();
2019-11-24 23:01:05 +01:00
/**
* Checks if the group identifier exists.
*
* @param identifier The group identifier
* @return whether the group exists
*/
boolean hasGroupSubject(String 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
/**
* Creates the default group used by GriefDefender.
*
* @param identifier
* @return whether the group was created
*/
boolean createDefaultGroup(String identifier);
2019-11-24 23:01:05 +01:00
/**
* Performs a lookup for a UUID with matching
* username.
*
* @param name The username to search with
* @return The user uuid if available
*/
@Nullable UUID lookupUserUniqueId(String name);
/**
* Retrieves an immutable list of all loaded player
* names that exist in permissions.
*
* @return An immutable list of player names or empty if none.
*/
List<String> getAllLoadedPlayerNames();
/**
* Retrieves an immutable list of all loaded group
* names that exist in permissions.
*
* @return An immutable list of group names or empty if none.
*/
List<String> getAllLoadedGroupNames();
/**
* Appends all active contexts to passed context set currently
* active on permission holder.
*
* @param contexts The set to append to
* @param permissionHolder The holder to check active contexts
*/
void addActiveContexts(Set<Context> contexts, GDPermissionHolder permissionHolder);
/**
* Appends all active contexts to passed context set currently
* active on permission holder.
*
* @param contexts The set to append to
* @param permissionHolder The holder to check active contexts
* @param playerData The player data
* @param claim The claim
*/
void addActiveContexts(Set<Context> contexts, GDPermissionHolder permissionHolder, GDPlayerData playerData, Claim claim);
/**
* Clears all permissions that contain {@link Claim#getContext()}
* from passed {@link Claim}.
*
* @param claim The claim
*/
void clearPermissions(GDClaim claim);
/**
* Clears all permissions that contain {@link Context}
* from passed holder.
*
* @param claim The claim
*/
void clearPermissions(GDPermissionHolder holder, Context context);
/**
* Clears all permissions that contain {@link Context}'s
* from passed player.
*
* @param claim The claim
*/
void clearPermissions(GDPermissionHolder holder, Set<Context> contexts);
/**
* Checks if holder has permission.
*
* @param permission The permission
* @return whether the holder has permission
*/
boolean holderHasPermission(GDPermissionHolder holder, String permission);
/**
* Gets all cached permissions of holder that contain specific {@link Context}'s.
*
* @param holder The holder
* @param contexts The contexts required
* @return An immutable map of cached permissions or empty if none.
*/
Map<String, Boolean> getPermissions(GDPermissionHolder holder, Set<Context> contexts);
/**
* Gets all cached options of holder that contain specific {@link Context}'s.
*
* @param holder The holder
* @param contexts The contexts required
* @return An immutable map of cached options or empty if none.
*/
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>> getOptions(GDPermissionHolder holder, Set<Context> contexts);
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
/**
* Gets all persisted permissions.
*
* @return An immutable map of persisted permissions or empty if none.
*/
Map<Set<Context>, Map<String, Boolean>> getAllPermanentPermissions();
2019-11-24 23:01:05 +01:00
/**
* Gets all persisted permissions with associated contexts of holder.
*
* @param holder The holder
* @return An immutable map of persisted permissions or empty if none.
*/
Map<Set<Context>, Map<String, Boolean>> getPermanentPermissions(GDPermissionHolder holder);
/**
* Gets all transient permissions with associated contexts of holder.
*
* @param holder The holder
* @return An immutable map of transient permissions or empty if none.
*/
Map<Set<Context>, Map<String, Boolean>> getTransientPermissions(GDPermissionHolder holder);
/**
* Gets all persisted options with associated contexts of holder.
*
* @param holder The holder
* @return An immutable map of persisted options or empty if none.
*/
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>>> getPermanentOptions(GDPermissionHolder holder);
2019-11-24 23:01:05 +01:00
/**
* Gets all transient options with associated contexts of holder.
*
* @param holder The holder
* @return An immutable map of transient options or empty if none.
*/
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>>> getTransientOptions(GDPermissionHolder holder);
2019-11-24 23:01:05 +01:00
/**
* Gets all persisted permissions, including inherited nodes, with associated contexts of holder.
*
* @param holder The holder
* @return An immutable map of persisted permissions or empty if none.
*/
Map<Set<Context>, Map<String, Boolean>> getAllPermissions(GDPermissionHolder holder);
/**
* Gets the current value of a permission assigned to a holder.
*
* @param holder The holder
* @param permission The permission to check
* @return The permission value
*/
Tristate getPermissionValue(GDPermissionHolder holder, String permission);
/**
* Gets the current value of a permission assigned to a holder.
*
* @param claim The current claim
* @param holder The holder
* @param permission The permission to check
* @param contexts The contexts
* @return The permission value
*/
Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts);
/**
* Gets the current value of a permission assigned to a holder.
*
* @param claim The current claim
* @param holder The holder
* @param permission The permission to check
* @param contexts The 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
* @param type The data type
2019-11-24 23:01:05 +01:00
* @return The permission value
*/
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
Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts, PermissionDataType type);
2019-11-24 23:01:05 +01:00
/**
* Gets the current value of a permission assigned to a holder.
*
* @param holder The holder
* @param permission The permission to check
* @param contexts The contexts
* @return The permission value
*/
Tristate getPermissionValue(GDPermissionHolder holder, String permission, Set<Context> contexts);
/**
* Gets the current value of an option assigned to a holder.
*
* @param holder The holder
* @param permission The permission to check
* @param contexts The contexts
* @return The option value
*/
String getOptionValue(GDPermissionHolder holder, Option option, Set<Context> 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
/**
* Gets the current values of an option assigned to a holder.
*
* Note: This is intended to be used for options that support multiple values.
*
* @param holder The holder
* @param permission The permission to check
* @param contexts The contexts
* @return The option value list
*/
List<String> getOptionValueList(GDPermissionHolder holder, Option option, 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
/**
* Sets a flag definition with contexts to a holder.
*
* @param holder The holder
* @param definition The flag definition
* @param value The value
* @param contexts The contexts
* @param isTransient Whether the definition should be applied as transient
* @return Whether the set flag definition operation was successful
*/
CompletableFuture<PermissionResult> setFlagDefinition(GDPermissionHolder holder, FlagDefinition definition, Tristate value, Set<Context> contexts, boolean isTransient);
2019-11-24 23:01:05 +01:00
/**
* Sets an option and value with contexts to a holder.
*
* @param holder The holder
* @param permission The permission
* @param value The value
* @param contexts The contexts
* @param check Whether to check and apply a server context if none exists
2019-11-24 23:01:05 +01:00
* @return The permission result
*/
default CompletableFuture<PermissionResult> setOptionValue(GDPermissionHolder holder, String permission, String value, Set<Context> contexts) {
return this.setOptionValue(holder, permission, value, contexts, true);
}
/**
* Sets an option and value with contexts to a holder.
*
* @param holder The holder
* @param permission The permission
* @param value The value
* @param contexts The contexts
* @param check Whether to check and apply a server context if none exists
* @return The permission result
*/
CompletableFuture<PermissionResult> setOptionValue(GDPermissionHolder holder, String permission, String value, Set<Context> contexts, boolean check);
2019-11-24 23:01:05 +01:00
/**
* Sets a permission and value with contexts to a holder.
*
* @param holder The holder
* @param flag The flag to use for permission
* @param value The value
* @param contexts The contexts
* @return The permission result
*/
default CompletableFuture<PermissionResult> setPermissionValue(GDPermissionHolder holder, Flag flag, Tristate value, Set<Context> contexts) {
return this.setPermissionValue(holder, flag.getPermission(), value, contexts, true, true);
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
}
/**
* Sets a permission and value with contexts to a holder.
*
* @param holder The holder
* @param flag The flag to use for permission
* @param value The value
* @param contexts The contexts
* @param check Whether to check and apply a server context if none exists
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
* @param save Whether a save should occur
* @return The permission result
*/
default CompletableFuture<PermissionResult> setPermissionValue(GDPermissionHolder holder, Flag flag, Tristate value, Set<Context> contexts, boolean check, boolean save) {
return this.setPermissionValue(holder, flag.getPermission(), value, contexts, check, save);
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
}
/**
* Sets a permission and value with contexts to a holder.
*
* @param holder The holder
* @param permission The permission
* @param value The value
* @param contexts The contexts
* @return Whether the set permission operation was successful
*/
default CompletableFuture<PermissionResult> setPermissionValue(GDPermissionHolder holder, String permission, Tristate value, Set<Context> contexts) {
return this.setPermissionValue(holder, permission, value, contexts, true, true);
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
}
2019-11-24 23:01:05 +01:00
/**
* Sets a permission and value with contexts to a holder.
*
* @param holder The holder
* @param permission The permission
* @param value The value
* @param contexts The contexts
* @param check Whether to check and apply a server context if none exists
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
* @param save Whether a save should occur
2019-11-24 23:01:05 +01:00
* @return Whether the set permission operation was successful
*/
CompletableFuture<PermissionResult> setPermissionValue(GDPermissionHolder holder, String permission, Tristate value, Set<Context> contexts, boolean check, boolean save);
2019-11-24 23:01:05 +01:00
/**
* Sets a transient option and value with contexts to a holder.
*
* @param holder The holder
* @param permission The permission
* @param value The value
* @param contexts The contexts
* @return Whether the set permission operation was successful
*/
CompletableFuture<PermissionResult> setTransientOption(GDPermissionHolder holder, String permission, String value, Set<Context> contexts);
2019-11-24 23:01:05 +01:00
/**
* Sets a transient permission and value with contexts to a holder.
*
* @param holder The holder
* @param permission The permission
* @param value The value
* @param contexts The contexts
* @return Whether the set permission operation was successful
*/
CompletableFuture<PermissionResult> setTransientPermission(GDPermissionHolder holder, String permission, Tristate value, Set<Context> contexts);
2019-11-24 23:01:05 +01:00
/**
* Refreshes all cached permission data of holder.
*
* @param holder The holder
*/
void refreshCachedData(GDPermissionHolder 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
/**
* Saves any pending permission changes to holder.
*
* @param holder The holder
* @return a future which will complete when save is done
*/
CompletableFuture<Void> save(GDPermissionHolder holder);
2019-11-24 23:01:05 +01:00
}