@Override public boolean testPermission(CommandSource source) { return this.permission == null || source.hasPermission(this.permission); }
@Override public List<String> complete(CommandSource src, CommandArgs args, CommandContext context) { if (!src.hasPermission(this.permission)) { return ImmutableList.of(); } return this.element.complete(src, args, context); }
@Override public boolean testPermission(CommandSource source) { for (String perm : command.getDescription().getPermissions()) { if (!source.hasPermission(perm)) { return false; } } return true; }
/** * Perform a permissions check, throwing an exception if the required * permissions are not present. * * @param commander the source to check against * @param permission The permission to check * @throws CommandException if the source does not have permission */ public void checkPermission(CommandSource commander, String permission) throws CommandException { if (!commander.hasPermission(permission)) { throw new CommandException(t("You do not have permission to use this command!")); } }
private void checkPermission(CommandSource source, CommandArgs args) throws ArgumentParseException { if (!source.hasPermission(this.permission)) { Text key = getKey(); throw args.createError(t("You do not have permission to use the %s argument", key != null ? key : t("unknown"))); } }
@Override public boolean hasPermission(String permission) { return commandSource.hasPermission(permission); }
@Override public boolean hasPermission(String permission) { return source.hasPermission(permission); }
@Override public boolean testPermission(CommandSource source) { return source.hasPermission("viaversion.admin"); }
@Override public boolean testPermission(CommandSource source) { return this.permission == null || source.hasPermission(this.permission); }
@Override public boolean hasPermission(Set<Context> contexts, String permission) { return this.actualSource.hasPermission(contexts, permission); }
@Override public boolean testPermission(CommandSource source) { return source.hasPermission(PLUGIN_ID + ".command.spawn"); }
@Override public boolean hasPermission(final String permission) { return this.source.hasPermission(permission); }
@Override public boolean testPermission(CommandSource source) { return source.hasPermission("spark"); }
@Override public boolean testPermission(CommandSource source) { return source.hasPermission("command.sponge.testsuite"); }
@Override public boolean hasSkinPermission(CommandSource invoker, UUID uuid, boolean sendMessage) { if (invoker.hasPermission(ARTIFACT_ID + ".skin.whitelist." + uuid)) { return true; } //disallow - not whitelisted or blacklisted if (sendMessage) { sendMessage(invoker, "no-permission"); } return false; }
@Override public List<String> complete(CommandSource src, CommandArgs args, CommandContext context) { if (!src.hasPermission(this.permission)) { return ImmutableList.of(); } return this.element.complete(src, args, context); }
/** * Perform a permissions check, throwing an exception if the required permissions are not present. * * @param commander the source to check against * @param permission The permission to check * @throws CommandException if the source does not have permission */ public void checkPermission(CommandSource commander, String permission) throws CommandException { if (!commander.hasPermission(permission)) { throw new CommandException(t("You do not have permission to use this command!")); } }
private CommandSource mockSource() { CommandSource mock = Mockito.mock(CommandSource.class); Mockito.when(mock.hasPermission(Mockito.any())).thenReturn(true); return mock; } }
private CommandSource getMockCommandSource() { CommandSource pl = Mockito.mock(CommandSource.class); Mockito.when(pl.hasPermission(Matchers.any())).thenReturn(true); Mockito.when(pl.hasPermission(Matchers.any(), Matchers.any())).thenReturn(true); Mockito.when(pl.getPermissionValue(Matchers.any(), Matchers.any())).thenReturn(Tristate.TRUE); return pl; }
private void checkPermission(CommandSource source, CommandArgs args) throws ArgumentParseException { if (!source.hasPermission(this.permission)) { Text key = getKey(); throw args.createError(t("You do not have permission to use the %s argument", key != null ? key : t("unknown"))); } }