Java Code Examples for org.spongepowered.api.entity.living.player.Player#hasPermission()

The following examples show how to use org.spongepowered.api.entity.living.player.Player#hasPermission() . 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: SpyListener.java    From UltimateCore with MIT License 6 votes vote down vote up
@Listener
public void onWhisper(MessageChannelEvent e) {
    if (!Modules.PERSONALMESSAGE.isPresent()) {
        return;
    }
    if (e instanceof PersonalmessageEvent) {
        PersonalmessageEvent ev = (PersonalmessageEvent) e;
        CommandSource s = ev.getPMSender();
        CommandSource t = ev.getPMTarget();

        for (Player p : Sponge.getServer().getOnlinePlayers()) {
            if (!p.hasPermission(SpyPermissions.UC_SPY_MESSAGESPY_SEE.get())) {
                continue;
            }
            if (s.getIdentifier().equals(p.getIdentifier()) || t.getIdentifier().equals(p.getIdentifier())) {
                continue;
            }
            if (!UltimateCore.get().getUserService().getUser(p).get(SpyKeys.MESSAGESPY_ENABLED).get()) {
                continue;
            }
            Messages.send(p, "spy.format.messagespy", "%player%", s, "%target%", t, "%message%", ev.getPMUnformattedMessage());
        }
    }
}
 
Example 2
Source File: BlacklistListener.java    From EssentialCmds with MIT License 6 votes vote down vote up
@Listener
public void onBreakBlock(ChangeBlockEvent.Break event, @Root Player player)
{
	if (!player.hasPermission("essentialcmds.blacklist.bypass"))
	{
		for (Transaction<BlockSnapshot> transaction : event.getTransactions())
		{
			if (Utils.getBlacklistItems().contains(transaction.getOriginal().getState().getType().getId()))
			{
				if (Utils.areBlacklistMsgsEnabled())
					player.sendMessage(Text.of(TextColors.RED, "The item ", TextColors.GRAY, transaction.getFinal().getState().getType().getId(), TextColors.RED, " has been confiscated as it is blacklisted."));

				event.setCancelled(true);
			}
		}
	}
}
 
Example 3
Source File: BlacklistListener.java    From EssentialCmds with MIT License 6 votes vote down vote up
@Listener
public void onDropItem(DropItemEvent.Dispense event, @Root Player player)
{
	if (!player.hasPermission("essentialcmds.blacklist.bypass"))
	{
		event.filterEntities(e -> {
			if (e.get(RepresentedItemData.class).isPresent())
			{
				RepresentedItemData itemData = e.get(RepresentedItemData.class).get();
				boolean blacklisted = Utils.getBlacklistItems().contains(itemData.item().get().getType().getId());

				if (blacklisted)
				{
					if (Utils.areBlacklistMsgsEnabled())
						player.sendMessage(Text.of(TextColors.RED, "The item ", TextColors.GRAY, itemData.item().get().getType().getId(), TextColors.RED, " has been confiscated as it is blacklisted."));
				}

				return !blacklisted;
			}
			return false;
		});
	}
}
 
Example 4
Source File: BuildPermListener.java    From Nations with MIT License 6 votes vote down vote up
@Listener(order=Order.FIRST, beforeModifications = true)
public void onPlayerModifyBlock(ChangeBlockEvent.Modify event, @First Player player)
{
	if (player.hasPermission("nations.admin.bypass.perm.build"))
	{
		return;
	}
	event
	.getTransactions()
	.stream()
	.forEach(trans -> trans.getOriginal().getLocation().ifPresent(loc -> {
		if (ConfigHandler.getNode("worlds").getNode(trans.getFinal().getLocation().get().getExtent().getName()).getNode("enabled").getBoolean()
				&& !ConfigHandler.isWhitelisted("build", trans.getFinal().getState().getType().getId())
				&& !DataHandler.getPerm("build", player.getUniqueId(), loc))
		{
			trans.setValid(false);
			try {
				player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD));
			} catch (Exception e) {}
		}
	}));
}
 
