use of org.bstats.bungeecord.MetricsLite in project SkinsRestorerX by DoNotSpamPls.
the class SkinsRestorer method onEnable.
@Override
public void onEnable() {
@SuppressWarnings("unused") MetricsLite metrics = new MetricsLite(this);
instance = this;
Config.load(getResourceAsStream("config.yml"));
Locale.load();
if (Config.USE_MYSQL) {
SkinStorage.init(mysql = new MySQL(Config.MYSQL_HOST, Config.MYSQL_PORT, Config.MYSQL_DATABASE, Config.MYSQL_USERNAME, Config.MYSQL_PASSWORD));
} else {
SkinStorage.init(getDataFolder());
}
getProxy().getPluginManager().registerListener(this, new LoginListener());
getProxy().getPluginManager().registerCommand(this, new AdminCommands());
getProxy().getPluginManager().registerCommand(this, new PlayerCommands());
getProxy().registerChannel("SkinsRestorer");
SkinApplier.init();
multibungee = Config.MULTIBUNGEE_ENABLED || ProxyServer.getInstance().getPluginManager().getPlugin("RedisBungee") != null;
ProxyServer.getInstance().getScheduler().runAsync(SkinsRestorer.getInstance(), () -> {
CommandSender console = getProxy().getConsole();
if (Config.UPDATER_ENABLED)
if (checkVersion(console).equals(getVersion())) {
outdated = false;
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a----------------------------------------------"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a +===============+"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a | SkinsRestorer |"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a +===============+"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a----------------------------------------------"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §b Current version: §a" + getVersion()));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a This is the latest version!"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a----------------------------------------------"));
} else {
outdated = true;
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a----------------------------------------------"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a +===============+"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a | SkinsRestorer |"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a +===============+"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a----------------------------------------------"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §b Current version: §c" + getVersion()));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §e A new version is available! Download it at:"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §e https://www.spigotmc.org/resources/skinsrestorer.2124"));
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §a----------------------------------------------"));
}
if (Config.DEFAULT_SKINS_ENABLED)
for (String skin : Config.DEFAULT_SKINS) try {
SkinStorage.setSkinData(skin, MojangAPI.getSkinProperty(MojangAPI.getUUID(skin)));
} catch (SkinRequestException e) {
if (SkinStorage.getSkinData(skin) == null)
console.sendMessage(new TextComponent("§e[§2SkinsRestorer§e] §cDefault Skin '" + skin + "' request error:" + e.getReason()));
}
});
}
Aggregations