Finished refactoring update checker

This commit is contained in:
Auxilor 2020-11-27 13:00:03 +00:00
parent e848de746f
commit 08e387238c

View File

@ -2,6 +2,7 @@ package com.willfp.ecoenchants.listeners;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.config.ConfigManager;
import com.willfp.ecoenchants.util.UpdateChecker;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
@ -9,10 +10,10 @@ import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerJoinListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
if (EcoEnchantsPlugin.outdated) {
if (UpdateChecker.isOutdated()) {
if (event.getPlayer().hasPermission("ecoenchants.updateannounce")) {
event.getPlayer().sendMessage(ConfigManager.getLang().getMessage("outdated").replace("%ver%", EcoEnchantsPlugin.getInstance().getDescription().getVersion())
.replace("%newver%", EcoEnchantsPlugin.newVersion));
.replace("%newver%", UpdateChecker.getNewVersion()));
}
}
}