Package org.bukkit.map

Examples of org.bukkit.map.MapView


        dB.report(scriptEntry, getName(), (id != null ? id.debug() : "") + (create != null ? create.debug() : "")
                + (reset != null ? reset.debug() : "") + (image != null ? image.debug() : "") + resize.debug()
                + (text != null ? text.debug() : "") + x.debug() + y.debug());

        MapView map = null;
        if (create != null) {
            map = Bukkit.getServer().createMap(create.getWorld());
            scriptEntry.addObject("created_map", new Element(map.getId()));
        }
        else if (id != null) {
            map = Bukkit.getServer().getMap((short) id.asInt());
            if (map == null)
                throw new CommandExecutionException("No map found for ID '" + id.asInt() + "'!");
        }
        else {
            throw new CommandExecutionException("The map command failed somehow! Report this to a developer!");
        }

        if (reset != null) {
            for (MapRenderer renderer : map.getRenderers()) {
                if (renderer instanceof DenizenMapRenderer) {
                    map.removeRenderer(renderer);
                    for (MapRenderer oldRenderer : ((DenizenMapRenderer) renderer).getOldRenderers())
                        map.addRenderer(oldRenderer);
                    map.setCenterX(reset.getBlockX());
                    map.setCenterZ(reset.getBlockZ());
                    map.setWorld(reset.getWorld());
                }
            }
        }
        else {
            DenizenMapRenderer dmr = null;
            List<MapRenderer> oldRendererList = map.getRenderers();
            for (MapRenderer renderer : oldRendererList) {
                if (!(renderer instanceof DenizenMapRenderer) || dmr != null)
                    map.removeRenderer(renderer);
                else
                    dmr = (DenizenMapRenderer) renderer;
            }
            if (dmr == null) {
                dmr = new DenizenMapRenderer(oldRendererList);
                map.addRenderer(dmr);
            }
            if (image != null)
                dmr.addImage(x.asInt(), y.asInt(), new File(DenizenAPI.getCurrentInstance().getDataFolder(),
                        image.asString()).getPath(), resize.asBoolean());
            else if (text != null)
View Full Code Here


        // Forces a player to receive the entirety of the specified map ID instantly.
        // @tags
        // None
        // -->
        if (mechanism.matches("send_map") && mechanism.requireInteger()) {
            MapView map = Bukkit.getServer().getMap((short) value.asInt());
            if (map != null)
                getPlayerEntity().sendMap(map);
            else
                dB.echoError("No map found for ID " + value.asInt() + "!");
        }
View Full Code Here

        for (final Player player : Bukkit.getOnlinePlayers()) {
            if ((player.getItemInHand().getType() == Material.MAP
                    || player.getItemInHand().getType() == Material.EMPTY_MAP)
                    && player.getItemInHand().getDurability() == event.getMap().getId()) {
                final Location playerLoc = player.getLocation();
                final MapView map = event.getMap();
                map.setCenterX(playerLoc.getBlockX());
                map.setCenterZ(playerLoc.getBlockZ());
                map.setWorld(playerLoc.getWorld());
                return;
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.bukkit.map.MapView

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.