package me.bnjrKemal.org;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.StandardOpenOption;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONObject;
import org.omg.CORBA.Any;
import com.google.common.io.Files;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
public class Main extends JavaPlugin{
public JSONObject json = new JSONObject();
public Map<Location, ForTriple> map = new HashMap<>();
public final Gson gson = new GsonBuilder().setPrettyPrinting().create();
@SuppressWarnings("unchecked")
@Override
public void onEnable() {
configFile
= new File(getDataFolder
(),
"database.json");
if (!configFile.exists()) saveResource(configFile.getName(), false);
try {
map
= gson.
fromJson(new FileReader(configFile
),
new HashMap
<Location, ForTriple
>().
getClass());
e.printStackTrace();
}
Bukkit.getPluginManager().registerEvents(new PlaceOreBreakSP(this), this);
Bukkit.getPluginManager().registerEvents(new BreakOreBreakSP(this), this);
}
@Override
public void onDisable() {
final String json
= gson.
toJson(map
);
configFile.delete();
Files.write(configFile.toPath(), json.getBytes());
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}