Make config set methods return Try<Void>

This commit is contained in:
Ben Woo 2025-01-19 22:25:39 +08:00
parent d6a70bbb9b
commit b646937d23
3 changed files with 147 additions and 108 deletions

View File

@ -51,9 +51,10 @@ public interface MVCoreConfig {
* Sets world access permissions should be enforced. * Sets world access permissions should be enforced.
* *
* @param enforceAccess The new value. * @param enforceAccess The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setEnforceAccess(boolean enforceAccess); Try<Void> setEnforceAccess(boolean enforceAccess);
/** /**
* Gets enforceAccess. * Gets enforceAccess.
@ -67,9 +68,10 @@ public interface MVCoreConfig {
* Sets whether the game mode should be enforced. * Sets whether the game mode should be enforced.
* *
* @param enforceGameMode The new value. * @param enforceGameMode The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setEnforceGameMode(boolean enforceGameMode); Try<Void> setEnforceGameMode(boolean enforceGameMode);
/** /**
* Gets enforceGameMode value. * Gets enforceGameMode value.
@ -83,9 +85,10 @@ public interface MVCoreConfig {
* Sets whether or not the automatic purge of entities is enabled. * Sets whether or not the automatic purge of entities is enabled.
* *
* @param autopurge True if automatic purge should be enabled. * @param autopurge True if automatic purge should be enabled.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setAutoPurgeEntities(boolean autopurge); Try<Void> setAutoPurgeEntities(boolean autopurge);
/** /**
* Gets whether or not the automatic purge of entities is enabled. * Gets whether or not the automatic purge of entities is enabled.
@ -98,9 +101,10 @@ public interface MVCoreConfig {
* Sets whether to use finer teleport permissions. * Sets whether to use finer teleport permissions.
* *
* @param useFinerTeleportPermissions The new value * @param useFinerTeleportPermissions The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setUseFinerTeleportPermissions(boolean useFinerTeleportPermissions); Try<Void> setUseFinerTeleportPermissions(boolean useFinerTeleportPermissions);
/** /**
* Gets whether to use finer teleport permissions. * Gets whether to use finer teleport permissions.
@ -113,9 +117,10 @@ public interface MVCoreConfig {
* Sets the number of players allowed to teleport at once. * Sets the number of players allowed to teleport at once.
* *
* @param concurrentTeleportLimit The new value * @param concurrentTeleportLimit The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setConcurrentTeleportLimit(int concurrentTeleportLimit); Try<Void> setConcurrentTeleportLimit(int concurrentTeleportLimit);
/** /**
* Gets the number of players allowed to teleport at once. * Gets the number of players allowed to teleport at once.
@ -129,9 +134,10 @@ public interface MVCoreConfig {
* Sets teleportIntercept. * Sets teleportIntercept.
* *
* @param teleportIntercept The new value. * @param teleportIntercept The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setTeleportIntercept(boolean teleportIntercept); Try<Void> setTeleportIntercept(boolean teleportIntercept);
/** /**
* Gets teleportIntercept. * Gets teleportIntercept.
@ -141,36 +147,13 @@ public interface MVCoreConfig {
*/ */
boolean getTeleportIntercept(); boolean getTeleportIntercept();
/**
* Sets resolveAliasInCommands.
*
* @param resolveAliasInCommands The new value.
* @since 5.0
*/
void setResolveAliasName(boolean resolveAliasInCommands);
/**
* Gets resolveAliasInCommands.
*
* @return resolveAliasInCommands.
* @since 5.0
*/
boolean getResolveAliasName();
/**
* Sets firstSpawnOverride.
*
* @param firstSpawnOverride The new value.
* @since 5.0
*/
void setFirstSpawnOverride(boolean firstSpawnOverride);
/** /**
* Sets safeLocationHorizontalSearchRadius * Sets safeLocationHorizontalSearchRadius
* @param searchRadius The new value * @param searchRadius The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setSafeLocationHorizontalSearchRadius(int searchRadius); Try<Void> setSafeLocationHorizontalSearchRadius(int searchRadius);
/** /**
* Gets safeLocationHorizontalSearchRadius * Gets safeLocationHorizontalSearchRadius
@ -181,15 +164,30 @@ public interface MVCoreConfig {
int getSafeLocationHorizontalSearchRadius(); int getSafeLocationHorizontalSearchRadius();
/** /**
* Gets safeLocationVerticalSearchRadius * Sets safeLocationVerticalSearchRadius
* *
* @param searchRadius The new value * @param searchRadius The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setSafeLocationVerticalSearchRadius(int searchRadius); Try<Void> setSafeLocationVerticalSearchRadius(int searchRadius);
/**
* Gets safeLocationVerticalSearchRadius
*
* @return safeLocationVerticalSearchRadius
* @since 5.0
*/
int getSafeLocationVerticalSearchRadius(); int getSafeLocationVerticalSearchRadius();
/**
* Sets firstSpawnOverride.
*
* @param firstSpawnOverride The new value.
* @since 5.0
*/
Try<Void> setFirstSpawnOverride(boolean firstSpawnOverride);
/** /**
* Gets firstSpawnOverride. * Gets firstSpawnOverride.
* *
@ -202,9 +200,10 @@ public interface MVCoreConfig {
* Sets firstSpawnWorld. * Sets firstSpawnWorld.
* *
* @param firstSpawnWorld The new value. * @param firstSpawnWorld The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setFirstSpawnLocation(String firstSpawnWorld); Try<Void> setFirstSpawnLocation(String firstSpawnWorld);
/** /**
* Gets firstSpawnWorld. * Gets firstSpawnWorld.
@ -218,9 +217,10 @@ public interface MVCoreConfig {
* Sets whether join destination should be enabled. * Sets whether join destination should be enabled.
* *
* @param enableJoinDestination The new value * @param enableJoinDestination The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setEnableJoinDestination(boolean enableJoinDestination); Try<Void> setEnableJoinDestination(boolean enableJoinDestination);
/** /**
* Gets enableJoinDestination. * Gets enableJoinDestination.
@ -234,9 +234,10 @@ public interface MVCoreConfig {
* Sets alwaysSpawnDestination. * Sets alwaysSpawnDestination.
* *
* @param alwaysSpawnDestination The new value * @param alwaysSpawnDestination The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setJoinDestination(String alwaysSpawnDestination); Try<Void> setJoinDestination(String alwaysSpawnDestination);
/** /**
* Gets alwaysSpawnDestination. * Gets alwaysSpawnDestination.
@ -250,9 +251,10 @@ public interface MVCoreConfig {
* Sets defaultRespawnToWorldSpawn. * Sets defaultRespawnToWorldSpawn.
* *
* @param defaultRespawnToWorldSpawn The new value * @param defaultRespawnToWorldSpawn The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setDefaultRespawnWithinSameWorld(boolean defaultRespawnToWorldSpawn); Try<Void> setDefaultRespawnWithinSameWorld(boolean defaultRespawnToWorldSpawn);
/** /**
* Gets defaultRespawnToWorldSpawn * Gets defaultRespawnToWorldSpawn
@ -266,9 +268,10 @@ public interface MVCoreConfig {
* Sets enforceRespawnAtWorldSpawn * Sets enforceRespawnAtWorldSpawn
* *
* @param enforceRespawnAtWorldSpawn The new value * @param enforceRespawnAtWorldSpawn The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setEnforceRespawnAtWorldSpawn(boolean enforceRespawnAtWorldSpawn); Try<Void> setEnforceRespawnAtWorldSpawn(boolean enforceRespawnAtWorldSpawn);
/** /**
* Gets enforceRespawnAtWorldSpawn * Gets enforceRespawnAtWorldSpawn
@ -281,9 +284,10 @@ public interface MVCoreConfig {
* Sets whether or not to let Bukkit determine portal search radius on its own or if Multiverse should give input. * Sets whether or not to let Bukkit determine portal search radius on its own or if Multiverse should give input.
* *
* @param useDefaultPortalSearch True to let Bukkit determine portal search radius on its own. * @param useDefaultPortalSearch True to let Bukkit determine portal search radius on its own.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setUseCustomPortalSearch(boolean useDefaultPortalSearch); Try<Void> setUseCustomPortalSearch(boolean useDefaultPortalSearch);
/** /**
* Gets whether or not Bukkit will be determining portal search radius on its own or if Multiverse should help. * Gets whether or not Bukkit will be determining portal search radius on its own or if Multiverse should help.
@ -297,9 +301,10 @@ public interface MVCoreConfig {
* Sets the radius at which vanilla style portals will be searched for to connect to worlds together. * Sets the radius at which vanilla style portals will be searched for to connect to worlds together.
* *
* @param searchRadius The portal search radius. * @param searchRadius The portal search radius.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setCustomPortalSearchRadius(int searchRadius); Try<Void> setCustomPortalSearchRadius(int searchRadius);
/** /**
* Gets the radius at which vanilla style portals will be searched for to connect to worlds together. * Gets the radius at which vanilla style portals will be searched for to connect to worlds together.
@ -313,9 +318,10 @@ public interface MVCoreConfig {
* Sets prefixChat. * Sets prefixChat.
* *
* @param prefixChat The new value. * @param prefixChat The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setEnablePrefixChat(boolean prefixChat); Try<Void> setEnablePrefixChat(boolean prefixChat);
/** /**
* Gets prefixChat. * Gets prefixChat.
@ -329,9 +335,10 @@ public interface MVCoreConfig {
* Sets prefixChatFormat. * Sets prefixChatFormat.
* *
* @param prefixChatFormat The new value. * @param prefixChatFormat The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setPrefixChatFormat(String prefixChatFormat); Try<Void> setPrefixChatFormat(String prefixChatFormat);
/** /**
* Gets prefixChatFormat. * Gets prefixChatFormat.
@ -345,9 +352,10 @@ public interface MVCoreConfig {
* Sets whether to register with PlaceholderAPI plugin. * Sets whether to register with PlaceholderAPI plugin.
* *
* @param registerPapiHook The new value. * @param registerPapiHook The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setRegisterPapiHook(boolean registerPapiHook); Try<Void> setRegisterPapiHook(boolean registerPapiHook);
/** /**
* Gets whether to register with PlaceholderAPI plugin. * Gets whether to register with PlaceholderAPI plugin.
@ -361,9 +369,10 @@ public interface MVCoreConfig {
* Sets default locale used for messages * Sets default locale used for messages
* *
* @param defaultLocale The new value * @param defaultLocale The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setDefaultLocale(Locale defaultLocale); Try<Void> setDefaultLocale(Locale defaultLocale);
/** /**
* Gets default locale used for messages * Gets default locale used for messages
@ -377,9 +386,10 @@ public interface MVCoreConfig {
* Sets whether to use each player's client locale. * Sets whether to use each player's client locale.
* *
* @param perPlayerLocale the new value * @param perPlayerLocale the new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setPerPlayerLocale(boolean perPlayerLocale); Try<Void> setPerPlayerLocale(boolean perPlayerLocale);
/** /**
* Gets whether to use each player's client locale. * Gets whether to use each player's client locale.
@ -388,13 +398,30 @@ public interface MVCoreConfig {
*/ */
boolean getPerPlayerLocale(); boolean getPerPlayerLocale();
/**
* Sets resolveAliasInCommands.
*
* @param resolveAliasInCommands The new value.
* @since 5.0
*/
Try<Void> setResolveAliasName(boolean resolveAliasInCommands);
/**
* Gets resolveAliasInCommands.
*
* @return resolveAliasInCommands.
* @since 5.0
*/
boolean getResolveAliasName();
/** /**
* Sets the mode to use for confirming dangerous commands * Sets the mode to use for confirming dangerous commands
* *
* @param confirmMode The new value * @param confirmMode The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setConfirmMode(ConfirmMode confirmMode); Try<Void> setConfirmMode(ConfirmMode confirmMode);
/** /**
* Gets the mode to use for confirming dangerous commands * Gets the mode to use for confirming dangerous commands
@ -408,19 +435,27 @@ public interface MVCoreConfig {
* Sets whether to use confirm otp * Sets whether to use confirm otp
* *
* @param useConfirmOtp The new value * @param useConfirmOtp The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setUseConfirmOtp(boolean useConfirmOtp); Try<Void> setUseConfirmOtp(boolean useConfirmOtp);
/**
* Gets whether to use confirm otp
*
* @return useConfirmOtp
* @since 5.0
*/
boolean getUseConfirmOtp(); boolean getUseConfirmOtp();
/** /**
* Sets globalDebug. * Sets globalDebug.
* *
* @param globalDebug The new value. * @param globalDebug The new value.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setGlobalDebug(int globalDebug); Try<Void> setGlobalDebug(int globalDebug);
/** /**
* Gets globalDebug. * Gets globalDebug.
@ -434,9 +469,10 @@ public interface MVCoreConfig {
* Sets debugPermissions * Sets debugPermissions
* *
* @param debugPermissions The new value * @param debugPermissions The new value
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setDebugPermissions(boolean debugPermissions); Try<Void> setDebugPermissions(boolean debugPermissions);
/** /**
* gets debugPermissions. * gets debugPermissions.
@ -450,9 +486,10 @@ public interface MVCoreConfig {
* Sets whether to suppress startup messages. * Sets whether to suppress startup messages.
* *
* @param silentStart true to suppress messages. * @param silentStart true to suppress messages.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setSilentStart(boolean silentStart); Try<Void> setSilentStart(boolean silentStart);
/** /**
* Whether we are suppressing startup messages. * Whether we are suppressing startup messages.
@ -466,9 +503,10 @@ public interface MVCoreConfig {
* Sets whether or not the donation/patreon messages are shown. * Sets whether or not the donation/patreon messages are shown.
* *
* @param showDonateMessage True if donation/patreon messages should be shown. * @param showDonateMessage True if donation/patreon messages should be shown.
* @return Result of setting property.
* @since 5.0 * @since 5.0
*/ */
void setShowDonateMessage(boolean showDonateMessage); Try<Void> setShowDonateMessage(boolean showDonateMessage);
/** /**
* Gets whether or not the donation/patreon messages are shown. * Gets whether or not the donation/patreon messages are shown.

View File

@ -141,8 +141,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setEnforceAccess(boolean enforceAccess) { public Try<Void> setEnforceAccess(boolean enforceAccess) {
configHandle.set(configNodes.ENFORCE_ACCESS, enforceAccess); return configHandle.set(configNodes.ENFORCE_ACCESS, enforceAccess);
} }
/** /**
@ -157,8 +157,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setEnforceGameMode(boolean enforceGameMode) { public Try<Void> setEnforceGameMode(boolean enforceGameMode) {
configHandle.set(configNodes.ENFORCE_GAMEMODE, enforceGameMode); return configHandle.set(configNodes.ENFORCE_GAMEMODE, enforceGameMode);
} }
/** /**
@ -173,8 +173,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setAutoPurgeEntities(boolean autopurge) { public Try<Void> setAutoPurgeEntities(boolean autopurge) {
configHandle.set(configNodes.AUTO_PURGE_ENTITIES, autopurge); return configHandle.set(configNodes.AUTO_PURGE_ENTITIES, autopurge);
} }
/** /**
@ -189,8 +189,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setUseFinerTeleportPermissions(boolean useFinerTeleportPermissions) { public Try<Void> setUseFinerTeleportPermissions(boolean useFinerTeleportPermissions) {
configHandle.set(configNodes.USE_FINER_TELEPORT_PERMISSIONS, useFinerTeleportPermissions); return configHandle.set(configNodes.USE_FINER_TELEPORT_PERMISSIONS, useFinerTeleportPermissions);
} }
/** /**
@ -205,8 +205,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setConcurrentTeleportLimit(int concurrentTeleportLimit) { public Try<Void> setConcurrentTeleportLimit(int concurrentTeleportLimit) {
configHandle.set(configNodes.CONCURRENT_TELEPORT_LIMIT, concurrentTeleportLimit); return configHandle.set(configNodes.CONCURRENT_TELEPORT_LIMIT, concurrentTeleportLimit);
} }
/** /**
@ -221,8 +221,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setTeleportIntercept(boolean teleportIntercept) { public Try<Void> setTeleportIntercept(boolean teleportIntercept) {
configHandle.set(configNodes.TELEPORT_INTERCEPT, teleportIntercept); return configHandle.set(configNodes.TELEPORT_INTERCEPT, teleportIntercept);
} }
/** /**
@ -237,16 +237,16 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setFirstSpawnOverride(boolean firstSpawnOverride) { public Try<Void> setFirstSpawnOverride(boolean firstSpawnOverride) {
configHandle.set(configNodes.FIRST_SPAWN_OVERRIDE, firstSpawnOverride); return configHandle.set(configNodes.FIRST_SPAWN_OVERRIDE, firstSpawnOverride);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setSafeLocationHorizontalSearchRadius(int searchRadius) { public Try<Void> setSafeLocationHorizontalSearchRadius(int searchRadius) {
configHandle.set(configNodes.SAFE_LOCATION_HORIZONTAL_SEARCH_RADIUS, searchRadius); return configHandle.set(configNodes.SAFE_LOCATION_HORIZONTAL_SEARCH_RADIUS, searchRadius);
} }
/** /**
@ -261,8 +261,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setSafeLocationVerticalSearchRadius(int searchRadius) { public Try<Void> setSafeLocationVerticalSearchRadius(int searchRadius) {
configHandle.set(configNodes.SAFE_LOCATION_VERTICAL_SEARCH_RADIUS, searchRadius); return configHandle.set(configNodes.SAFE_LOCATION_VERTICAL_SEARCH_RADIUS, searchRadius);
} }
/** /**
@ -285,8 +285,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setFirstSpawnLocation(String firstSpawnWorld) { public Try<Void> setFirstSpawnLocation(String firstSpawnWorld) {
configHandle.set(configNodes.FIRST_SPAWN_LOCATION, firstSpawnWorld); return configHandle.set(configNodes.FIRST_SPAWN_LOCATION, firstSpawnWorld);
} }
/** /**
@ -301,8 +301,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setEnableJoinDestination(boolean enableJoinDestination) { public Try<Void> setEnableJoinDestination(boolean enableJoinDestination) {
configHandle.set(configNodes.ENABLE_JOIN_DESTINATION, enableJoinDestination); return configHandle.set(configNodes.ENABLE_JOIN_DESTINATION, enableJoinDestination);
} }
/** /**
@ -317,8 +317,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setJoinDestination(String alwaysSpawnDestination) { public Try<Void> setJoinDestination(String alwaysSpawnDestination) {
configHandle.set(configNodes.JOIN_DESTINATION, alwaysSpawnDestination); return configHandle.set(configNodes.JOIN_DESTINATION, alwaysSpawnDestination);
} }
/** /**
@ -333,8 +333,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setDefaultRespawnWithinSameWorld(boolean defaultRespawnToWorldSpawn) { public Try<Void> setDefaultRespawnWithinSameWorld(boolean defaultRespawnToWorldSpawn) {
configHandle.set(configNodes.DEFAULT_RESPAWN_WITHIN_SAME_WORLD, defaultRespawnToWorldSpawn); return configHandle.set(configNodes.DEFAULT_RESPAWN_WITHIN_SAME_WORLD, defaultRespawnToWorldSpawn);
} }
/** /**
@ -349,8 +349,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setEnforceRespawnAtWorldSpawn(boolean enforceRespawnAtWorldSpawn) { public Try<Void> setEnforceRespawnAtWorldSpawn(boolean enforceRespawnAtWorldSpawn) {
configHandle.set(configNodes.ENFORCE_RESPAWN_AT_WORLD_SPAWN, enforceRespawnAtWorldSpawn); return configHandle.set(configNodes.ENFORCE_RESPAWN_AT_WORLD_SPAWN, enforceRespawnAtWorldSpawn);
} }
/** /**
@ -365,8 +365,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setUseCustomPortalSearch(boolean useDefaultPortalSearch) { public Try<Void> setUseCustomPortalSearch(boolean useDefaultPortalSearch) {
configHandle.set(configNodes.USE_CUSTOM_PORTAL_SEARCH, useDefaultPortalSearch); return configHandle.set(configNodes.USE_CUSTOM_PORTAL_SEARCH, useDefaultPortalSearch);
} }
/** /**
@ -381,8 +381,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setCustomPortalSearchRadius(int searchRadius) { public Try<Void> setCustomPortalSearchRadius(int searchRadius) {
configHandle.set(configNodes.CUSTOM_PORTAL_SEARCH_RADIUS, searchRadius); return configHandle.set(configNodes.CUSTOM_PORTAL_SEARCH_RADIUS, searchRadius);
} }
/** /**
@ -397,8 +397,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setEnablePrefixChat(boolean prefixChat) { public Try<Void> setEnablePrefixChat(boolean prefixChat) {
configHandle.set(configNodes.ENABLE_CHAT_PREFIX, prefixChat); return configHandle.set(configNodes.ENABLE_CHAT_PREFIX, prefixChat);
} }
/** /**
@ -413,8 +413,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setPrefixChatFormat(String prefixChatFormat) { public Try<Void> setPrefixChatFormat(String prefixChatFormat) {
configHandle.set(configNodes.CHAT_PREFIX_FORMAT, prefixChatFormat); return configHandle.set(configNodes.CHAT_PREFIX_FORMAT, prefixChatFormat);
} }
/** /**
@ -429,8 +429,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setRegisterPapiHook(boolean registerPapiHook) { public Try<Void> setRegisterPapiHook(boolean registerPapiHook) {
configHandle.set(configNodes.REGISTER_PAPI_HOOK, registerPapiHook); return configHandle.set(configNodes.REGISTER_PAPI_HOOK, registerPapiHook);
} }
/** /**
@ -445,8 +445,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setDefaultLocale(Locale defaultLocale) { public Try<Void> setDefaultLocale(Locale defaultLocale) {
configHandle.set(configNodes.DEFAULT_LOCALE, defaultLocale); return configHandle.set(configNodes.DEFAULT_LOCALE, defaultLocale);
} }
/** /**
@ -461,8 +461,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setPerPlayerLocale(boolean perPlayerLocale) { public Try<Void> setPerPlayerLocale(boolean perPlayerLocale) {
configHandle.set(configNodes.PER_PLAYER_LOCALE, perPlayerLocale); return configHandle.set(configNodes.PER_PLAYER_LOCALE, perPlayerLocale);
} }
/** /**
@ -477,8 +477,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setResolveAliasName(boolean resolveAliasInCommands) { public Try<Void> setResolveAliasName(boolean resolveAliasInCommands) {
configHandle.set(configNodes.RESOLVE_ALIAS_NAME, resolveAliasInCommands); return configHandle.set(configNodes.RESOLVE_ALIAS_NAME, resolveAliasInCommands);
} }
/** /**
@ -493,8 +493,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setConfirmMode(ConfirmMode confirmMode) { public Try<Void> setConfirmMode(ConfirmMode confirmMode) {
configHandle.set(configNodes.CONFIRM_MODE, confirmMode); return configHandle.set(configNodes.CONFIRM_MODE, confirmMode);
} }
/** /**
@ -509,8 +509,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setUseConfirmOtp(boolean useConfirmOtp) { public Try<Void> setUseConfirmOtp(boolean useConfirmOtp) {
configHandle.set(configNodes.USE_CONFIRM_OTP, useConfirmOtp); return configHandle.set(configNodes.USE_CONFIRM_OTP, useConfirmOtp);
} }
/** /**
@ -525,8 +525,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setGlobalDebug(int globalDebug) { public Try<Void> setGlobalDebug(int globalDebug) {
configHandle.set(configNodes.GLOBAL_DEBUG, globalDebug); return configHandle.set(configNodes.GLOBAL_DEBUG, globalDebug);
} }
/** /**
@ -541,8 +541,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setDebugPermissions(boolean debugPermissions) { public Try<Void> setDebugPermissions(boolean debugPermissions) {
configHandle.set(configNodes.DEBUG_PERMISSIONS, debugPermissions); return configHandle.set(configNodes.DEBUG_PERMISSIONS, debugPermissions);
} }
/** /**
@ -557,8 +557,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setSilentStart(boolean silentStart) { public Try<Void> setSilentStart(boolean silentStart) {
configHandle.set(configNodes.SILENT_START, silentStart); return configHandle.set(configNodes.SILENT_START, silentStart);
} }
/** /**
@ -573,8 +573,8 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setShowDonateMessage(boolean showDonateMessage) { public Try<Void> setShowDonateMessage(boolean showDonateMessage) {
configHandle.set(configNodes.SHOW_DONATION_MESSAGE, showDonateMessage); return configHandle.set(configNodes.SHOW_DONATION_MESSAGE, showDonateMessage);
} }
/** /**
@ -587,6 +587,7 @@ public class SimpleMVCoreConfig implements MVCoreConfig {
/** /**
* Gets the underlying config file object * Gets the underlying config file object
*
* @return The config file * @return The config file
*/ */
public FileConfiguration getConfig() { public FileConfiguration getConfig() {

View File

@ -17,7 +17,7 @@ class RegenCommandTest : AbstractCommandTest() {
// Disable confirmation to make tests easier // Disable confirmation to make tests easier
val config = serviceLocator.getActiveService(SimpleMVCoreConfig::class.java).takeIf { it != null } ?: run { val config = serviceLocator.getActiveService(SimpleMVCoreConfig::class.java).takeIf { it != null } ?: run {
throw IllegalStateException("MVCoreConfig is not available as a service") } throw IllegalStateException("MVCoreConfig is not available as a service") }
config.confirmMode = ConfirmMode.DISABLE assertTrue(config.setConfirmMode(ConfirmMode.DISABLE).isSuccess)
testWorld = worldManager.createWorld(CreateWorldOptions.worldName("test")).get() testWorld = worldManager.createWorld(CreateWorldOptions.worldName("test")).get()
} }