Examples of MVPortal


Examples of com.onarandombox.MultiversePortals.MVPortal

        return dest.startsWith("rp:");
    }

    @Override
    public Location getLocation(Entity e) {
        MVPortal portal = portals.get(RANDOM.nextInt(portals.size()));
        PortalLocation pl = portal.getLocation();
        double portalWidth = Math.abs((pl.getMaximum().getBlockX()) - pl.getMinimum().getBlockX()) + 1;
        double portalDepth = Math.abs((pl.getMaximum().getBlockZ()) - pl.getMinimum().getBlockZ()) + 1;

        double finalX = (portalWidth / 2.0) + pl.getMinimum().getBlockX();
        double finalZ = (portalDepth / 2.0) + pl.getMinimum().getBlockZ();
        double finalY = this.getMinimumWith2Air((int) finalX, (int) finalZ, pl.getMinimum().getBlockY(),
                pl.getMaximum().getBlockY(), portal.getWorld());
        return new Location(portal.getWorld(), finalX, finalY, finalZ);
    }
View Full Code Here

Examples of com.onarandombox.MultiversePortals.MVPortal

        this.portals = new ArrayList<MVPortal>();
        // If this class exists, then this plugin MUST exist!
        MultiversePortals portalPlugin = (MultiversePortals) plugin.getServer().getPluginManager().getPlugin("Multiverse-Portals");
        String[] split = dest.split(":");
        // iterate over splits, split[0] = getIdentifier()
        MVPortal portal;
        for (int i = 1; i < split.length; i++)
            if ((portal = portalPlugin.getPortalManager().getPortal(split[i])) != null)
                this.portals.add(portal);
    }
View Full Code Here