Example 5
Source File: UCListener.java    From UltimateChat with GNU General Public License v3.0 6 votes vote down vote up
@Listener
public void onQuit(ClientConnectionEvent.Disconnect e, @Getter("getTargetEntity") Player p) {
    if (!UChat.get().getConfig().root().general.persist_channels) {
        UChat.get().getPlayerChannel(p).removeMember(p);
    }

    UChat.get().tellPlayers.remove(p.getName());
    UChat.get().tellPlayers.entrySet().removeIf(k -> k.getValue().equals(p.getName()));
    UChat.get().tempTellPlayers.remove(p.getName());
    UChat.get().tempTellPlayers.entrySet().removeIf(k -> k.getValue().equals(p.getName()));
    UChat.get().respondTell.remove(p.getName());
    UChat.get().respondTell.entrySet().removeIf(k -> k.getValue().equals(p.getName()));
    UChat.get().tempChannels.remove(p.getName());
    UChat.get().tempChannels.entrySet().removeIf(k -> k.getValue().equals(p.getName()));
    UChat.get().command.remove(p.getName());

    if (UChat.get().getUCJDA() != null && UChat.get().getUCJDA().JDAAvailable() && !p.hasPermission(UChat.get().getConfig().root().discord.vanish_perm)) {
        Task.builder().async().execute(() ->
                UChat.get().getUCJDA().sendRawToDiscord(UChat.get().getLang().get("discord.leave").replace("{player}", p.getName())));
    }
}
 
Example 6
Source File: ConfigManager.java    From RedProtect with GNU General Public License v3.0 6 votes vote down vote up
public boolean needClaimToBuild(Player p, BlockSnapshot b) {
    if (p.hasPermission("redprotect.need-claim-to-build.bypass"))
        return false;

    boolean bool = root.needed_claim_to_build.worlds.contains(p.getWorld().getName());
    if (bool) {
        if (b != null && root.needed_claim_to_build.allow_only_protections_blocks &&
                (getWorldClaimType(p.getWorld().getName()).equalsIgnoreCase("BLOCK") ||
                        getWorldClaimType(p.getWorld().getName()).equalsIgnoreCase("BOTH"))) {
            boolean blocks = b.getState().getId().contains(root.region_settings.block_id) ||
                    root.needed_claim_to_build.allow_break_blocks.stream().anyMatch(str -> str.equalsIgnoreCase(b.getState().getId()));
            if (!blocks) {
                RedProtect.get().lang.sendMessage(p, "need.claim.blockids");
            } else {
                return false;
            }
        }
        RedProtect.get().lang.sendMessage(p, "need.claim.tobuild");
    }
    return bool;
}
 
Example 7
Source File: ActivePlayerChatView.java    From ChatUI with MIT License 6 votes vote down vote up
private void initNewTab(Player player) {
    this.newTab.addButton("Player List", new NewTab.LaunchTabAction(() -> new Tab(Text.of("Player List"), this.playerList.getRoot())));
    if (ImplementationConfig.isSupported()) {
        if (player.hasPermission(PERM_CONFIG)) {
            ConfigEditTab.Options opts = new ConfigEditTab.Options(
                    player.hasPermission(PERM_CONFIG + ".add"),
                    player.hasPermission(PERM_CONFIG + ".edit"),
                    player.hasPermission(PERM_CONFIG + ".delete"), null);
            this.newTab.addButton("Edit Config", new NewTab.LaunchTabAction(() -> new ConfigEditTab(ImplementationConfig.getRootNode(),
                    ImplementationConfig.getTitle(), opts, ImplementationConfig.getHandler())));
        }
    }
    if (player.hasPermission(PERM_PERMISSIONS)) {
        Optional<PermissionService> optService = Sponge.getServiceManager().provide(PermissionService.class);
        if (optService.isPresent()) {
            this.newTab.addButton("Permissions", new NewTab.LaunchTabAction(() -> new PermissionsTab(optService.get())));
        }
    }
    UUID uuid = player.getUniqueId();
    this.newTab.addButton("Settings", new NewTab.LaunchTabAction(() -> createSettingsTab(uuid)));
}
 
