mirror of
https://github.com/songoda/UltimateModeration.git
synced 2024-11-26 12:15:14 +01:00
Songoda Update
This commit is contained in:
parent
8c50bca689
commit
68a97c577a
@ -24,9 +24,11 @@ import com.songoda.ultimatemoderation.utils.Metrics;
|
||||
import com.songoda.ultimatemoderation.utils.ServerVersion;
|
||||
import com.songoda.ultimatemoderation.utils.SettingsManager;
|
||||
import com.songoda.ultimatemoderation.utils.gui.AbstractGUI;
|
||||
import com.songoda.ultimatemoderation.utils.updateModules.LocaleModule;
|
||||
import com.songoda.update.Plugin;
|
||||
import com.songoda.update.SongodaUpdate;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -60,7 +62,6 @@ public class UltimateModeration extends JavaPlugin {
|
||||
console.sendMessage(Methods.formatText("&a============================="));
|
||||
console.sendMessage(Methods.formatText("&7UltimateModeration " + this.getDescription().getVersion() + " by &5Songoda <3!"));
|
||||
console.sendMessage(Methods.formatText("&7Action: &aEnabling&7..."));
|
||||
console.sendMessage(Methods.formatText("&a============================="));
|
||||
|
||||
this.settingsManager = new SettingsManager(this);
|
||||
this.setupConfig();
|
||||
@ -71,6 +72,11 @@ public class UltimateModeration extends JavaPlugin {
|
||||
Locale.saveDefaultLocale("en_US");
|
||||
this.locale = Locale.getLocale(getConfig().getString("System.Language Mode", langMode));
|
||||
|
||||
//Running Songoda Updater
|
||||
Plugin plugin = new Plugin(this, 29);
|
||||
plugin.addModule(new LocaleModule());
|
||||
SongodaUpdate.load(plugin);
|
||||
|
||||
this.references = new References();
|
||||
|
||||
// Setup Managers
|
||||
@ -102,6 +108,7 @@ public class UltimateModeration extends JavaPlugin {
|
||||
|
||||
int timeout = SettingsManager.Setting.AUTOSAVE.getInt() * 60 * 20;
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> storage.doSave(), timeout, timeout);
|
||||
console.sendMessage(Methods.formatText("&a============================="));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,8 +15,8 @@ public class CommandSettings extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(UltimateModeration instance, CommandSender sender, String... args) {
|
||||
Player p = (Player) sender;
|
||||
instance.getSettingsManager().openSettingsManager(p);
|
||||
Player player = (Player) sender;
|
||||
instance.getSettingsManager().openSettingsManager(player);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,6 @@ public class SettingsManager implements Listener {
|
||||
DATABASE_USERNAME("Database.Username", "PUT_USERNAME_HERE"),
|
||||
DATABASE_PASSWORD("Database.Password", "PUT_PASSWORD_HERE"),
|
||||
|
||||
DOWNLOAD_FILES("System.Download Needed Data Files", true),
|
||||
LANGUGE_MODE("System.Language Mode", "en_US");
|
||||
|
||||
private String setting;
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.songoda.ultimatemoderation.utils.updateModules;
|
||||
|
||||
import com.songoda.ultimatemoderation.UltimateModeration;
|
||||
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();
|
||||
UltimateModeration.getInstance().getLocale().saveDefaultLocale(in, (String) file.get("name"));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
name: UltimateModeration
|
||||
description: UltimateModeration
|
||||
main: com.songoda.ultimatemoderation.UltimateModeration
|
||||
version: 1
|
||||
version: maven-version-number
|
||||
author: Songoda
|
||||
api-version: 1.13
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user