Java Code Examples for org.spongepowered.api.util.Tristate#TRUE

The following examples show how to use org.spongepowered.api.util.Tristate#TRUE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandHelper.java    From GriefPrevention with MIT License 6 votes vote down vote up
public static Consumer<CommandSource> createFlagConsumer(CommandSource src, Subject subject, String subjectName, Set<Context> contexts, GPClaim claim, String flagPermission, Tristate flagValue, String source) {
    return consumer -> {
        String target = flagPermission.replace(GPPermissions.FLAG_BASE + ".", "");
        if (target.isEmpty()) {
            target = "any";
        }
        Tristate newValue = Tristate.UNDEFINED;
        if (flagValue == Tristate.TRUE) {
            newValue = Tristate.FALSE;
        } else if (flagValue == Tristate.UNDEFINED) {
            newValue = Tristate.TRUE;
        }

        CommandHelper.applyFlagPermission(src, subject, subjectName, claim, flagPermission, source, target, newValue, null, FlagType.GROUP);
    };
}
 
Example 2
Source File: VirtualChestActionDispatcher.java    From VirtualChest with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static List<String> parseCommand(String commandSequence)
{
    StringBuilder stringBuilder = new StringBuilder();
    List<String> commands = new LinkedList<>();
    Tristate isCommandFinished = Tristate.TRUE;
    for (char c : commandSequence.toCharArray())
    {
        if (c != SEQUENCE_SPLITTER)
        {
            if (isCommandFinished == Tristate.UNDEFINED)
            {
                commands.add(stringBuilder.toString());
                stringBuilder.setLength(0);
            }
            if (isCommandFinished != Tristate.FALSE && Character.isWhitespace(c))
            {
                isCommandFinished = Tristate.TRUE;
                continue;
            }
        }
        else if (isCommandFinished != Tristate.UNDEFINED)
        {
            isCommandFinished = Tristate.UNDEFINED;
            continue;
        }
        isCommandFinished = Tristate.FALSE;
        stringBuilder.append(c);
    }
    commands.add(stringBuilder.toString());
    return commands;
}
 
Example 3
Source File: FallbackPermActions.java    From ChatUI with MIT License 5 votes vote down vote up
@Override
public CompletableFuture<Boolean> setPermission(Player player, Subject subject, Set<Context> contexts, String permission, Tristate value) {
    Boolean perm = subject.getSubjectData().getPermissions(contexts).get(permission);
    if ((perm == null && value == Tristate.UNDEFINED)
            || (perm == Boolean.TRUE && value == Tristate.TRUE)
            || (perm == Boolean.FALSE && value == Tristate.FALSE)) {
        return CompletableFuture.completedFuture(true);
    }
    return subject.getSubjectData().setPermission(contexts, permission, value);
}
 
Example 4
Source File: EntityEventHandler.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onProjectileImpactEntity(CollideEntityEvent.Impact event) {
    if (!GPFlags.PROJECTILE_IMPACT_ENTITY) {
        return;
    }
    if (GriefPreventionPlugin.isSourceIdBlacklisted(ClaimFlag.PROJECTILE_IMPACT_ENTITY.toString(), event.getSource(), event.getImpactPoint().getExtent().getProperties())) {
        return;
    }

    final User user = CauseContextHelper.getEventUser(event);
    if (user == null || !GriefPreventionPlugin.instance.claimsEnabledForWorld(event.getImpactPoint().getExtent().getProperties())) {
        return;
    }

    GPTimings.PROJECTILE_IMPACT_ENTITY_EVENT.startTimingIfSync();
    Object source = event.getCause().root();
    Location<World> impactPoint = event.getImpactPoint();
    GPClaim targetClaim = null;
    for (Entity entity : event.getEntities()) {
        if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.PROJECTILE_IMPACT_ENTITY.toString(), entity, event.getImpactPoint().getExtent().getProperties())) {
            return;
        }
        targetClaim = this.dataStore.getClaimAt(impactPoint, targetClaim);
        final Tristate result = GPPermissionHandler.getClaimPermission(event, impactPoint, targetClaim, GPPermissions.PROJECTILE_IMPACT_ENTITY, source, entity, user, TrustType.ACCESSOR, true);
        if (result == Tristate.FALSE) {
            if (GPPermissionHandler.getClaimPermission(event, impactPoint, targetClaim, GPPermissions.PROJECTILE_IMPACT_ENTITY, source, entity, user) == Tristate.TRUE) {
                GPTimings.PROJECTILE_IMPACT_ENTITY_EVENT.stopTimingIfSync();
                return;
            }

            event.setCancelled(true);
        }
    }
    GPTimings.PROJECTILE_IMPACT_ENTITY_EVENT.stopTimingIfSync();
}
 