Example 8
Source File: SignListener.java    From UltimateCore with MIT License 6 votes vote down vote up
@Listener
public void onSignDestroy(ChangeBlockEvent.Break event, @Root Player p) {
    for (Transaction<BlockSnapshot> transaction : event.getTransactions()) {
        BlockSnapshot snapshot = transaction.getOriginal();
        if (snapshot.supports(Keys.SIGN_LINES) && snapshot.getLocation().isPresent()) {
            List<Text> texts = snapshot.get(Keys.SIGN_LINES).get();
            //Checking for sign contents
            for (UCSign usign : UltimateCore.get().getSignService().get().getRegisteredSigns()) {
                if (texts.get(0).toPlain().equalsIgnoreCase("[" + usign.getIdentifier() + "]")) {
                    if (!p.hasPermission(usign.getDestroyPermission().get())) {
                        Messages.send(p, "core.nopermissions");
                    }
                    SignDestroyEvent cevent = new SignDestroyEvent(usign, snapshot.getLocation().get(), Cause.builder().append(UltimateCore.getContainer()).append(p).build(EventContext.builder().build()));
                    Sponge.getEventManager().post(cevent);
                    if (!cevent.isCancelled() && usign.onDestroy(p, event, texts)) {
                        Messages.send(p, "sign.destroy", "%sign%", usign.getIdentifier());
                    }
                }
            }
        }
    }
}
 
Example 9
Source File: BlacklistListener.java    From EssentialCmds with MIT License 6 votes vote down vote up
@Listener
public void onPickupItem(ChangeInventoryEvent.Pickup event, @Root Player player)
{
	if (!player.hasPermission("essentialcmds.blacklist.bypass"))
	{
		for (SlotTransaction transaction : event.getTransactions())
		{
			if (Utils.getBlacklistItems().contains(transaction.getFinal().createStack().getItem().getId()))
			{
				if (Utils.areBlacklistMsgsEnabled())
					player.sendMessage(Text.of(TextColors.RED, "The item ", TextColors.GRAY, transaction.getFinal().createStack().getItem().getId(), TextColors.RED, " has been confiscated as it is blacklisted."));

				transaction.setCustom(Sponge.getRegistry().createBuilder(ItemStack.Builder.class).itemType(ItemTypes.DIRT).quantity(1).build());
			}
		}
	}
}
 
Example 10
Source File: PlayerListener.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onConsume(UseItemStackEvent.Start e, @First Player p) {
    ItemStack stack = e.getItemStackInUse().createStack();
    RedProtect.get().logger.debug(LogLevel.PLAYER, "Is UseItemStackEvent.Start event. Item: " + RedProtect.get().getVersionHelper().getItemType(stack).getName());

    //deny potion
    List<String> Pots = RedProtect.get().config.globalFlagsRoot().worlds.get(p.getWorld().getName()).deny_potions;

    if (stack.get(Keys.POTION_EFFECTS).isPresent() && Pots.size() > 0) {
        List<PotionEffect> pot = stack.get(Keys.POTION_EFFECTS).get();
        for (PotionEffect pots : pot) {
            if (Pots.contains(pots.getType().getName().toUpperCase()) && !p.hasPermission("redprotect.bypass")) {
                e.setCancelled(true);
                RedProtect.get().lang.sendMessage(p, "playerlistener.denypotion");
            }
        }
    }

    Region r = RedProtect.get().rm.getTopRegion(p.getLocation(), this.getClass().getName());

    if (r != null && RedProtect.get().getVersionHelper().getItemType(stack).equals(ItemTypes.POTION) && !r.usePotions(p)) {
        RedProtect.get().lang.sendMessage(p, "playerlistener.region.cantuse");
        e.setCancelled(true);
    }

    if (r != null && RedProtect.get().getVersionHelper().getItemType(stack).getName().equals("minecraft:chorus_fruit") && !r.canTeleport(p)) {
        RedProtect.get().lang.sendMessage(p, "playerlistener.region.cantuse");
        e.setCancelled(true);
    }
}
 
