All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.alangomes.springspigot.security.Authorize Maven / Gradle / Ivy

There is a newer version: 0.20.7
Show newest version
package dev.alangomes.springspigot.security;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Determine a business logic to filter the method calls (or all methods inside class) based in the {@link org.bukkit.command.CommandSender CommandSender}
 * of the current context. This automatically requires the presence of a {@link org.bukkit.command.CommandSender CommandSender}.
 */
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Authorize {


    /**
     * The expression to be ran before the method is called.
     * If the expression evaluates to {@code false}, the call will automatically throw a {@link dev.alangomes.springspigot.exception.PermissionDeniedException PermissionDeniedException}.
     * If there's no sender in the current context, the method will throw a {@link dev.alangomes.springspigot.exception.PlayerNotFoundException PlayerNotFoundException}.
     *
     * E.g.: @Authorize("hasPermission('test.permission') or isOp()")
     *
     * @see Language Reference
     */
    String value();

    /**
     * The message to be thrown in {@link dev.alangomes.springspigot.exception.PermissionDeniedException PermissionDeniedException}
     * if the expression evaluates to {@code false}
     */
    String message() default "";

    /**
     * Additional parameters that will be set on the expression as {@code #params}.
     * @see dev.alangomes.springspigot.security.HasPermission
     */
    String[] params() default {};

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy