Package com.onarandombox.MultiversePortals.utils

Examples of com.onarandombox.MultiversePortals.utils.MultiverseRegion


                l.getBlockX(), l.getBlockY(), l.getBlockZ()));

        // Limit the search to the portal's region, extended by 1 block.
        boolean frameValid = false;
        {
            MultiverseRegion r = getLocation().getRegion();
            int useX = (r.getWidth()  == 1) ? 0 : 1;
            int useY = (r.getHeight() == 1) ? 0 : 1;
            int useZ = (r.getDepth()  == 1) ? 0 : 1;

            // Search for a frame in each of the portal's "flat" (size 1)
            // dimensions. If a portal's size is greater than 1 in all three
            // dimensions, an invalid frame will be reported.
View Full Code Here


    private MultiverseRegion expandedRegion(MultiverseRegion r, int x, int y, int z) {
        Vector min = new Vector().copy(r.getMinimumPoint());
        Vector max = new Vector().copy(r.getMaximumPoint());
        min.add(new Vector(-x, -y, -z));
        max.add(new Vector( x,  y,  z));
        return new MultiverseRegion(min, max, r.getWorld());
    }
View Full Code Here

        return selectedPortal.setProperty(property, value);
    }

    private void setLocation(MVPortal selectedPortal, Player player) {
        PortalPlayerSession ps = this.plugin.getPortalSession(player);
        MultiverseRegion r = ps.getSelectedRegion();
        if (r != null) {
            MultiverseWorld world = this.plugin.getCore().getMVWorldManager().getMVWorld(player.getWorld().getName());
            PortalLocation location = new PortalLocation(r.getMinimumPoint(), r.getMaximumPoint(), world);
            selectedPortal.setPortalLocation(location);
            player.sendMessage("Portal location has been set to your " + ChatColor.GREEN + "selection" + ChatColor.WHITE + "!");
        }
    }
View Full Code Here

        if (v1 == null || v2 == null || world == null) {
            this.validLocation = false;
            this.region = null;
        } else {
            this.validLocation = true;
            this.region = new MultiverseRegion(v1, v2, world);
        }
        return this.validLocation;
    }
View Full Code Here

        }
        MultiverseWorld world = this.plugin.getCore().getMVWorldManager().getMVWorld(p.getWorld().getName());

        PortalPlayerSession ps = this.plugin.getPortalSession(p);

        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));
View Full Code Here

        }
        this.leftClick = v;
        this.leftClickWorld = world;
        String message = ChatColor.AQUA + "First position set to: (" + v.getBlockX() + ", " + v.getBlockY() + ", " + v.getBlockZ() + ")";
        if (this.leftClickWorld == this.rightClickWorld && this.rightClick != null) {
            MultiverseRegion tempReg = new MultiverseRegion(this.leftClick, this.rightClick, this.leftClickWorld);
            message += ChatColor.GOLD + " (" + tempReg.getArea() + " blocks)";
        }
        this.getPlayerFromName().sendMessage(message);
        return true;
    }
View Full Code Here

        }
        this.rightClick = v;
        this.rightClickWorld = world;
        String message = ChatColor.AQUA + "Second position set to: (" + v.getBlockX() + ", " + v.getBlockY() + ", " + v.getBlockZ() + ")";
        if (this.leftClickWorld == this.rightClickWorld && this.leftClick != null) {
            MultiverseRegion tempReg = new MultiverseRegion(this.leftClick, this.rightClick, this.leftClickWorld);
            message += ChatColor.GOLD + " (" + tempReg.getArea() + " blocks)";
        }
        this.getPlayerFromName().sendMessage(message);
        return true;

    }
View Full Code Here

    }

    public MultiverseRegion getSelectedRegion() {
        // Did not find WE
        MultiverseRegion r = null;
        if (this.plugin.getWEAPI() != null) {
            System.out.println("WEAPI");
            try {
                // GAH this looks SO ugly keeping no imports :( see if I can find a workaround
                r = new MultiverseRegion(this.plugin.getWEAPI().getSession(this.getPlayerFromName()).getSelection(this.plugin.getWEAPI().getSession(this.getPlayerFromName()).getSelectionWorld()).getMinimumPoint(),
                        this.plugin.getWEAPI().getSession(this.getPlayerFromName()).getSelection(this.plugin.getWEAPI().getSession(this.getPlayerFromName()).getSelectionWorld()).getMaximumPoint(),
                        this.plugin.getCore().getMVWorldManager().getMVWorld(this.getPlayerFromName().getWorld().getName()));
            } catch (Exception e) {
                this.getPlayerFromName().sendMessage("You haven't finished your selection.");
                return null;
            }
            return r;
        }
        // They're using our crappy selection:
        if (this.leftClick == null) {
            this.getPlayerFromName().sendMessage("You need to LEFT click on a block with your wand!");
            return null;
        }
        if (this.rightClick == null) {
            this.getPlayerFromName().sendMessage("You need to RIGHT click on a block with your wand!");
            return null;
        }
        if (!this.leftClickWorld.equals(this.rightClickWorld)) {
            this.getPlayerFromName().sendMessage("You need to select both coords in the same world!");
            this.getPlayerFromName().sendMessage("Left Click Position was in:" + this.leftClickWorld.getColoredWorldString());
            this.getPlayerFromName().sendMessage("Right Click Position was in:" + this.rightClickWorld.getColoredWorldString());
            return null;
        }
        return new MultiverseRegion(this.leftClick, this.rightClick, this.leftClickWorld);
    }
View Full Code Here

TOP

Related Classes of com.onarandombox.MultiversePortals.utils.MultiverseRegion

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.