Examples of TeleportPlayerIterator


Examples of com.sk89q.commandbook.util.entity.player.iterators.TeleportPlayerIterator

                loc = home.getLocation();
            } else {
                throw new CommandException("A home for the given player does not exist.");
            }

            (new TeleportPlayerIterator(sender, loc)).iterate(targets);
        }
View Full Code Here

Examples of com.sk89q.commandbook.util.entity.player.iterators.TeleportPlayerIterator

                loc = warp.getLocation();
            } else {
                throw new CommandException("A warp by the given name does not exist.");
            }

            (new TeleportPlayerIterator(sender, loc, args.hasFlag('s'))).iterate(targets);
        }
View Full Code Here

Examples of com.sk89q.commandbook.util.entity.player.iterators.TeleportPlayerIterator

                    // the current has already been checked
                    CommandBook.inst().checkPermission(sender, loc.getWorld(), "commandbook.teleport");
                }
            }

            (new TeleportPlayerIterator(sender, loc, args.hasFlag('s'), relative)).iterate(targets);
        }
View Full Code Here

Examples of com.sk89q.commandbook.util.entity.player.iterators.TeleportPlayerIterator

                    final String targetMessage = ChatUtil.replaceColorMacros(
                            ChatUtil.replaceMacros(sender, config.bringMessageTarget))
                            .replaceAll("%ctarget%", ChatUtil.toColoredName(target, null))
                            .replaceAll("%target%", target.getName());

                    (new TeleportPlayerIterator(sender, player.getLocation()) {
                        @Override
                        public void onVictim(CommandSender sender, Player player) {
                            player.sendMessage(targetMessage);
                        }

                        @Override
                        public void onInformMany(CommandSender sender, int affected) {
                            sender.sendMessage(senderMessage);
                        }
                    }).iterate(Lists.newArrayList(target));
                    return;
                } else if (!CommandBook.inst().hasPermission(sender, "commandbook.teleport.other")) {
                    // There was a single player match, but, the target was not bringable, and the player
                    // does not have permission to teleport players in his/her current world.
                    throw new CommandException(config.bringMessageNoPerm);
                }
            }

            Location loc = player.getLocation();

            // There was not a single player match, or that single player match did not request
            // to be brought. The player does have permission to teleport players in his/her
            // current world. However, we're now teleporting in targets from potentially different worlds,
            // and we should ensure that the sender has permission to teleport players in those worlds.
            Iterable<Player> targets = InputUtil.PlayerParser.matchPlayers(sender, args.getString(0));
            for (Player aTarget : targets) {
                // We have already checked the from and current locations, we must now check the to if the world does not match
                if (!loc.getWorld().equals(aTarget.getWorld())) {
                    CommandBook.inst().checkPermission(sender, aTarget.getWorld(), "commandbook.teleport.other");
                }
            }

            (new TeleportPlayerIterator(sender, loc)).iterate(targets);
        }
View Full Code Here

Examples of com.sk89q.commandbook.util.entity.player.iterators.TeleportPlayerIterator

                if (!loc.getWorld().equals(target.getWorld())) {
                    CommandBook.inst().checkPermission(sender, target.getWorld(), "commandbook.teleport.other");
                }
            }

            (new TeleportPlayerIterator(sender, loc)).iterate(targets);
        }
View Full Code Here

Examples of com.sk89q.commandbook.util.entity.player.iterators.TeleportPlayerIterator

            Location lastLoc = sessions.getSession(TeleportSession.class, player).popLastLocation();

            if (lastLoc != null) {
                sessions.getSession(TeleportSession.class, player).setIgnoreLocation(lastLoc);
                lastLoc.getChunk().load(true);
                (new TeleportPlayerIterator(sender, lastLoc) {
                    @Override
                    public void onCaller(Player player) {
                        sender.sendMessage(ChatColor.YELLOW + "You've been returned.");
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.