Examples of ChangeDeniedException


Examples of me.main__.util.SerializationConfig.ChangeDeniedException

        @Override
        public Double validateChange(String property, Double newValue, Double oldValue,
                MVWorld object) throws ChangeDeniedException {
            if (newValue <= 0) {
                plugin.log(Level.FINE, "Someone tried to set a scale <= 0, aborting!");
                throw new ChangeDeniedException();
            }
            return super.validateChange(property, newValue, oldValue, object);
        }
View Full Code Here

Examples of me.main__.util.SerializationConfig.ChangeDeniedException

    private final class RespawnWorldPropertyValidator extends WorldPropertyValidator<String> {
        @Override
        public String validateChange(String property, String newValue, String oldValue,
                MVWorld object) throws ChangeDeniedException {
            if (!newValue.isEmpty() && !plugin.getMVWorldManager().isMVWorld(newValue))
                throw new ChangeDeniedException();
            return super.validateChange(property, newValue, oldValue, object);
        }
View Full Code Here

Examples of me.main__.util.SerializationConfig.ChangeDeniedException

    private final class SpawnLocationPropertyValidator extends WorldPropertyValidator<Location> {
        @Override
        public Location validateChange(String property, Location newValue, Location oldValue,
                MVWorld object) throws ChangeDeniedException {
            if (newValue == null)
                throw new ChangeDeniedException();
            if (props.getAdjustSpawn()) {
                BlockSafety bs = plugin.getBlockSafety();
                // verify that the location is safe
                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));
                }
            }
            return super.validateChange(property, newValue, oldValue, object);
View Full Code Here

Examples of me.main__.util.SerializationConfig.ChangeDeniedException

    @Override
    public T validateChange(String property, T newValue, T oldValue, MVWorld object) throws ChangeDeniedException {
        MVWorldPropertyChangeEvent<T> event = new MVWorldPropertyChangeEvent<T>(object, null, property, newValue);
        Bukkit.getPluginManager().callEvent(event);
        if (event.isCancelled())
            throw new ChangeDeniedException();
        return event.getTheNewValue();
    }
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.