Package com.onarandombox.MultiverseCore.api

Examples of com.onarandombox.MultiverseCore.api.SafeTTeleporter


                this.plugin.log(Level.FINE, "To turn on spawn adjustment for this world simply type:");
                this.plugin.log(Level.FINE, "/mvm set adjustspawn true " + this.getAlias());
                return location;
            }
            // If it's not, find a better one.
            SafeTTeleporter teleporter = this.plugin.getSafeTTeleporter();
            this.plugin.log(Level.WARNING, "Spawn location from world.dat file was unsafe. Adjusting...");
            this.plugin.log(Level.WARNING, "Original Location: " + plugin.getLocationManipulation().strCoordsRaw(location));
            Location newSpawn = teleporter.getSafeLocation(location,
                    SPAWN_LOCATION_SEARCH_TOLERANCE, SPAWN_LOCATION_SEARCH_RADIUS);
            // I think we could also do this, as I think this is what Notch does.
            // Not sure how it will work in the nether...
            //Location newSpawn = this.spawnLocation.getWorld().getHighestBlockAt(this.spawnLocation).getLocation();
            if (newSpawn != null) {
View Full Code Here


                    return;
                }
                TravelAgent agent = new MVTravelAgent(this.plugin.getCore(), portalDest, event.getPlayer());
                event.setTo(portalDest.getLocation(event.getPlayer()));
                if (portalDest.useSafeTeleporter()) {
                    SafeTTeleporter teleporter = this.plugin.getCore().getSafeTTeleporter();
                    event.setTo(teleporter.getSafeLocation(event.getPlayer(), portalDest));
                }
                final Economy vaultEco = (portal.getCurrency() <= 0 && plugin.getCore().getVaultHandler().getEconomy() != null) ? plugin.getCore().getVaultHandler().getEconomy() : null;
                final GenericBank bank = vaultEco == null ? plugin.getCore().getBank() : null;
                boolean canAfford = false;
                boolean shouldPay = false;
View Full Code Here

    }

    void performTeleport(Player player, Location to, PortalPlayerSession ps, MVDestination d) {
        if (!plugin.getCore().getMVConfig().getEnforceAccess() || (d.getRequiredPermission() == null)
                || (d.getRequiredPermission().length() == 0) || player.hasPermission(d.getRequiredPermission())) {
            SafeTTeleporter playerTeleporter = this.plugin.getCore().getSafeTTeleporter();
            TeleportResult result = playerTeleporter.safelyTeleport(player, player, d);
            if (result == TeleportResult.SUCCESS) {
                ps.playerDidTeleport(to);
                ps.setTeleportTime(new Date());
                this.stateSuccess(player.getDisplayName(), d.getName());
                return;
View Full Code Here

    private Location getSafeLocation() {
        // At this time, these can never use the velocity.
        if (this.destination instanceof CannonDestination) {
            this.core.log(Level.FINE, "Using Stock TP method. This cannon will have 0 velocity");
        }
        SafeTTeleporter teleporter = this.core.getSafeTTeleporter();
        Location newLoc = this.destination.getLocation(this.player);
        if (this.destination.useSafeTeleporter()) {
            newLoc = teleporter.getSafeLocation(this.player, this.destination);
        }
        if (newLoc == null) {
            return this.player.getLocation();
        }
        return newLoc;
View Full Code Here

                if (!bs.playerCanSpawnHereSafely(newValue)) {
                    // it's not ==> find a better one!
                    plugin.log(Level.WARNING, String.format("Somebody tried to set the spawn location for '%s' to an unsafe value! Adjusting...", getAlias()));
                    plugin.log(Level.WARNING, "Old Location: " + plugin.getLocationManipulation().strCoordsRaw(oldValue));
                    plugin.log(Level.WARNING, "New (unsafe) Location: " + plugin.getLocationManipulation().strCoordsRaw(newValue));
                    SafeTTeleporter teleporter = plugin.getSafeTTeleporter();
                    newValue = teleporter.getSafeLocation(newValue, SPAWN_LOCATION_SEARCH_TOLERANCE, SPAWN_LOCATION_SEARCH_RADIUS);
                    if (newValue == null) {
                        plugin.log(Level.WARNING, "Couldn't fix the location. I have to abort the spawn location-change :/");
                        throw new ChangeDeniedException();
                    }
                    plugin.log(Level.WARNING, "New (safe) Location: " + plugin.getLocationManipulation().strCoordsRaw(newValue));
View Full Code Here

    public void removePlayersFromWorld(String name) {
        World w = this.plugin.getServer().getWorld(name);
        if (w != null) {
            World safeWorld = this.plugin.getServer().getWorlds().get(0);
            List<Player> ps = w.getPlayers();
            SafeTTeleporter teleporter = this.plugin.getSafeTTeleporter();
            for (Player p : ps) {
                // We're removing players forcefully from a world, they'd BETTER spawn safely.
                teleporter.safelyTeleport(null, p, safeWorld.getSpawnLocation(), true);
            }
        }
    }
View Full Code Here

        }
        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;
        }
        return false;
    }
View Full Code Here

TOP

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

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.