From c03c44252a4f842afa9cc460caaa066592f4551e Mon Sep 17 00:00:00 2001 From: William278 Date: Sat, 6 Feb 2021 16:11:10 +0000 Subject: [PATCH] Sounds are now stored as sounds rather than strings in Settings --- .../me/william278/huskhomes2/Objects/Settings.java | 13 +++++++------ .../me/william278/huskhomes2/runEverySecond.java | 2 +- .../me/william278/huskhomes2/teleportManager.java | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/william278/huskhomes2/Objects/Settings.java b/src/main/java/me/william278/huskhomes2/Objects/Settings.java index 93d64f80..9f8c68c7 100644 --- a/src/main/java/me/william278/huskhomes2/Objects/Settings.java +++ b/src/main/java/me/william278/huskhomes2/Objects/Settings.java @@ -2,6 +2,7 @@ package me.william278.huskhomes2.Objects; import me.william278.huskhomes2.HuskHomes; import org.bukkit.Bukkit; +import org.bukkit.Sound; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; @@ -54,8 +55,8 @@ public class Settings { int teleportWarmupTime; // Sounds - String teleportationCompleteSound; - String teleportWarmupSound; + Sound teleportationCompleteSound; + Sound teleportWarmupSound; // Number of items per page on lists int privateHomesPerPage; @@ -134,8 +135,8 @@ public class Settings { this.publicHomeCost = configFile.getDouble("economy_integration.costs.make_home_public"); this.rtpCost = configFile.getDouble("economy_integration.costs.random_teleport"); - this.teleportationCompleteSound = configFile.getString("general.sounds.teleportation_complete"); - this.teleportWarmupSound = configFile.getString("general.sounds.teleportation_warmup"); + this.teleportationCompleteSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_complete")); + this.teleportWarmupSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_warmup")); this.checkVanishedPlayers = configFile.getBoolean("handle_vanished_players"); @@ -316,11 +317,11 @@ public class Settings { return warpsPerPage; } - public String getTeleportationCompleteSound() { + public Sound getTeleportationCompleteSound() { return teleportationCompleteSound; } - public String getTeleportWarmupSound() { + public Sound getTeleportWarmupSound() { return teleportWarmupSound; } } diff --git a/src/main/java/me/william278/huskhomes2/runEverySecond.java b/src/main/java/me/william278/huskhomes2/runEverySecond.java index e980d28c..d6b2a167 100644 --- a/src/main/java/me/william278/huskhomes2/runEverySecond.java +++ b/src/main/java/me/william278/huskhomes2/runEverySecond.java @@ -53,7 +53,7 @@ public class runEverySecond { if (timedTeleport.getTimeRemaining() > 0) { if (!timedTeleport.hasMoved(teleporter)) { if (!timedTeleport.hasLostHealth(teleporter)) { - teleporter.playSound(teleporter.getLocation(), Sound.valueOf(HuskHomes.settings.getTeleportWarmupSound()), 2, 1); + teleporter.playSound(teleporter.getLocation(), HuskHomes.settings.getTeleportWarmupSound(), 2, 1); messageManager.sendActionBarMessage(teleporter, "teleporting_action_bar_countdown", Integer.toString(timedTeleport.getTimeRemaining())); timedTeleport.decrementTimeRemaining(); diff --git a/src/main/java/me/william278/huskhomes2/teleportManager.java b/src/main/java/me/william278/huskhomes2/teleportManager.java index 41c6ac3c..63c9c300 100644 --- a/src/main/java/me/william278/huskhomes2/teleportManager.java +++ b/src/main/java/me/william278/huskhomes2/teleportManager.java @@ -34,7 +34,7 @@ public class teleportManager { String server = teleportationPoint.getServer(); if (!HuskHomes.settings.doBungee() || server.equals(HuskHomes.settings.getServerID())) { p.teleport(teleportationPoint.getLocation()); - p.playSound(p.getLocation(), Sound.valueOf(HuskHomes.settings.getTeleportationCompleteSound()), 1, 1); + p.playSound(p.getLocation(), HuskHomes.settings.getTeleportationCompleteSound(), 1, 1); messageManager.sendMessage(p, "teleporting_complete"); dataManager.setPlayerTeleporting(p, false); dataManager.clearPlayerDestination(p.getName());