Example 11
Source File: PlayerList.java    From ChatUI with MIT License 5 votes vote down vote up
private void addDefaultAddons(Player player) {
    TextFormat link = TextFormat.of(TextColors.BLUE, TextStyles.UNDERLINE);
    if (player.hasPermission(PERM_KICK)) {
        addAddon(listPlayer -> Text.builder("Kick").format(link).onClick(Utils.execClick(view -> listPlayer.kick())).build());
    }
    if (player.hasPermission(PERM_BAN)) {
        addAddon(listPlayer -> Text.builder("Ban").format(link)
                .onClick(Utils.execClick(view -> Sponge.getServiceManager().provideUnchecked(BanService.class).addBan(Ban.of(listPlayer.getProfile()))))
                .build());
    }
}
 
Example 12
Source File: CheckPermissionListener.java    From ChangeSkin with MIT License 5 votes vote down vote up
private boolean checkPerm(Player invoker, String node, boolean skinPerm, UUID targetUUID) {
    String pluginName = plugin.getName().toLowerCase();
    boolean hasCommandPerm = invoker.hasPermission(pluginName +  '.' + node);
    if (skinPerm) {
        return hasCommandPerm && plugin.hasSkinPermission(invoker, targetUUID, false);
    }

    return hasCommandPerm;
}
 
Example 13
Source File: CommandClaimFlagReset.java    From GriefDefender with MIT License 5 votes vote down vote up
@CommandAlias("cfr")
@Description("Resets a claim to flag defaults.")
@Subcommand("flag reset")
public void execute(Player player) {
    final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
    final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation());
    final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_CLAIM_RESET_FLAGS,
            ImmutableMap.of(
            "type", claim.getType().getName()));
    if (claim.isWilderness()) {
        if (!player.hasPermission(GDPermissions.MANAGE_WILDERNESS)) {
            GriefDefenderPlugin.sendMessage(player, message);
            return;
        }
    } else if (claim.isAdminClaim()) {
        if (!player.getUniqueId().equals(claim.getOwnerUniqueId()) && !player.hasPermission(GDPermissions.COMMAND_ADMIN_CLAIMS)) {
            GriefDefenderPlugin.sendMessage(player, message);
            return;
        }
    } else if (!player.hasPermission(GDPermissions.COMMAND_ADMIN_CLAIMS) && (claim.isBasicClaim() || claim.isSubdivision()) && !player.getUniqueId().equals(claim.getOwnerUniqueId())) {
        GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().PERMISSION_CLAIM_RESET_FLAGS_SELF);
        return;
    }

    final Component confirmationText = TextComponent.builder()
            .append(MessageCache.getInstance().FLAG_RESET_WARNING)
            .append(TextComponent.builder()
                .append("\n[")
                .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN))
                .append("]\n")
                .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, createConfirmationConsumer(player, claim), true)))
                .hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_CONFIRM)).build())
            .build();
    TextAdapter.sendComponent(player, confirmationText);
}
 
Example 14
Source File: InteractPermListener.java    From Nations with MIT License 5 votes vote down vote up
@Listener(order=Order.FIRST, beforeModifications = true)
public void onInteract(InteractEntityEvent event, @First Player player)
{
	if (!ConfigHandler.getNode("worlds").getNode(player.getWorld().getName()).getNode("enabled").getBoolean())
	{
		return;
	}
	if (player.hasPermission("nations.admin.bypass.perm.interact"))
	{
		return;
	}
	Entity target = event.getTargetEntity();
	if (target instanceof Player || target instanceof Monster)
	{
		return;
	}
	if (target instanceof ItemFrame || target instanceof ArmorStand)
	{
		if (player.hasPermission("nations.admin.bypass.perm.build"))
		{
			return;
		}
		if (!DataHandler.getPerm("build", player.getUniqueId(), event.getTargetEntity().getLocation()))
		{
			event.setCancelled(true);
			player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_BUILD));
		}
		return;
	}
	if (!DataHandler.getPerm("interact", player.getUniqueId(), event.getTargetEntity().getLocation()))
	{
		event.setCancelled(true);
		player.sendMessage(Text.of(TextColors.RED, LanguageHandler.ERROR_PERM_INTERACT));
	}
}
 