Example 5
Source File: PlayerEventHandler.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onPlayerInteractEntity(InteractEntityEvent.Primary event, @First Player player) {
    if (!GPFlags.INTERACT_ENTITY_PRIMARY || !GriefPreventionPlugin.instance.claimsEnabledForWorld(player.getWorld().getProperties())) {
        return;
    }

    final Entity targetEntity = event.getTargetEntity();
    final HandType handType = event.getHandType();
    final ItemStack itemInHand = player.getItemInHand(handType).orElse(ItemStack.empty());
    final Object source = !itemInHand.isEmpty() ? itemInHand : player;
    if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.INTERACT_ENTITY_PRIMARY.toString(), targetEntity, player.getWorld().getProperties())) {
        return;
    }

    GPTimings.PLAYER_INTERACT_ENTITY_PRIMARY_EVENT.startTimingIfSync();
    Location<World> location = targetEntity.getLocation();
    GPClaim claim = this.dataStore.getClaimAt(location);
    if (event.isCancelled() && claim.getData().getPvpOverride() == Tristate.TRUE && targetEntity instanceof Player) {
        event.setCancelled(false);
    }

    Tristate result = GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.INTERACT_ENTITY_PRIMARY, source, targetEntity, player, TrustType.ACCESSOR, true);
    if (result == Tristate.FALSE) {
        final Text message = GriefPreventionPlugin.instance.messageData.claimProtectedEntity
                .apply(ImmutableMap.of(
                "owner", claim.getOwnerName())).build();
        GriefPreventionPlugin.sendMessage(player, message);
        event.setCancelled(true);
        this.sendInteractEntityDenyMessage(itemInHand, targetEntity, claim, player, handType);
        GPTimings.PLAYER_INTERACT_ENTITY_PRIMARY_EVENT.stopTimingIfSync();
        return;
    }
}
 
Example 6
Source File: CommandHelper.java    From GriefPrevention with MIT License 5 votes vote down vote up
public static Consumer<CommandSource> createFlagConsumer(CommandSource src, Subject subject, String subjectName, Set<Context> contexts, String flagPermission, Tristate flagValue, FlagType flagType) {
    return consumer -> {
        Tristate newValue = Tristate.UNDEFINED;
        if (flagValue == Tristate.TRUE) {
            newValue = Tristate.FALSE;
        } else if (flagValue == Tristate.UNDEFINED) {
            newValue = Tristate.TRUE;
        }

        Text flagTypeText = Text.of();
        if (flagType == FlagType.OVERRIDE) {
            flagTypeText = Text.of(TextColors.RED, "OVERRIDE");
        } else if (flagType == FlagType.DEFAULT) {
            flagTypeText = Text.of(TextColors.LIGHT_PURPLE, "DEFAULT");
        } else if (flagType == FlagType.CLAIM) {
            flagTypeText = Text.of(TextColors.GOLD, "CLAIM");
        }
        String target = flagPermission.replace(GPPermissions.FLAG_BASE + ".",  "");
        Set<Context> newContexts = new HashSet<>(contexts);
        subject.getSubjectData().setPermission(newContexts, flagPermission, newValue);
        src.sendMessage(Text.of(
                TextColors.GREEN, "Set ", flagTypeText, " permission ", 
                TextColors.AQUA, target, 
                TextColors.GREEN, "\n to ", 
                TextColors.LIGHT_PURPLE, getClickableText(src, subject, subjectName, newContexts, flagPermission, newValue, flagType), 
                TextColors.GREEN, " for ", 
                TextColors.GOLD, subjectName));
    };
}
 
