Json Stuff

This commit is contained in:
Paldiu 2021-03-26 12:47:33 -05:00
parent 3b8b9f715c
commit 81dbe3b234
3 changed files with 30 additions and 84 deletions

View File

@ -0,0 +1,10 @@
package io.github.simplexdev.api;
import io.github.simplexdev.api.func.Path;
import org.json.simple.JSONObject;
public interface IJson {
JSONObject getJSONObject(Path path);
}

View File

@ -16,7 +16,6 @@ import org.reflections.Reflections;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map;
import java.util.MissingResourceException; import java.util.MissingResourceException;
public final class CommandLoader { public final class CommandLoader {

View File

@ -1,96 +1,33 @@
package io.github.simplexdev.simplexcore.config; package io.github.simplexdev.simplexcore.config;
import io.github.simplexdev.api.IConfig; import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.github.simplexdev.api.IJson;
import io.github.simplexdev.api.func.Path; import io.github.simplexdev.api.func.Path;
import org.bukkit.configuration.ConfigurationSection; import io.github.simplexdev.simplexcore.module.SimplexModule;
import org.json.simple.JSONObject;
import java.util.List; public final class Json implements IJson {
public class Json implements IConfig {
// TODO: Write actual JSON implementations. // TODO: Write actual JSON implementations.
//
private final Gson gson;
private final SimplexModule<?> plugin;
@Override Json(SimplexModule<?> plugin) {
public void set(Path path, Object value) { this.gson = new GsonBuilder().setPrettyPrinting().create();
this.plugin = plugin;
}
final Gson getGson() {
return gson;
}
public final SimplexModule<?> getPlugin() {
return plugin;
} }
@Override @Override
public boolean contains(Path path) { public JSONObject getJSONObject(Path path) {
return false;
}
@Override
public ConfigurationSection getConfigurationSection(Path path) {
return null;
}
@Override
public List<String> getStringList(Path path) {
return null;
}
@Override
public long getLong(Path path) {
return 0;
}
@Override
public List<?> getList(Path path) {
return null;
}
@Override
public boolean getBoolean(Path path) {
return false;
}
@Override
public int getInt(Path path) {
return 0;
}
@Override
public double getDouble(Path path) {
return 0;
}
@Override
public String getString(Path path) {
return null;
}
@Override
public long getLong(Path path, long def) {
return 0;
}
@Override
public List<?> getList(Path path, List<?> def) {
return null;
}
@Override
public boolean getBoolean(Path path, boolean def) {
return false;
}
@Override
public int getInt(Path path, int def) {
return 0;
}
@Override
public double getDouble(Path path, double def) {
return 0;
}
@Override
public String getString(Path path, String def) {
return null;
}
@Override
public Object get(Path path, Object def) {
return null; return null;
} }
} }