Add docs to new migration classes

This commit is contained in:
Ben Woo 2023-09-10 12:23:20 +08:00
parent c61c98ff5e
commit b2ed43ba22
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8
2 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,9 @@ import co.aikar.commands.ACFUtil;
import com.dumptruckman.minecraft.util.Logging;
import org.bukkit.configuration.ConfigurationSection;
/**
* Single migrator action that converts a string value to a long.
*/
public class LongMigratorAction implements MigratorAction {
public static LongMigratorAction of(String path) {
@ -16,6 +19,9 @@ public class LongMigratorAction implements MigratorAction {
this.path = path;
}
/**
* {@inheritDoc}
*/
@Override
public void migrate(ConfigurationSection config) {
config.set(path, ACFUtil.parseLong(config.getString(path)));

View File

@ -3,6 +3,9 @@ package com.onarandombox.MultiverseCore.configuration.migration;
import com.dumptruckman.minecraft.util.Logging;
import org.bukkit.configuration.ConfigurationSection;
/**
* Single migrator action changes a string value of "null" to an empty string.
*/
public class NullStringMigratorAction implements MigratorAction {
public static NullStringMigratorAction of(String path) {
@ -15,6 +18,9 @@ public class NullStringMigratorAction implements MigratorAction {
this.path = path;
}
/**
* {@inheritDoc}
*/
@Override
public void migrate(ConfigurationSection config) {
config.set(path, "null".equals(config.getString(path)) ? "" : config.getString(path));