Example 7
Source File: ChatLoggerListener.java    From FlexibleLogin with MIT License 5 votes vote down vote up
@Listener(order = Order.POST)
@IsCancelled(Tristate.TRUE)
public void onPostCommand(SendCommandEvent commandEvent) {
    String command = commandEvent.getCommand();
    if (isOurCommand(command)) {
        //re-enable it
        commandEvent.getContext();
        commandEvent.setCancelled(false);
    }
}
 
Example 8
Source File: PEXActions.java    From ChatUI with MIT License 4 votes vote down vote up
private static int asInt(Tristate tristate) {
    return tristate == Tristate.TRUE ? 1 : tristate == Tristate.FALSE ? -1 : 0;
}
 
Example 9
Source File: CommandSource.java    From Web-API with MIT License 4 votes vote down vote up
@Override
public Tristate getPermissionValue(Set<Context> contexts, String permission) {
    return Tristate.TRUE;
}
 
Example 10
Source File: PlayerEventHandler.java    From GriefPrevention with MIT License 4 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onPlayerDispenseItem(DropItemEvent.Dispense event, @Root Entity spawncause) {
    if (!GPFlags.ITEM_DROP || !(spawncause instanceof User)) {
        return;
    }

    final User user = (User) spawncause;
    final World world = spawncause.getWorld();
    if (!GriefPreventionPlugin.instance.claimsEnabledForWorld(world.getProperties())) {
        return;
    }

    // in creative worlds, dropping items is blocked
    if (GriefPreventionPlugin.instance.claimModeIsActive(world.getProperties(), ClaimsMode.Creative)) {
        event.setCancelled(true);
        return;
    }

    GPTimings.PLAYER_DISPENSE_ITEM_EVENT.startTimingIfSync();
    Player player = user instanceof Player ? (Player) user : null;
    GPPlayerData playerData = this.dataStore.getOrCreatePlayerData(world, user.getUniqueId());

    // FEATURE: players in PvP combat, can't throw items on the ground to hide
    // them or give them away to other players before they are defeated

    // if in combat, don't let him drop it
    if (player != null && !GriefPreventionPlugin.getActiveConfig(world.getProperties()).getConfig().pvp.allowCombatItemDrops && playerData.inPvpCombat(player.getWorld())) {
        GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.pvpNoItemDrop.toText());
        event.setCancelled(true);
        GPTimings.PLAYER_DISPENSE_ITEM_EVENT.stopTimingIfSync();
        return;
    }

    for (Entity entityItem : event.getEntities()) {
        if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.ITEM_DROP.toString(), entityItem, world.getProperties())) {
            continue;
        }

        Location<World> location = entityItem.getLocation();
        GPClaim claim = this.dataStore.getClaimAtPlayer(playerData, location);
        if (claim != null) {
            final Tristate override = GPPermissionHandler.getFlagOverride(event, location, claim, GPPermissions.ITEM_DROP,  user, entityItem, user, playerData, true);
            if (override != Tristate.UNDEFINED) {
                if (override == Tristate.TRUE) {
                    GPTimings.PLAYER_DISPENSE_ITEM_EVENT.stopTimingIfSync();
                    return;
                }

                event.setCancelled(true);
                GPTimings.PLAYER_DISPENSE_ITEM_EVENT.stopTimingIfSync();
                return;
            }

            // allow trusted users
            if (claim.isUserTrusted(user, TrustType.ACCESSOR)) {
                GPTimings.PLAYER_DISPENSE_ITEM_EVENT.stopTimingIfSync();
                return;
            }

            Tristate perm = GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.ITEM_DROP, user, entityItem, user);
            if (perm == Tristate.TRUE) {
                GPTimings.PLAYER_DISPENSE_ITEM_EVENT.stopTimingIfSync();
                return;
            } else if (perm == Tristate.FALSE) {
                event.setCancelled(true);
                if (spawncause instanceof Player) {
                    final Text message = GriefPreventionPlugin.instance.messageData.permissionItemDrop
                            .apply(ImmutableMap.of(
                            "owner", claim.getOwnerName(),
                            "item", entityItem.getType().getId())).build();
                    GriefPreventionPlugin.sendClaimDenyMessage(claim, player, message);
                }
                GPTimings.PLAYER_DISPENSE_ITEM_EVENT.stopTimingIfSync();
                return;
            }
        }
    }
    GPTimings.PLAYER_DISPENSE_ITEM_EVENT.stopTimingIfSync();
}
 
