mirror of
https://github.com/songoda/EpicVouchers.git
synced 2025-03-13 06:59:31 +01:00
33 lines
997 B
Java
33 lines
997 B
Java
package com.songoda.epicvouchers.utils.updateModules;
|
|
|
|
import com.songoda.epicvouchers.EpicVouchers;
|
|
import com.songoda.update.Module;
|
|
import com.songoda.update.Plugin;
|
|
import org.json.simple.JSONArray;
|
|
import org.json.simple.JSONObject;
|
|
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.net.URL;
|
|
|
|
public class LocaleModule implements Module {
|
|
|
|
@Override
|
|
public void run(Plugin plugin) {
|
|
JSONObject json = plugin.getJson();
|
|
try {
|
|
JSONArray files = (JSONArray) json.get("neededFiles");
|
|
for (Object o : files) {
|
|
JSONObject file = (JSONObject) o;
|
|
|
|
if (file.get("type").equals("locale")) {
|
|
InputStream in = new URL((String) file.get("link")).openStream();
|
|
EpicVouchers.getInstance().getLocale().saveDefaultLocale(in, (String) file.get("name"));
|
|
}
|
|
}
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|