Package com.onarandombox.MultiverseCore.api

Examples of com.onarandombox.MultiverseCore.api.MultiverseWorld


            sender.sendMessage(this.getCommandUsage());
            sender.sendMessage("Nothing changed.");
            return;
        }

        MultiverseWorld world;
        String property = args.get(0);

        if (args.size() == 1) {
            world = this.worldManager.getMVWorld(p.getWorld().getName());
        } else {
            world = this.worldManager.getMVWorld(args.get(1));
        }

        if (world == null) {
            sender.sendMessage("That world does not exist!");
            return;
        }

        if (!ModifyCommand.validateAction(Action.Clear, property)) {
            sender.sendMessage("Sorry, you can't use CLEAR with " + property);
            sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/cgB2B");
            return;
        }
        // TODO fix this
        if (world.clearList(property)) {
            sender.sendMessage(property + " was cleared. It contains 0 values now.");
            sender.sendMessage(ChatColor.GREEN + "Success! " + ChatColor.AQUA + property + ChatColor.WHITE + " was "
                    + ChatColor.GREEN + "CLEARED" + ChatColor.WHITE + ". It contains " + ChatColor.LIGHT_PURPLE + "0" + ChatColor.WHITE + " values now.");
            if (!plugin.saveWorldConfig()) {
                sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml!  Your changes will only be temporary!");
View Full Code Here


    @EventHandler
    public void weatherChange(WeatherChangeEvent event) {
        if (event.isCancelled()) {
            return;
        }
        MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getWorld().getName());
        if (world != null) {
            // If it's going to start raining and we have weather disabled
            event.setCancelled((event.toWeatherState() && !world.isWeatherEnabled()));
        }
    }
View Full Code Here

    @EventHandler
    public void thunderChange(ThunderChangeEvent event) {
        if (event.isCancelled()) {
            return;
        }
        MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getWorld().getName());
        if (world != null) {
            // If it's going to start raining and we have weather disabled
            event.setCancelled((event.toThunderState() && !world.isWeatherEnabled()));
        }
    }
View Full Code Here

            }
        }
    }

    private void spawnAccurately(Player player) {
        MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(player.getWorld().getName());
        Location spawnLocation;
        if (world != null) {
            spawnLocation = world.getSpawnLocation();
        } else {
            spawnLocation = player.getWorld().getSpawnLocation();
        }
        this.plugin.getSafeTTeleporter().safelyTeleport(player, player, spawnLocation, false);
    }
View Full Code Here

        if (args.size()  == 1) {
            if (args.get(0).equalsIgnoreCase("--all") || args.get(0).equalsIgnoreCase("-a")) {
                showAll = true;
            } else {
                // single world mode
                MultiverseWorld world = this.worldManager.getMVWorld(args.get(0));
                if (world == null) {
                    sender.sendMessage(ChatColor.RED + "That world does not exist.");
                    return;
                }

                if (!this.plugin.getMVPerms().canEnterWorld(p, world)) {
                    sender.sendMessage(ChatColor.RED + "You aren't allowed to access to this world!");
                    return;
                }

                sender.sendMessage(String.format("%s--- Players in %s%s ---", ChatColor.AQUA,
                        world.getColoredWorldString(), ChatColor.AQUA));
                sender.sendMessage(this.buildPlayerString(world, p, visiblePlayers));
                return;
            }
        }

        // multiworld mode
        sender.sendMessage(ChatColor.AQUA + "--- Worlds and their players --- "
                + visiblePlayers.size() + "/" + plugin.getServer().getMaxPlayers());
        boolean shownOne = false;
        for (MultiverseWorld world : this.worldManager.getMVWorlds()) {
            if (this.plugin.getMVPerms().canEnterWorld(p, world)) { // only show world if the player can access it
                if (showAll || !world.getCBWorld().getPlayers().isEmpty()) { // either show all or show if the world is not empty
                    sender.sendMessage(String.format("%s%s - %s", world.getColoredWorldString(), ChatColor.WHITE, buildPlayerString(world, p, visiblePlayers)));
                    shownOne = true;
                }
            }
        }
        if (!shownOne) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public MultiverseWorld getFirstSpawnWorld() {
        MultiverseWorld world = this.getMVWorld(this.firstSpawn);
        if (world == null) {
            // If the spawn world was unloaded, get the default world
            this.plugin.log(Level.WARNING, "The world specified as the spawn world (" + this.firstSpawn + ") did not exist!!");
            try {
                return this.getMVWorld(this.plugin.getServer().getWorlds().get(0));
View Full Code Here

    @Override
    public MultiverseWorld getMVWorld(String name) {
        if (name == null) {
            return null;
        }
        MultiverseWorld world = this.worlds.get(name);
        if (world != null) {
            return world;
        }
        return this.getMVWorldByAlias(name);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed) {
        MultiverseWorld world = this.getMVWorld(name);
        if (world == null)
            return false;

        List<Player> ps = world.getCBWorld().getPlayers();

        if (useNewSeed) {
            long theSeed;

            if (randomSeed) {
                theSeed = new Random().nextLong();
            } else {
                try {
                    theSeed = Long.parseLong(seed);
                } catch (NumberFormatException e) {
                    theSeed = seed.hashCode();
                }
            }

            world.setSeed(theSeed);
        }
        WorldType type = world.getWorldType();

        if (this.deleteWorld(name, false, false)) {
            this.doLoad(name, true, type);
            SafeTTeleporter teleporter = this.plugin.getSafeTTeleporter();
            Location newSpawn = world.getSpawnLocation();
            // Send all players that were in the old world, BACK to it!
            for (Player p : ps) {
                teleporter.safelyTeleport(null, p, newSpawn, true);
            }
            return true;
View Full Code Here

TOP

Related Classes of com.onarandombox.MultiverseCore.api.MultiverseWorld

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.