Implemented content based syncing

This commit is contained in:
Frank 2021-08-15 13:55:31 +02:00
parent f80b55aa50
commit 5df6de1e3a
7 changed files with 194 additions and 49 deletions

View file

@ -1,6 +1,8 @@
package ru.bclib.config;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import ru.bclib.util.Pair;
import java.util.Arrays;
@ -84,4 +86,15 @@ public class ConfigKey {
throw new IndexOutOfBoundsException("Config key must be not empty!");
}
}
public static Pair<String, String> realKey(@NotNull String key) {
String[] parts = key.split("\\[default:", 2);
if (parts.length == 1) {
return new Pair(parts[0].trim(), "");
}
else if (parts.length == 2) {
return new Pair(parts[0].trim(), " " + ("[default:" + parts[1]).trim());
}
return new Pair(key, "");
}
}