Example 11
Source File: PlayerEventHandler.java    From GriefPrevention with MIT License 4 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onPlayerInteractEntity(InteractEntityEvent.Secondary event, @First Player player) {
    if (!GPFlags.INTERACT_ENTITY_SECONDARY || !GriefPreventionPlugin.instance.claimsEnabledForWorld(player.getWorld().getProperties())) {
        return;
    }

    final Entity targetEntity = event.getTargetEntity();
    final HandType handType = event.getHandType();
    final ItemStack itemInHand = player.getItemInHand(handType).orElse(ItemStack.empty());
    final Object source = !itemInHand.isEmpty() ? itemInHand : player;
    if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.INTERACT_ENTITY_SECONDARY.toString(), targetEntity, player.getWorld().getProperties())) {
        return;
    }

    GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.startTimingIfSync();
    Location<World> location = targetEntity.getLocation();
    GPClaim claim = this.dataStore.getClaimAt(location);
    GPPlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());

    // if entity is living and has an owner, apply special rules
    if (targetEntity instanceof Living) {
        EntityBridge spongeEntity = (EntityBridge) targetEntity;
        Optional<User> owner = ((OwnershipTrackedBridge) spongeEntity).tracked$getOwnerReference();
        if (owner.isPresent()) {
            UUID ownerID = owner.get().getUniqueId();
            // if the player interacting is the owner or an admin in ignore claims mode, always allow
            if (player.getUniqueId().equals(ownerID) || playerData.canIgnoreClaim(claim)) {
                // if giving away pet, do that instead
                if (playerData.petGiveawayRecipient != null) {
                    SpongeEntityType spongeEntityType = (SpongeEntityType) ((Entity) spongeEntity).getType();
                    if (spongeEntityType.equals(EntityTypes.UNKNOWN) || !spongeEntityType.getModId().equalsIgnoreCase("minecraft")) {
                        final Text message = GriefPreventionPlugin.instance.messageData.commandPetInvalid
                                .apply(ImmutableMap.of(
                                "type", spongeEntityType.getId())).build();
                        GriefPreventionPlugin.sendMessage(player, message);
                        playerData.petGiveawayRecipient = null;
                        GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
                        return;
                    }
                    ((Entity) spongeEntity).setCreator(playerData.petGiveawayRecipient.getUniqueId());
                    if (targetEntity instanceof EntityTameable) {
                        EntityTameable tameable = (EntityTameable) targetEntity;
                        tameable.setOwnerId(playerData.petGiveawayRecipient.getUniqueId());
                    } else if (targetEntity instanceof EntityHorse) {
                        EntityHorse horse = (EntityHorse) targetEntity;
                        horse.setOwnerUniqueId(playerData.petGiveawayRecipient.getUniqueId());
                        horse.setHorseTamed(true);
                    }
                    playerData.petGiveawayRecipient = null;
                    GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.commandPetConfirmation.toText());
                    event.setCancelled(true);
                    this.sendInteractEntityDenyMessage(itemInHand, targetEntity, claim, player, handType);
                }
                GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
                return;
            }
        }
    }

    if (playerData.canIgnoreClaim(claim)) {
        GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
        return;
    }

    Tristate result = GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.INTERACT_ENTITY_SECONDARY, source, targetEntity, player, TrustType.ACCESSOR, true);
    if (result == Tristate.TRUE && targetEntity instanceof ArmorStand) {
        result = GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.INVENTORY_OPEN, source, targetEntity, player, TrustType.CONTAINER, false);
    }
    if (result == Tristate.FALSE) {
        event.setCancelled(true);
        this.sendInteractEntityDenyMessage(itemInHand, targetEntity, claim, player, handType);
        GPTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTimingIfSync();
    }
}
 
