Added JSON support

This commit is contained in:
Auxilor
2021-06-15 11:02:21 +01:00
parent 50f57abd6c
commit 3f446f6072
3 changed files with 1 additions and 61 deletions

View File

@@ -14,7 +14,6 @@ import com.willfp.eco.proxy.proxies.BlockBreakProxy;
import com.willfp.eco.proxy.proxies.SkullProxy;
import com.willfp.eco.proxy.proxies.TridentStackProxy;
import com.willfp.eco.spigot.config.DataYml;
import com.willfp.eco.spigot.config.TestJson;
import com.willfp.eco.spigot.display.PacketAutoRecipe;
import com.willfp.eco.spigot.display.PacketChat;
import com.willfp.eco.spigot.display.PacketOpenWindowMerchant;
@@ -65,8 +64,6 @@ public class EcoSpigotPlugin extends EcoPlugin {
*/
private final DataYml dataYml;
private final TestJson testJson;
/**
* Create a new instance of eco.
*/
@@ -86,8 +83,6 @@ public class EcoSpigotPlugin extends EcoPlugin {
this.dataYml = new DataYml(this);
Data.init(this.dataYml);
this.testJson = new TestJson(this);
}
@Override
@@ -99,7 +94,6 @@ public class EcoSpigotPlugin extends EcoPlugin {
public void disable() {
try {
Data.save(this.dataYml);
testJson.save();
} catch (IOException e) {
e.printStackTrace();
}
@@ -117,7 +111,7 @@ public class EcoSpigotPlugin extends EcoPlugin {
@Override
public void postLoad() {
this.getLogger().info(testJson.get("quiz.sport.q1.options").toString());
}
@Override

View File

@@ -1,16 +0,0 @@
package com.willfp.eco.spigot.config;
import com.willfp.eco.core.config.JsonStaticBaseConfig;
import com.willfp.eco.spigot.EcoSpigotPlugin;
import org.jetbrains.annotations.NotNull;
public class TestJson extends JsonStaticBaseConfig {
/**
* Init data.yml.
*
* @param plugin EcoSpigotPlugin.
*/
public TestJson(@NotNull final EcoSpigotPlugin plugin) {
super("test", plugin);
}
}

View File

@@ -1,38 +0,0 @@
{
"quiz": {
"sport": {
"q1": {
"question": "Which one is correct team name in NBA?",
"options": [
"New York Bulls",
"Los Angeles Kings",
"Golden State Warriros",
"Huston Rocket"
],
"answer": "Huston Rocket"
}
},
"maths": {
"q1": {
"question": "5 + 7 = ?",
"options": [
"10",
"11",
"12",
"13"
],
"answer": "12"
},
"q2": {
"question": "12 - 8 = ?",
"options": [
"1",
"2",
"3",
"4"
],
"answer": "4"
}
}
}
}