mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-10 18:28:28 +01:00
Add remaining world properties methods
This commit is contained in:
parent
35993419ca
commit
1f7b8ffa96
@ -1,9 +1,14 @@
|
||||
package com.onarandombox.MultiverseCore.worldnew;
|
||||
|
||||
import com.onarandombox.MultiverseCore.world.configuration.AllowedPortalType;
|
||||
import com.onarandombox.MultiverseCore.worldnew.config.WorldConfig;
|
||||
import io.vavr.control.Try;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OfflineWorld {
|
||||
|
||||
protected final String worldName;
|
||||
@ -18,23 +23,159 @@ public class OfflineWorld {
|
||||
return worldName;
|
||||
}
|
||||
|
||||
public Try<Object> getProperty(String name) {
|
||||
return worldConfig.getProperty(name);
|
||||
}
|
||||
|
||||
public Try<Void> setProperty(String name, Object value) {
|
||||
return worldConfig.setProperty(name, value);
|
||||
}
|
||||
|
||||
public Try<Object> getProperty(String name) {
|
||||
return worldConfig.getProperty(name);
|
||||
public boolean getAdjustSpawn() {
|
||||
return worldConfig.getAdjustSpawn();
|
||||
}
|
||||
|
||||
public Try<Void> setAdjustSpawn(boolean adjustSpawn) {
|
||||
return worldConfig.setAdjustSpawn(adjustSpawn);
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return worldConfig.getAlias();
|
||||
}
|
||||
|
||||
public Try<Void> setAlias(String alias) {
|
||||
return worldConfig.setAlias(alias);
|
||||
}
|
||||
|
||||
public boolean getAllowFlight() {
|
||||
return worldConfig.getAllowFlight();
|
||||
}
|
||||
|
||||
public Try<Void> setAllowFlight(boolean allowFlight) {
|
||||
return worldConfig.setAllowFlight(allowFlight);
|
||||
}
|
||||
|
||||
public boolean getAllowWeather() {
|
||||
return worldConfig.getAllowWeather();
|
||||
}
|
||||
|
||||
public Try<Void> setAllowWeather(boolean allowWeather) {
|
||||
return worldConfig.setAllowWeather(allowWeather);
|
||||
}
|
||||
|
||||
public boolean getAutoHeal() {
|
||||
return worldConfig.getAutoHeal();
|
||||
}
|
||||
|
||||
public Try<Void> setAutoHeal(boolean autoHeal) {
|
||||
return worldConfig.setAutoHeal(autoHeal);
|
||||
}
|
||||
|
||||
public boolean getAutoLoad() {
|
||||
return worldConfig.getAutoLoad();
|
||||
}
|
||||
|
||||
public Try<Void> setAutoLoad(boolean autoLoad) {
|
||||
return worldConfig.setAutoLoad(autoLoad);
|
||||
}
|
||||
|
||||
public Difficulty getDifficulty() {
|
||||
return worldConfig.getDifficulty();
|
||||
}
|
||||
|
||||
public Try<Void> setDifficulty(Difficulty difficulty) {
|
||||
return worldConfig.setDifficulty(difficulty);
|
||||
}
|
||||
|
||||
public World.Environment getEnvironment() {
|
||||
return worldConfig.getEnvironment();
|
||||
}
|
||||
|
||||
public GameMode getGameMode() {
|
||||
return worldConfig.getGameMode();
|
||||
}
|
||||
|
||||
public Try<Void> setGameMode(GameMode gameMode) {
|
||||
return worldConfig.setGameMode(gameMode);
|
||||
}
|
||||
|
||||
public String getGenerator() {
|
||||
return worldConfig.getGenerator();
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return worldConfig.isHidden();
|
||||
}
|
||||
|
||||
public Try<Void> setHidden(boolean hidden) {
|
||||
return worldConfig.setHidden(hidden);
|
||||
}
|
||||
|
||||
public boolean getHunger() {
|
||||
return worldConfig.getHunger();
|
||||
}
|
||||
|
||||
public Try<Void> setHunger(boolean hunger) {
|
||||
return worldConfig.setHunger(hunger);
|
||||
}
|
||||
|
||||
public boolean getKeepSpawnInMemory() {
|
||||
return worldConfig.getKeepSpawnInMemory();
|
||||
}
|
||||
|
||||
public Try<Void> setKeepSpawnInMemory(boolean keepSpawnInMemory) {
|
||||
return worldConfig.setKeepSpawnInMemory(keepSpawnInMemory);
|
||||
}
|
||||
|
||||
public int getPlayerLimit() {
|
||||
return worldConfig.getPlayerLimit();
|
||||
}
|
||||
|
||||
public Try<Void> setPlayerLimit(int playerLimit) {
|
||||
return worldConfig.setPlayerLimit(playerLimit);
|
||||
}
|
||||
|
||||
public AllowedPortalType getPortalForm() {
|
||||
return worldConfig.getPortalForm();
|
||||
}
|
||||
|
||||
public Try<Void> setPortalForm(AllowedPortalType portalForm) {
|
||||
return worldConfig.setPortalForm(portalForm);
|
||||
}
|
||||
|
||||
public boolean getPvp() {
|
||||
return worldConfig.getPvp();
|
||||
}
|
||||
|
||||
public Try<Void> setPvp(boolean pvp) {
|
||||
return worldConfig.setPvp(pvp);
|
||||
}
|
||||
|
||||
public String getRespawnWorld() {
|
||||
return worldConfig.getRespawnWorld();
|
||||
}
|
||||
|
||||
public Try<Void> setRespawnWorld(String respawnWorld) {
|
||||
return worldConfig.setRespawnWorld(respawnWorld);
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return worldConfig.getScale();
|
||||
}
|
||||
|
||||
public Try<Void> setScale(double scale) {
|
||||
return worldConfig.setScale(scale);
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return worldConfig.getSeed();
|
||||
}
|
||||
|
||||
public List<String> getWorldBlacklist() {
|
||||
return worldConfig.getWorldBlacklist();
|
||||
}
|
||||
|
||||
public Try<Void> setWorldBlacklist(List<String> worldBlacklist) {
|
||||
return worldConfig.setWorldBlacklist(worldBlacklist);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,11 @@ public class WorldManager {
|
||||
|
||||
public void initAllWorlds() {
|
||||
populateOfflineWorlds();
|
||||
getOfflineWorlds().forEach(this::loadWorld);
|
||||
getOfflineWorlds().forEach(offlineWorld -> {
|
||||
if (offlineWorld.getAutoLoad()) {
|
||||
loadWorld(offlineWorld);
|
||||
}
|
||||
});
|
||||
saveWorldsConfig();
|
||||
}
|
||||
|
||||
|
@ -111,11 +111,11 @@ public class WorldConfig {
|
||||
return configHandle.set(configNodes.ENVIRONMENT, environment);
|
||||
}
|
||||
|
||||
public GameMode getGamemode() {
|
||||
public GameMode getGameMode() {
|
||||
return configHandle.get(configNodes.GAMEMODE);
|
||||
}
|
||||
|
||||
public Try<Void> setGamemode(GameMode gamemode) {
|
||||
public Try<Void> setGameMode(GameMode gamemode) {
|
||||
return configHandle.set(configNodes.GAMEMODE, gamemode);
|
||||
}
|
||||
|
||||
@ -203,8 +203,8 @@ public class WorldConfig {
|
||||
return (List<String>) configHandle.get(configNodes.WORLD_BLACKLIST);
|
||||
}
|
||||
|
||||
public void setWorldBlacklist(List<String> worldBlacklist) {
|
||||
configHandle.set(configNodes.WORLD_BLACKLIST, worldBlacklist);
|
||||
public Try<Void> setWorldBlacklist(List<String> worldBlacklist) {
|
||||
return configHandle.set(configNodes.WORLD_BLACKLIST, worldBlacklist);
|
||||
}
|
||||
|
||||
public void setMVWorld(@NotNull MVWorld world) {
|
||||
|
Loading…
Reference in New Issue
Block a user