@Override public void set(Difficulty newValue) { final World world = getCBWorld(); if (world != null) { world.setDifficulty(newValue); } }
@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(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 void set(Location newValue) { if (getCBWorld() != null) getCBWorld().setSpawnLocation(newValue.getBlockX(), newValue.getBlockY(), newValue.getBlockZ()); props.spawnLocation = new SpawnLocation(newValue); }
@Override public Boolean validateChange(String property, Boolean newValue, Boolean oldValue, MVWorld object) throws ChangeDeniedException { if (!newValue) { final World world = getCBWorld(); if (world != null) { world.setStorm(false); world.setThundering(false); } } return super.validateChange(property, newValue, oldValue, object); } }
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);
@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); } }