Example 12
Source File: PlayerEventHandler.java    From GriefPrevention with MIT License 4 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onPlayerInteractBlockPrimary(InteractBlockEvent.Primary.MainHand event, @First Player player) {
    final BlockSnapshot clickedBlock = event.getTargetBlock();
    final HandType handType = event.getHandType();
    final ItemStack itemInHand = player.getItemInHand(handType).orElse(ItemStack.empty());
    // Run our item hook since Sponge no longer fires InteractItemEvent when targetting a non-air block
    if (clickedBlock != BlockSnapshot.NONE && handleItemInteract(event, player, player.getWorld(), itemInHand).isCancelled()) {
        return;
    }

    if (!GPFlags.INTERACT_BLOCK_PRIMARY || !GriefPreventionPlugin.instance.claimsEnabledForWorld(player.getWorld().getProperties())) {
        return;
    }
    if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.INTERACT_BLOCK_PRIMARY.toString(), event.getTargetBlock().getState(), player.getWorld().getProperties())) {
        return;
    }

    GPTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.startTimingIfSync();
    final Location<World> location = clickedBlock.getLocation().orElse(null);
    final Object source = !itemInHand.isEmpty() ? itemInHand : player;
    if (location == null) {
        GPTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTimingIfSync();
        return;
    }

    final GPPlayerData playerData = this.dataStore.getOrCreatePlayerData(location.getExtent(), player.getUniqueId());
    final GPClaim claim = this.dataStore.getClaimAt(location);
    final Tristate result = GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.INTERACT_BLOCK_PRIMARY, source, clickedBlock.getState(), player, TrustType.BUILDER, true);
    if (result == Tristate.FALSE) {
        if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.BLOCK_BREAK.toString(), clickedBlock.getState(), player.getWorld().getProperties())) {
            GPTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTimingIfSync();
            return;
        }
        if (GPPermissionHandler.getClaimPermission(event, location, claim, GPPermissions.BLOCK_BREAK, player, clickedBlock.getState(), player, TrustType.BUILDER, true) == Tristate.TRUE) {
            GPTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTimingIfSync();
            playerData.setLastInteractData(claim);
            return;
        }

        // Don't send a deny message if the player is holding an investigation tool
        if (!PlayerUtils.hasItemInOneHand(player, GriefPreventionPlugin.instance.investigationTool)) {
            this.sendInteractBlockDenyMessage(itemInHand, clickedBlock, claim, player, playerData, handType);
        }
        event.setCancelled(true);
        GPTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTimingIfSync();
        return;
    }
    playerData.setLastInteractData(claim);
    GPTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTimingIfSync();
}
 
Example 13
Source File: ClaimFlagBase.java    From GriefPrevention with MIT License 4 votes vote down vote up
private Consumer<CommandSource> createFlagConsumer(CommandSource src, GPClaim claim, String flagPermission, Tristate flagValue, String source, FlagType displayType, FlagType flagType, boolean toggleType) {
    return consumer -> {
        // Toggle DEFAULT type
        final String sourceId = GPPermissionHandler.getSourcePermission(flagPermission);
        final String targetId = GPPermissionHandler.getTargetPermission(flagPermission);
        final ClaimFlag claimFlag = GPPermissionHandler.getFlagFromPermission(flagPermission);
        if (claimFlag == null) {
            return;
        }
        Context claimContext = claim.getContext();
        Tristate newValue = Tristate.UNDEFINED;
        if (flagType == FlagType.DEFAULT) {
            if (toggleType) {
                if (flagValue == Tristate.TRUE) {
                    newValue = Tristate.FALSE;
                } else {
                    newValue = Tristate.TRUE;
                }
                ClaimType claimType = claim.getType();
                if (claimType == ClaimType.SUBDIVISION) {
                    claimType = ClaimType.BASIC;
                }
                final Boolean defaultValue = DataStore.CLAIM_FLAG_DEFAULTS.get(claimType).get(claimFlag.toString());
                if (defaultValue != null && defaultValue == newValue.asBoolean()) {
                    newValue = Tristate.UNDEFINED;
                }
            }
            claimContext = CommandHelper.validateCustomContext(src, claim, "default");
        // Toggle CLAIM type
        } else if (flagType == FlagType.CLAIM) {
            if (flagValue == Tristate.TRUE) {
                newValue = Tristate.FALSE;
            } else if (flagValue == Tristate.UNDEFINED) {
                newValue = Tristate.TRUE;
            }
        // Toggle OVERRIDE type
        } else if (flagType == FlagType.OVERRIDE) {
            if (flagValue == Tristate.TRUE) {
                newValue = Tristate.FALSE;
            } else if (flagValue == Tristate.UNDEFINED) {
                newValue = Tristate.TRUE;
            }
            claimContext = CommandHelper.validateCustomContext(src, claim, "override");
        }
        try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) {
            Sponge.getCauseStackManager().pushCause(src);
            GPFlagClaimEvent.Set event = new GPFlagClaimEvent.Set(claim, this.subject, claimFlag, sourceId, targetId, toggleType ? newValue : flagValue, claimContext);
            Sponge.getEventManager().post(event);
            if (event.isCancelled()) {
                return;
            }
            FlagResult result = CommandHelper.applyFlagPermission(src, this.subject, "ALL", claim, flagPermission, source, "any", toggleType ? newValue : flagValue, claimContext, flagType, null, true);
            if (result.successful()) {
                showFlagPermissions(src, claim, displayType, source);
            }
        }
    };
}
 
