Fixed json config and moved to 1.14.4
This commit is contained in:
parent
c10ea55d7e
commit
9e38c52f73
4 changed files with 136 additions and 121 deletions
|
@ -23,7 +23,7 @@
|
|||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -33,6 +33,7 @@
|
|||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
|
@ -50,6 +51,12 @@
|
|||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.github.cryptomorin.</pattern>
|
||||
<shadedPattern>nl.iobyte.thirdparty.com.github.cryptomorin.</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -65,7 +72,7 @@
|
|||
</repository>
|
||||
<repository>
|
||||
<id>onarandombox</id>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
<url>https://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>MG-Dev Jenkins CI Maven Repository</id>
|
||||
|
@ -80,94 +87,44 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>commons-lang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>gson</artifactId>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<groupId>org.yaml</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<groupId>net.md-5</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.9</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>annotations</artifactId>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-bungeecord</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-viaversion</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-facet</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bergerkiller.bukkit</groupId>
|
||||
<artifactId>TrainCarts</artifactId>
|
||||
<version>1.16.5-v1</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>LightAPI-fork</artifactId>
|
||||
<groupId>io.github.qveshn</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>SmoothCoastersAPI</artifactId>
|
||||
<groupId>me.m56738</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>cloud-paper</artifactId>
|
||||
<groupId>org.bergerhealer.cloud.commandframework</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>cloud-annotations</artifactId>
|
||||
<groupId>org.bergerhealer.cloud.commandframework</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>cloud-minecraft-extras</artifactId>
|
||||
<groupId>org.bergerhealer.cloud.commandframework</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commodore</artifactId>
|
||||
<groupId>me.lucko</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<groupId>net.kyori</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bergerkiller.bukkit</groupId>
|
||||
<artifactId>BKCommonLib</artifactId>
|
||||
<version>1.16.5-v1</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>Mountiplex</artifactId>
|
||||
<groupId>com.bergerkiller.mountiplex</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
|
@ -186,44 +143,6 @@
|
|||
<artifactId>worldedit-core</artifactId>
|
||||
<version>6.1.4-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>truezip</artifactId>
|
||||
<groupId>de.schlichtherle</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>js</artifactId>
|
||||
<groupId>rhino</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>paranamer</artifactId>
|
||||
<groupId>com.thoughtworks.paranamer</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jlibnoise</artifactId>
|
||||
<groupId>com.sk89q.lib</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jchronic</artifactId>
|
||||
<groupId>com.sk89q</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<groupId>org.yaml</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>gson</artifactId>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
|
|
37
pom.xml
37
pom.xml
|
@ -25,7 +25,7 @@
|
|||
</repository>
|
||||
<repository>
|
||||
<id>onarandombox</id>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
<url>https://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>MG-Dev Jenkins CI Maven Repository</id>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<dependency>
|
||||
<groupId>nl.iobyte</groupId>
|
||||
<artifactId>menuapi</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
|
@ -66,14 +66,22 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dumptruckman.minecraft</groupId>
|
||||
<artifactId>JsonConfiguration</artifactId>
|
||||
<version>1.1</version>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-bungeecord</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minidev</groupId>
|
||||
<artifactId>json-smart</artifactId>
|
||||
<version>2.4.7</version>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-viaversion</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-facet</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bergerkiller.bukkit</groupId>
|
||||
|
@ -90,7 +98,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.cryptomorin</groupId>
|
||||
<artifactId>XSeries</artifactId>
|
||||
<version>8.4.0</version>
|
||||
<version>8.5.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
|
@ -133,8 +141,9 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.2.4</version>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
|
@ -152,6 +161,12 @@
|
|||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.github.cryptomorin.</pattern>
|
||||
<shadedPattern>nl.iobyte.thirdparty.com.github.cryptomorin.</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package nl.iobyte.themepark.api.config.objects;
|
||||
|
||||
import com.dumptruckman.bukkit.configuration.json.JsonConfiguration;
|
||||
import nl.iobyte.themepark.logger.ThemeParkLogger;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
package nl.iobyte.themepark.api.config.objects;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class JsonConfiguration extends FileConfiguration {
|
||||
|
||||
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String saveToString() {
|
||||
return gson.toJson(this.map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFromString(@NotNull String contents) throws InvalidConfigurationException {
|
||||
Validate.notNull(contents, "Contents cannot be null");
|
||||
|
||||
Map input;
|
||||
try {
|
||||
input = this.gson.fromJson(contents, Map.class);
|
||||
} catch (YAMLException var4) {
|
||||
throw new InvalidConfigurationException(var4);
|
||||
} catch (ClassCastException var5) {
|
||||
throw new InvalidConfigurationException("Top level is not a Map.");
|
||||
}
|
||||
|
||||
if (input != null) {
|
||||
this.convertMapsToSections(input, this);
|
||||
}
|
||||
}
|
||||
|
||||
protected void convertMapsToSections(@NotNull Map<?, ?> input, @NotNull ConfigurationSection section) {
|
||||
for (Map.Entry<?, ?> entry : input.entrySet()) {
|
||||
String key = entry.getKey().toString();
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof Map) {
|
||||
this.convertMapsToSections((Map) value, section.createSection(key));
|
||||
} else {
|
||||
section.set(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String buildHeader() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static YamlConfiguration loadConfiguration(@NotNull File file) {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
|
||||
try {
|
||||
config.load(file);
|
||||
} catch (IOException | InvalidConfigurationException var4) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, var4);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue