3
0
Fork 0

Fixed json config and moved to 1.14.4

This commit is contained in:
thomas 2022-01-08 13:13:03 +01:00
parent c10ea55d7e
commit 9e38c52f73
4 changed files with 136 additions and 121 deletions

View file

@ -23,7 +23,7 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version> <version>3.2.4</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -33,6 +33,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<minimizeJar>true</minimizeJar>
<filters> <filters>
<filter> <filter>
<artifact>*:*</artifact> <artifact>*:*</artifact>
@ -50,6 +51,12 @@
</excludes> </excludes>
</filter> </filter>
</filters> </filters>
<relocations>
<relocation>
<pattern>com.github.cryptomorin.</pattern>
<shadedPattern>nl.iobyte.thirdparty.com.github.cryptomorin.</shadedPattern>
</relocation>
</relocations>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@ -65,7 +72,7 @@
</repository> </repository>
<repository> <repository>
<id>onarandombox</id> <id>onarandombox</id>
<url>http://repo.onarandombox.com/content/groups/public</url> <url>https://repo.onarandombox.com/content/groups/public</url>
</repository> </repository>
<repository> <repository>
<id>MG-Dev Jenkins CI Maven Repository</id> <id>MG-Dev Jenkins CI Maven Repository</id>
@ -80,94 +87,44 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version> <version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope> <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>
<dependency> <dependency>
<groupId>me.clip</groupId> <groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId> <artifactId>placeholderapi</artifactId>
<version>2.10.9</version> <version>2.10.9</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> </dependency>
<exclusion> <dependency>
<artifactId>annotations</artifactId> <groupId>net.kyori</groupId>
<groupId>org.jetbrains</groupId> <artifactId>adventure-text-serializer-bungeecord</artifactId>
</exclusion> <version>4.0.1</version>
</exclusions> <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>
<dependency> <dependency>
<groupId>com.bergerkiller.bukkit</groupId> <groupId>com.bergerkiller.bukkit</groupId>
<artifactId>TrainCarts</artifactId> <artifactId>TrainCarts</artifactId>
<version>1.16.5-v1</version> <version>1.16.5-v1</version>
<scope>provided</scope> <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>
<dependency> <dependency>
<groupId>com.bergerkiller.bukkit</groupId> <groupId>com.bergerkiller.bukkit</groupId>
<artifactId>BKCommonLib</artifactId> <artifactId>BKCommonLib</artifactId>
<version>1.16.5-v1</version> <version>1.16.5-v1</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>Mountiplex</artifactId>
<groupId>com.bergerkiller.mountiplex</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sk89q.worldguard</groupId> <groupId>com.sk89q.worldguard</groupId>
@ -186,44 +143,6 @@
<artifactId>worldedit-core</artifactId> <artifactId>worldedit-core</artifactId>
<version>6.1.4-SNAPSHOT</version> <version>6.1.4-SNAPSHOT</version>
<scope>provided</scope> <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> </dependency>
</dependencies> </dependencies>
<properties> <properties>

37
pom.xml
View file

@ -25,7 +25,7 @@
</repository> </repository>
<repository> <repository>
<id>onarandombox</id> <id>onarandombox</id>
<url>http://repo.onarandombox.com/content/groups/public</url> <url>https://repo.onarandombox.com/content/groups/public</url>
</repository> </repository>
<repository> <repository>
<id>MG-Dev Jenkins CI Maven Repository</id> <id>MG-Dev Jenkins CI Maven Repository</id>
@ -41,7 +41,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version> <version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -52,7 +52,7 @@
<dependency> <dependency>
<groupId>nl.iobyte</groupId> <groupId>nl.iobyte</groupId>
<artifactId>menuapi</artifactId> <artifactId>menuapi</artifactId>
<version>1.0</version> <version>1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
@ -66,14 +66,22 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.dumptruckman.minecraft</groupId> <groupId>net.kyori</groupId>
<artifactId>JsonConfiguration</artifactId> <artifactId>adventure-text-serializer-bungeecord</artifactId>
<version>1.1</version> <version>4.0.1</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.minidev</groupId> <groupId>net.kyori</groupId>
<artifactId>json-smart</artifactId> <artifactId>adventure-platform-viaversion</artifactId>
<version>2.4.7</version> <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>
<dependency> <dependency>
<groupId>com.bergerkiller.bukkit</groupId> <groupId>com.bergerkiller.bukkit</groupId>
@ -90,7 +98,7 @@
<dependency> <dependency>
<groupId>com.github.cryptomorin</groupId> <groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId> <artifactId>XSeries</artifactId>
<version>8.4.0</version> <version>8.5.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sk89q.worldguard</groupId> <groupId>com.sk89q.worldguard</groupId>
@ -133,8 +141,9 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version> <version>3.2.4</version>
<configuration> <configuration>
<minimizeJar>true</minimizeJar>
<filters> <filters>
<filter> <filter>
<artifact>*:*</artifact> <artifact>*:*</artifact>
@ -152,6 +161,12 @@
</excludes> </excludes>
</filter> </filter>
</filters> </filters>
<relocations>
<relocation>
<pattern>com.github.cryptomorin.</pattern>
<shadedPattern>nl.iobyte.thirdparty.com.github.cryptomorin.</shadedPattern>
</relocation>
</relocations>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>

View file

@ -1,6 +1,5 @@
package nl.iobyte.themepark.api.config.objects; package nl.iobyte.themepark.api.config.objects;
import com.dumptruckman.bukkit.configuration.json.JsonConfiguration;
import nl.iobyte.themepark.logger.ThemeParkLogger; import nl.iobyte.themepark.logger.ThemeParkLogger;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;

View file

@ -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;
}
}