Example 15
Source File: VirtualChestInventoryDispatcher.java    From VirtualChest with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean hasPermission(Player player, String inventoryName)
{
    boolean hasSelfPermission = player.hasPermission("virtualchest.open.self." + inventoryName);
    boolean hasOthersPermission = player.hasPermission("virtualchest.open.others." + inventoryName);
    boolean hasSelfUpdatePermission = player.hasPermission("virtualchest.update.self" + inventoryName);
    boolean hasOthersUpdatePermission = player.hasPermission("virtualchest.update.others" + inventoryName);
    return hasSelfPermission || hasOthersPermission || hasSelfUpdatePermission || hasOthersUpdatePermission;
}
 
Example 16
Source File: Region.java    From RedProtect with GNU General Public License v3.0 4 votes vote down vote up
private boolean checkAllowedPlayer(Player p, String flag) {
    return this.isLeader(p) || this.isAdmin(p) || this.isMember(p) || p.hasPermission("redprotect.flag.bypass." + flag);
}
 
Example 17
Source File: SpawnExecutor.java    From EssentialCmds with MIT License 4 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	if (src instanceof Player)
	{
		Player player = (Player) src;
		Transform<World> spawn = Utils.getSpawn();

		if (Utils.isSpawnInConfig())
		{
			if (Utils.isTeleportCooldownEnabled() && !player.hasPermission("essentialcmds.teleport.cooldown.override"))
			{
				EssentialCmds.teleportingPlayers.add(player.getUniqueId());
				src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Teleporting to Spawn. Please wait " + Utils.getTeleportCooldown() + " seconds."));

				Sponge.getScheduler().createTaskBuilder().execute(() -> {
					if (EssentialCmds.teleportingPlayers.contains(player.getUniqueId()))
					{
						Utils.setLastTeleportOrDeathLocation(player.getUniqueId(), player.getLocation());

						if (!Objects.equals(player.getWorld().getUniqueId(), spawn.getExtent().getUniqueId()))
						{
							player.transferToWorld(spawn.getExtent().getUniqueId(), spawn.getPosition());
							player.setTransform(spawn);
						}
						else
						{
							player.setTransform(spawn);
						}

						src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Teleported to Spawn"));
						EssentialCmds.teleportingPlayers.remove(player.getUniqueId());
					}
				}).delay(Utils.getTeleportCooldown(), TimeUnit.SECONDS).name("EssentialCmds - Back Timer").submit(Sponge.getGame().getPluginManager().getPlugin(PluginInfo.ID).get().getInstance().get());
			}
			else
			{
				Utils.setLastTeleportOrDeathLocation(player.getUniqueId(), player.getLocation());

				if (!Objects.equals(player.getWorld().getUniqueId(), spawn.getExtent().getUniqueId()))
				{
					player.transferToWorld(spawn.getExtent().getUniqueId(), spawn.getPosition());
					player.setTransform(spawn);
				}
				else
				{
					player.setTransform(spawn);
				}

				src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Teleported to Spawn"));
			}
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Spawn has not been set yet!"));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Must be an in-game player to use /spawn!"));
	}

	return CommandResult.success();
}
 