Examples of com.onarandombox.MultiversePortals.MVPortal

            sender.sendMessage("Looks like you forgot or added an extra parameter.");
            sender.sendMessage("Please try again, or see our Wiki for help!");
            return;
        }
        String portalName = extractPortalName(args);
        MVPortal selectedPortal = null;
        // If they provided -p PORTALNAME, try to retrieve it
        if (portalName != null) {
            selectedPortal = this.plugin.getPortalManager().getPortal(portalName);
            if (selectedPortal == null) {
                sender.sendMessage("Sorry, the portal " + ChatColor.RED + portalName + ChatColor.WHITE + " did not exist!");
                return;
            }
        }
        // If they didn't provide -p, then try to use their selected portal
        if (selectedPortal == null) {
            selectedPortal = this.getUserSelectedPortal(player);
        }

        if (selectedPortal == null) {
            sender.sendMessage("You need to select a portal using " + ChatColor.AQUA + "/mvp select {NAME}");
            sender.sendMessage("or append " + ChatColor.DARK_AQUA + "-p {PORTAL}" + ChatColor.WHITE + " to this command.");
            return;
        } else {
            portalName = selectedPortal.getName();
        }

        if (portalName != null) {
            // Simply chop off the rest, if they have loc, that's good enough!
            if (SetProperties.valueOf(args.get(0)) == SetProperties.loc || SetProperties.valueOf(args.get(0)) == SetProperties.location) {
                this.setLocation(selectedPortal, player);
                return;
            }

            if (SetProperties.valueOf(args.get(0)) == SetProperties.dest || SetProperties.valueOf(args.get(0)) == SetProperties.destination) {
                if (args.get(1).equalsIgnoreCase("here")) {
                    PortalPlayerSession ps = this.plugin.getPortalSession(player);
                    MVPortal standingIn = ps.getUncachedStandingInPortal();
                    Location l = player.getLocation();
                    if (standingIn != null) {
                        String cardinal = LocationManipulation.getDirection(l);
                        args.set(1, "p:" + standingIn.getName() + ":" + cardinal);
                    } else {
                        args.set(1, "e:" + l.getWorld().getName() + ":" + l.getX() + "," + l.getY() + "," + l.getZ() + ":" + l.getPitch() + ":" + l.getYaw());
                    }
                } else if (args.get(1).matches("(i?)cannon-[\\d]+(\\.[\\d]+)?")) {
                    // We found a Cannon Destination!
View Full Code Here

Examples of com.onarandombox.MultiversePortals.MVPortal

        MultiverseRegion r = ps.getSelectedRegion();
        if (r == null) {
            return;
        }
        MVPortal portal = this.plugin.getPortalManager().getPortal(args.get(0));
        PortalLocation location = new PortalLocation(r.getMinimumPoint(), r.getMaximumPoint(), world);
        if (this.plugin.getPortalManager().addPortal(world, args.get(0), p.getName(), location)) {
            sender.sendMessage("New portal(" + ChatColor.DARK_AQUA + args.get(0) + ChatColor.WHITE + ") created and selected!");
            // If the portal did not exist, ie: we're creating it.
            // we have to re select it, because it would be null
            portal = this.plugin.getPortalManager().getPortal(args.get(0));

        } else {
            sender.sendMessage("New portal(" + ChatColor.DARK_AQUA + args.get(0) + ChatColor.WHITE + ") was NOT created!");
            sender.sendMessage("It already existed and has been selected.");
        }

        ps.selectPortal(portal);

        if (args.size() > 1 && portal != null) {
            String dest = args.get(1);
            if (dest.equalsIgnoreCase("here")) {
                MVPortal standingIn = ps.getUncachedStandingInPortal();
                if (standingIn != null) {
                    // If they're standing in a portal. treat it differently, niftily you might say...
                    String cardinal = LocationManipulation.getDirection(p.getLocation());
                    portal.setDestination("p:" + standingIn.getName() + ":" + cardinal);
                } else {
                    portal.setExactDestination(p.getLocation());
                }
            } else if (dest.matches("(i?)cannon-[\\d]+(\\.[\\d]+)?")) {
                // We found a Cannon Destination!
View Full Code Here

Examples of com.onarandombox.MultiversePortals.MVPortal

        if (!this.plugin.getCore().getMVPerms().hasPermission(p, "multiverse.portal.create", true)) {
            p.sendMessage("You need create permissions to do this!(multiverse.portal.create)");
            return;
        }
        if (args.size() == 0) {
            MVPortal selected = this.plugin.getPortalSession(p).getSelectedPortal();
            if (this.plugin.getPortalSession(p).getSelectedPortal() == null) {
                p.sendMessage("You have not selected a portal yet!");
                ItemStack wand = new ItemStack(this.plugin.getMainConfig().getInt("wand", MultiversePortals.DEFAULT_WAND));
                p.sendMessage("Use a " + ChatColor.GREEN + wand.getType() + ChatColor.WHITE + " to do so!");
                return;
            }
            p.sendMessage("You have selected: " + ChatColor.DARK_AQUA + selected.getName());
            return;
        }

        MVPortal selected = this.plugin.getPortalManager().getPortal(args.get(0));
        this.plugin.getPortalSession(p).selectPortal(selected);
        if (selected != null) {
            p.sendMessage("Portal: " + ChatColor.DARK_AQUA + selected.getName() + ChatColor.WHITE + " has been selected.");
        } else {
            p.sendMessage("Could not find portal: " + ChatColor.RED + args.get(0));
        }
    }
View Full Code Here

Examples of com.onarandombox.MultiversePortals.MVPortal

    }

    @Override
    public void runCommand(CommandSender sender, List<String> args) {
        if (this.plugin.getPortalManager().isPortal(args.get(0))) {
            MVPortal portal = this.plugin.getPortalManager().removePortal(args.get(0), true);
            sender.sendMessage("Portal " + ChatColor.DARK_AQUA + portal.getName() + ChatColor.WHITE + " was removed successfully!");
            return;
        }
        sender.sendMessage("The portal Portal " + ChatColor.DARK_AQUA + args.get(0) + ChatColor.WHITE + " does NOT exist!");
    }
View Full Code Here

Examples of com.onarandombox.MultiversePortals.MVPortal

        this.setPermission("multiverse.portal.info", "Displays information about a portal.", PermissionDefault.OP);
    }

    @Override
    public void runCommand(CommandSender sender, List<String> args) {
        MVPortal selected = this.plugin.getPortalManager().getPortal(args.get(0), sender);
        if(selected == null) {
            sender.sendMessage("Sorry! That portal doesn't exist or you're not allowed to use it!");
            return;
        }
        if(sender instanceof Player) {
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.