/** * This method is here to provide a stopgap until the add/remove/clear methods are implemented with * SerializationConfig. */ public void validateEntitySpawns() { setAllowAnimalSpawn(canAnimalsSpawn()); setAllowMonsterSpawn(canMonstersSpawn()); }
/** * {@inheritDoc} * * @deprecated This is deprecated. */ @Override @Deprecated public boolean clearList(String property) { return clearVariable(property); }
@Override public void set(Difficulty newValue) { final World world = getCBWorld(); if (world != null) { world.setDifficulty(newValue); } }
Environment environment = oldWorld.getEnvironment(); String seedString = oldWorld.getSeed() + ""; WorldType worldType = oldWorld.getWorldType(); Boolean generateStructures = oldWorld.getCBWorld().canGenerateStructures(); String generator = oldWorld.getGenerator(); boolean useSpawnAdjust = oldWorld.getAdjustSpawn(); if (oldWorld != null && oldWorld.getCBWorld().isAutoSave()) { wasAutoSave = true; Logging.config("Saving world '%s'", oldName); oldWorld.getCBWorld().setAutoSave(false); oldWorld.getCBWorld().save(); oldWorld.getCBWorld().setAutoSave(true); newWorld.copyValues(this.worldsFromTheConfig.get(oldName)); newWorld.setAlias(null); return true;
@Override public SpawnSettings validateChange(String property, SpawnSettings newValue, SpawnSettings oldValue, MVWorld object) throws ChangeDeniedException { boolean allowMonsters, allowAnimals; if (getAnimalList().isEmpty()) { allowAnimals = canAnimalsSpawn(); } else { allowAnimals = true; } if (getMonsterList().isEmpty()) { allowMonsters = canMonstersSpawn(); } else { allowMonsters = true; } final World world = getCBWorld(); if (world != null) { if (MVWorld.this.props.getAnimalSpawnRate() != -1) { world.setTicksPerAnimalSpawns(MVWorld.this.props.getAnimalSpawnRate()); } if (MVWorld.this.props.getMonsterSpawnRate() != -1) { world.setTicksPerMonsterSpawns(MVWorld.this.props.getMonsterSpawnRate()); } world.setSpawnFlags(allowMonsters, allowAnimals); } if (MultiverseCoreConfiguration.getInstance().isAutoPurgeEnabled()) { plugin.getMVWorldManager().getTheWorldPurger().purgeWorld(MVWorld.this); } return super.validateChange(property, newValue, oldValue, object); } }
if (!this.getAdjustSpawn()) { this.plugin.log(Level.FINE, "Spawn location from world.dat file was unsafe!!"); this.plugin.log(Level.FINE, "NOT adjusting spawn for '" + this.getAlias() + "' because you told me not to."); 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; this.getName(), plugin.getLocationManipulation().locationToString(newSpawn)); return newSpawn; } else { if (newerSpawn != null) { Logging.info("New Spawn for '%s' is located at: %s", this.getName(), plugin.getLocationManipulation().locationToString(newerSpawn)); return newerSpawn; } else {
/** * Initializes permissions. */ private void initPerms() { this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.OP); // This guy is special. He shouldn't be added to any parent perms. this.ignoreperm = new Permission("mv.bypass.gamemode." + this.getName(), "Allows players with this permission to ignore gamemode changes.", PermissionDefault.FALSE); this.exempt = new Permission("multiverse.exempt." + this.getName(), "A player who has this does not pay to enter this world, or use any MV portals in it " + this.getName(), PermissionDefault.OP); this.limitbypassperm = new Permission("mv.bypass.playerlimit." + this.getName(), "A player who can enter this world regardless of wether its full", PermissionDefault.OP); try { this.plugin.getServer().getPluginManager().addPermission(this.permission); this.plugin.getServer().getPluginManager().addPermission(this.exempt); this.plugin.getServer().getPluginManager().addPermission(this.ignoreperm); this.plugin.getServer().getPluginManager().addPermission(this.limitbypassperm); // Add the permission and exempt to parents. this.addToUpperLists(this.permission); // Add ignore to it's parent: this.ignoreperm.addParent("mv.bypass.gamemode.*", true); // Add limit bypass to it's parent this.limitbypassperm.addParent("mv.bypass.playerlimit.*", true); } catch (IllegalArgumentException e) { this.plugin.log(Level.FINER, "Permissions nodes were already added for " + this.name); } }
mvWorld.copyValues((WorldProperties) obj);
return false; MVWorld world = new MVWorld(plugin, cbworld, mvworld); if (MultiverseCoreConfiguration.getInstance().isAutoPurgeEnabled()) { this.worldPurger.purgeWorld(world);
@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); } }
@Override public void set(Boolean newValue) { final World world = getCBWorld(); if (world != null) { world.setPVP(newValue); } }
@Override public Boolean get() { final World world = getCBWorld(); return world != null ? world.getKeepSpawnInMemory() : null; } };
@Override public Location get() { props.spawnLocation.setWorld(getCBWorld()); // basically, everybody should accept our "SpawnLocation", right? // so just returning it should be fine return props.spawnLocation; } };
@Override public Difficulty get() { final World world = getCBWorld(); return world != null ? world.getDifficulty() : null; } };
@Override public Boolean get() { final World world = getCBWorld(); return world != null ? world.getPVP() : null; } };
@Override public void set(Boolean newValue) { final World world = getCBWorld(); if (world != null) { world.setKeepSpawnInMemory(newValue); } }
@Override public void set(Long newValue) { final World world = getCBWorld(); if (world != null) { world.setTime(newValue); } }
@Override public Long get() { final World world = getCBWorld(); return world != null ? world.getTime() : null; } };
/** * {@inheritDoc} */ @Override public WorldType getWorldType() { // This variable is not settable in-game, therefore does not get a property. final World world = getCBWorld(); return world != null ? world.getWorldType() : null; }
@Override public void set(Location newValue) { if (getCBWorld() != null) getCBWorld().setSpawnLocation(newValue.getBlockX(), newValue.getBlockY(), newValue.getBlockZ()); props.spawnLocation = new SpawnLocation(newValue); }