Example 18
Source File: GlobalListener.java    From RedProtect with GNU General Public License v3.0 4 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onProjectileHit(CollideEntityEvent event, @Root Projectile proj) {
    RedProtect.get().logger.debug(LogLevel.ENTITY, "Is CollideEntityEvent(onProjectileHit) event.");
    RedProtect.get().logger.debug(LogLevel.ENTITY, "Projectile: " + proj.getType().getName());
    if (RedProtect.get().rm.getTopRegion(proj.getLocation(), this.getClass().getName()) != null) return;

    for (Entity ent : event.getEntities()) {
        RedProtect.get().logger.debug(LogLevel.ENTITY, "Entity: " + ent.getType().getName());

        if (proj.getShooter() instanceof Player) {
            Player p = (Player) proj.getShooter();

            if (ent instanceof Player) {
                if (!p.equals(ent) && !RedProtect.get().config.globalFlagsRoot().worlds.get(ent.getWorld().getName()).pvp && !p.hasPermission("redprotect.world.bypass")) {
                    event.setCancelled(true);
                    return;
                }
            }
            if (ent instanceof Animal || ent instanceof Villager || ent instanceof Golem || ent instanceof Ambient) {
                if (!RedProtect.get().config.globalFlagsRoot().worlds.get(ent.getWorld().getName()).player_hurt_passives && !p.hasPermission("redprotect.world.bypass")) {
                    event.setCancelled(true);
                    return;
                }
            }
            if (ent instanceof Monster) {
                if (!RedProtect.get().config.globalFlagsRoot().worlds.get(ent.getWorld().getName()).player_hurt_monsters && !p.hasPermission("redprotect.world.bypass")) {
                    event.setCancelled(true);
                    return;
                }
            }
            if (ent instanceof Hanging || ent instanceof ArmorStand) {
                if (!RedProtect.get().config.globalFlagsRoot().worlds.get(ent.getWorld().getName()).build && !p.hasPermission("redprotect.world.bypass")) {
                    event.setCancelled(true);
                }
            }
        } else {
            if (ent instanceof Hanging || ent instanceof ArmorStand) {
                if (!RedProtect.get().config.globalFlagsRoot().worlds.get(ent.getWorld().getName()).entity_block_damage) {
                    event.setCancelled(true);
                    return;
                }
            }
        }
    }
}
 
Example 19
Source File: GPPlayerData.java    From GriefPrevention with MIT License 4 votes vote down vote up
public boolean canCreateClaim(Player player, boolean sendMessage) {
    if (this.shovelMode == ShovelMode.Basic) {
        if (this.optionClaimCreateMode == 0 && !player.hasPermission(GPPermissions.CLAIM_CREATE_BASIC)) {
            if (sendMessage) {
                GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.permissionClaimCreate.toText());
            }
            return false;
        }
        if (this.optionClaimCreateMode == 1 && !player.hasPermission(GPPermissions.CLAIM_CUBOID_BASIC)) {
            if (sendMessage) {
                GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.permissionCuboid.toText());
                GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimCuboidDisabled.toText());
            }
            return false;
        }
    } else if (this.shovelMode == ShovelMode.Subdivide) {
        if (this.optionClaimCreateMode == 0 && !player.hasPermission(GPPermissions.CLAIM_CREATE_SUBDIVISION)) {
            if (sendMessage) {
                GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.permissionClaimCreate.toText());
            }
            return false;
        } else if (!player.hasPermission(GPPermissions.CLAIM_CUBOID_SUBDIVISION)) {
            if (sendMessage) {
                GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.permissionCuboid.toText());
                GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimCuboidDisabled.toText());
            }
            return false;
        }
    } else if (this.shovelMode == ShovelMode.Admin) {
        if (this.optionClaimCreateMode == 0 && !player.hasPermission(GPPermissions.COMMAND_ADMIN_CLAIMS)) {
            return false;
        } else if (!player.hasPermission(GPPermissions.CLAIM_CUBOID_ADMIN)) {
            return false;
        }
    } else if (this.shovelMode == ShovelMode.Town) {
        if (this.optionClaimCreateMode == 0 && !player.hasPermission(GPPermissions.CLAIM_CREATE_TOWN)) {
            return false;
        } else if (!player.hasPermission(GPPermissions.CLAIM_CUBOID_TOWN)) {
            return false;
        }
    }

    return true;
}
 
Example 20
Source File: PermissionHandler.java    From RedProtect with GNU General Public License v3.0 4 votes vote down vote up
public boolean hasPermOrBypass(Player p, String perm) {
    return p.hasPermission(perm) || p.hasPermission(perm + ".bypass");
}