From 965ff2799746455c236b8089853a03f70baae5b2 Mon Sep 17 00:00:00 2001 From: CoderMarido Date: Wed, 12 Sep 2018 14:17:58 +0200 Subject: [PATCH] Updated to 6.0.1 (view the changelog on Spigot). --- .../deluxevouchers/handlers/SoundHandler.java | 12 +----- .../handlers/UpdateHandler.java | 43 +++++++++++-------- src/plugin.yml | 2 +- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/nl/marido/deluxevouchers/handlers/SoundHandler.java b/src/nl/marido/deluxevouchers/handlers/SoundHandler.java index 45ba367..f2efee6 100644 --- a/src/nl/marido/deluxevouchers/handlers/SoundHandler.java +++ b/src/nl/marido/deluxevouchers/handlers/SoundHandler.java @@ -3,8 +3,6 @@ package nl.marido.deluxevouchers.handlers; import org.bukkit.Sound; import org.bukkit.entity.Player; -import nl.marido.deluxevouchers.DeluxeVouchers; - public enum SoundHandler { AMBIENCE_CAVE("AMBIENCE_CAVE", "AMBIENT_CAVE"), @@ -224,14 +222,8 @@ public enum SoundHandler { public static void playSound(Player player, String sound, int pitch) { if (!sound.isEmpty()) { - try { - player.playSound(player.getLocation(), SoundHandler.valueOf(sound).bukkitSound(), Integer.MAX_VALUE, pitch); - } catch (Exception error) { - DeluxeVouchers.getConsole().sendMessage("§cFailed to play the sound " + sound + " for the player " + player.getName() + "."); - if (DataHandler.debugerrors) { - error.printStackTrace(); - } - } + player.playSound(player.getLocation(), SoundHandler.valueOf(sound).bukkitSound(), Integer.MAX_VALUE, pitch); + // TODO: Find an alternative for this to check errors. } } diff --git a/src/nl/marido/deluxevouchers/handlers/UpdateHandler.java b/src/nl/marido/deluxevouchers/handlers/UpdateHandler.java index 0bf4552..cab4c34 100644 --- a/src/nl/marido/deluxevouchers/handlers/UpdateHandler.java +++ b/src/nl/marido/deluxevouchers/handlers/UpdateHandler.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.scheduler.BukkitRunnable; import nl.marido.deluxevouchers.DeluxeVouchers; @@ -19,26 +20,30 @@ public class UpdateHandler implements Listener { public static void checker() { if (DataHandler.checkupdates) { - CommandSender console = DeluxeVouchers.getConsole(); - try { - URL checkurl = new URL("https://api.spigotmc.org/legacy/update.php?resource=52480"); - URLConnection connection = checkurl.openConnection(); - String latestversion = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); - String currentversion = DeluxeVouchers.getInstance().getDescription().getVersion(); - if (latestversion.equals(currentversion)) { - console.sendMessage("§fLatest version of DeluxeVouchers detected (" + currentversion + ")."); - oldversion = false; - } else { - console.sendMessage("§cOutdated version of DeluxeVouchers detected (" + currentversion + ")."); - console.sendMessage("§cDownload " + latestversion + ": https://spigotmc.org/resources/52480"); - oldversion = true; + new BukkitRunnable() { + public void run() { + CommandSender console = DeluxeVouchers.getConsole(); + try { + URL checkurl = new URL("https://api.spigotmc.org/legacy/update.php?resource=52480"); + URLConnection connection = checkurl.openConnection(); + String latestversion = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); + String currentversion = DeluxeVouchers.getInstance().getDescription().getVersion(); + if (latestversion.equals(currentversion)) { + console.sendMessage("§fLatest version of DeluxeVouchers detected (" + currentversion + ")."); + oldversion = false; + } else { + console.sendMessage("§cOutdated version of DeluxeVouchers detected (" + currentversion + ")."); + console.sendMessage("§cDownload " + latestversion + ": https://spigotmc.org/resources/52480"); + oldversion = true; + } + } catch (Exception error) { + console.sendMessage("§cFailed to create a connection with the updater host."); + if (DataHandler.debugerrors) { + error.printStackTrace(); + } + } } - } catch (Exception error) { - console.sendMessage("§cFailed to create a connection with the updater host."); - if (DataHandler.debugerrors) { - error.printStackTrace(); - } - } + }.runTaskAsynchronously(DeluxeVouchers.getInstance()); } } diff --git a/src/plugin.yml b/src/plugin.yml index baf34c4..ea6ba61 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: DeluxeVouchers main: nl.marido.deluxevouchers.DeluxeVouchers -version: 6.0.0 +version: 6.0.1 api-version: 1.13 author: Marido description: Enhance your server with awesome customizable vouchers with a lot of features.