use of com.archyx.aureliumskills.util.version.UpdateChecker in project AureliumSkills by Archy-X.
the class AureliumSkills method checkUpdates.
public void checkUpdates() {
// Check for updates
if (!OptionL.getBoolean(Option.CHECK_FOR_UPDATES))
return;
new UpdateChecker(this, 81069).getVersion(version -> {
if (!this.getDescription().getVersion().contains("Pre-Release") && !this.getDescription().getVersion().contains("Build")) {
if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
getLogger().info("New update available! You are on version " + this.getDescription().getVersion() + ", latest version is " + version);
getLogger().info("Download it on Spigot:");
getLogger().info("https://spigotmc.org/resources/81069");
}
} else {
getLogger().info("You are on an in development version of the plugin, plugin may be buggy or unstable!");
getLogger().info("Report any bugs to the support discord server or submit an issue here: https://github.com/Archy-X/AureliumSkills/issues");
}
});
}
use of com.archyx.aureliumskills.util.version.UpdateChecker in project AureliumSkills by Archy-X.
the class SkillsCommand method onVersion.
@Subcommand("version")
@CommandPermission("aureliumskills.version")
public void onVersion(CommandSender sender) {
Locale locale = plugin.getLang().getLocale(sender);
new UpdateChecker(plugin, 81069).getVersion(latestVersion -> sender.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.VERSION, locale), "{current_version}", plugin.getDescription().getVersion(), "{latest_version}", latestVersion)));
}
use of com.archyx.aureliumskills.util.version.UpdateChecker in project AureliumSkills by Archy-X.
the class PlayerJoinQuit method onPlayerJoin.
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
PlayerManager playerManager = plugin.getPlayerManager();
if (plugin.getStorageProvider() instanceof MySqlStorageProvider) {
// Handles MySQL storage
if (OptionL.getBoolean(Option.MYSQL_ALWAYS_LOAD_ON_JOIN) || playerManager.getPlayerData(player) == null) {
int loadDelay = OptionL.getInt(Option.MYSQL_LOAD_DELAY);
if (loadDelay == 0) {
// Load immediately
loadPlayerDataAsync(player);
} else {
// Delay loading
new BukkitRunnable() {
@Override
public void run() {
loadPlayerDataAsync(player);
}
}.runTaskLater(plugin, loadDelay);
}
}
} else {
// Yaml storage
if (playerManager.getPlayerData(player) == null) {
loadPlayerDataAsync(player);
}
}
// Load player skull
Location playerLoc = player.getLocation();
Location loc = new Location(playerLoc.getWorld(), playerLoc.getX(), 0, playerLoc.getZ());
Block b = loc.getBlock();
if (!(b.getState() instanceof InventoryHolder)) {
BlockState state = b.getState();
SkullCreator.blockWithUuid(b, player.getUniqueId());
state.update(true);
}
// Update message
if (OptionL.getBoolean(Option.CHECK_FOR_UPDATES) && player.hasPermission("aureliumskills.checkupdates")) {
if (System.currentTimeMillis() > ReleaseData.RELEASE_TIME + 21600000L) {
// Check for updates
new UpdateChecker(plugin, 81069).getVersion(version -> {
if (!plugin.getDescription().getVersion().contains("Pre-Release") && !plugin.getDescription().getVersion().contains("Build")) {
if (!plugin.getDescription().getVersion().equalsIgnoreCase(version)) {
player.sendMessage(AureliumSkills.getPrefix(Lang.getDefaultLanguage()) + ChatColor.WHITE + "New update available! You are on version " + ChatColor.AQUA + plugin.getDescription().getVersion() + ChatColor.WHITE + ", latest version is " + ChatColor.AQUA + version);
player.sendMessage(AureliumSkills.getPrefix(Lang.getDefaultLanguage()) + ChatColor.WHITE + "Download it on Spigot: " + ChatColor.YELLOW + "" + ChatColor.UNDERLINE + "https://spigotmc.org/resources/81069");
}
}
});
}
}
}
Aggregations