Package com.sk89q.worldedit.extension.platform

Examples of com.sk89q.worldedit.extension.platform.Actor


     *
     * @return an actor
     * @throws InputParseException thrown if no {@link Actor} is set
     */
    public Actor requireActor() throws InputParseException {
        Actor actor = getActor();
        if (actor == null) {
            throw new InputParseException("No actor is known");
        }
        return actor;
    }
View Full Code Here


            logMode = null;
        } else {
            logMode = loggingAnnotation.value();
        }

        Actor sender = context.getLocals().get(Actor.class);
        Player player;

        if (sender == null) {
            return;
        }

        if (sender instanceof Player) {
            player = (Player) sender;
        } else {
            return;
        }

        builder.append("WorldEdit: ").append(sender.getName());
        if (sender.isPlayer()) {
            builder.append(" (in \"").append(player.getWorld().getName()).append("\")");
        }

        builder.append(": ").append(context.getCommand());
       
        if (context.argsLength() > 0) {
            builder.append(" ").append(context.getJoinedStrings(0));
        }
       
        if (logMode != null && sender.isPlayer()) {
            Vector position = player.getPosition();
            LocalSession session = worldEdit.getSessionManager().get(player);
           
            switch (logMode) {
            case PLACEMENT:
View Full Code Here

                }
            }
        }

        // Check if the item is allowed
        Actor actor = context.requireActor();
        if (context.isRestricted() && actor != null && !actor.hasPermission("worldedit.anyblock")
                && worldEdit.getConfiguration().disallowedBlocks.contains(blockId)) {
            throw new DisallowedUsageException("You are not allowed to use '" + input + "'");
        }

        if (blockType == null) {
View Full Code Here

     * @throws ParameterException on error
     */
    @BindingMatch(type = Actor.class,
            behavior = BindingBehavior.PROVIDES)
    public Actor getActor(ArgumentStack context) throws ParameterException {
        Actor sender = context.getContext().getLocals().get(Actor.class);
        if (sender == null) {
            throw new ParameterException("Missing 'Actor'");
        } else {
            return sender;
        }
View Full Code Here

     * @throws ParameterException on error
     */
    @BindingMatch(type = Player.class,
                  behavior = BindingBehavior.PROVIDES)
    public Player getPlayer(ArgumentStack context) throws ParameterException {
        Actor sender = context.getContext().getLocals().get(Actor.class);
        if (sender == null) {
            throw new ParameterException("No player to get a session for");
        } else if (sender instanceof Player) {
            return (Player) sender;
        } else {
View Full Code Here

     */
    @BindingMatch(type = BaseBlock.class,
                  behavior = BindingBehavior.CONSUMES,
                  consumedCount = 1)
    public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException {
        Actor actor = context.getContext().getLocals().get(Actor.class);
        ParserContext parserContext = new ParserContext();
        parserContext.setActor(context.getContext().getLocals().get(Actor.class));
        if (actor instanceof Entity) {
            Extent extent = ((Entity) actor).getExtent();
            if (extent instanceof World) {
View Full Code Here

     */
    @BindingMatch(type = Pattern.class,
                  behavior = BindingBehavior.CONSUMES,
                  consumedCount = 1)
    public Pattern getPattern(ArgumentStack context) throws ParameterException, WorldEditException {
        Actor actor = context.getContext().getLocals().get(Actor.class);
        ParserContext parserContext = new ParserContext();
        parserContext.setActor(context.getContext().getLocals().get(Actor.class));
        if (actor instanceof Entity) {
            Extent extent = ((Entity) actor).getExtent();
            if (extent instanceof World) {
View Full Code Here

     */
    @BindingMatch(type = Mask.class,
                  behavior = BindingBehavior.CONSUMES,
                  consumedCount = 1)
    public Mask getMask(ArgumentStack context) throws ParameterException, WorldEditException {
        Actor actor = context.getContext().getLocals().get(Actor.class);
        ParserContext parserContext = new ParserContext();
        parserContext.setActor(context.getContext().getLocals().get(Actor.class));
        if (actor instanceof Entity) {
            Extent extent = ((Entity) actor).getExtent();
            if (extent instanceof World) {
View Full Code Here

                  behavior = BindingBehavior.CONSUMES,
                  consumedCount = 1)
    public BaseBiome getBiomeType(ArgumentStack context) throws ParameterException, WorldEditException {
        String input = context.next();
        if (input != null) {
            Actor actor = context.getContext().getLocals().get(Actor.class);
            World world;
            if (actor instanceof Entity) {
                Extent extent = ((Entity) actor).getExtent();
                if (extent instanceof World) {
                    world = (World) extent;
View Full Code Here

*/
public class ActorAuthorizer implements Authorizer {

    @Override
    public boolean testPermission(CommandLocals locals, String permission) {
        Actor sender = locals.get(Actor.class);
        if (sender == null) {
            throw new RuntimeException("Uh oh! No 'Actor' specified so that we can check permissions");
        } else {
            return sender.hasPermission(permission);
        }
    }
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.extension.platform.Actor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.