Example 14
Source File: CommandClaimInfo.java    From GriefPrevention with MIT License 4 votes vote down vote up
private static Consumer<CommandSource> createClaimInfoConsumer(CommandSource src, Claim claim, String title) {
    GPClaim gpClaim = (GPClaim) claim;
    return info -> {
        switch (title) {
            case INHERIT_PARENT : 
                if (!claim.getParent().isPresent() || !src.hasPermission(GPPermissions.COMMAND_CLAIM_INHERIT)) {
                    return;
                }

                gpClaim.getInternalClaimData().setInheritParent(!gpClaim.getInternalClaimData().doesInheritParent());
                gpClaim.getInternalClaimData().setRequiresSave(true);
                claim.getData().save();
                CommandHelper.executeCommand(src, "claiminfo", gpClaim.getUniqueId().toString());
                return;
            case CLAIM_EXPIRATION :
                gpClaim.getInternalClaimData().setExpiration(!gpClaim.getInternalClaimData().allowExpiration());
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                break;
            case DENY_MESSAGES :
                gpClaim.getInternalClaimData().setDenyMessages(!gpClaim.getInternalClaimData().allowDenyMessages());
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                break;
            case FLAG_OVERRIDES :
                gpClaim.getInternalClaimData().setFlagOverrides(!gpClaim.getInternalClaimData().allowFlagOverrides());
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                break;
            case PVP_OVERRIDE :
                Tristate value = gpClaim.getInternalClaimData().getPvpOverride();
                if (value == Tristate.UNDEFINED) {
                    gpClaim.getInternalClaimData().setPvpOverride(Tristate.TRUE);
                } else if (value == Tristate.TRUE) {
                    gpClaim.getInternalClaimData().setPvpOverride(Tristate.FALSE);
                } else {
                    gpClaim.getInternalClaimData().setPvpOverride(Tristate.UNDEFINED);
                }
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                break;
            case RESIZABLE :
                boolean resizable = gpClaim.getInternalClaimData().isResizable();
                gpClaim.getInternalClaimData().setResizable(!resizable);
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                break;
            case REQUIRES_CLAIM_BLOCKS :
                boolean requiresClaimBlocks = gpClaim.getInternalClaimData().requiresClaimBlocks();
                gpClaim.getInternalClaimData().setRequiresClaimBlocks(!requiresClaimBlocks);
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                break;
            case SIZE_RESTRICTIONS :
                boolean sizeRestrictions = gpClaim.getInternalClaimData().hasSizeRestrictions();
                gpClaim.getInternalClaimData().setSizeRestrictions(!sizeRestrictions);
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                break;
            case FOR_SALE :
                boolean forSale = gpClaim.getEconomyData().isForSale();
                gpClaim.getEconomyData().setForSale(!forSale);
                gpClaim.getInternalClaimData().setRequiresSave(true);
                gpClaim.getClaimStorage().save();
                CommandHelper.executeCommand(src, "claiminfo", gpClaim.getUniqueId().toString());
                return;
            default:
        }
        executeAdminSettings(src, gpClaim);
    };
}