Sounds are now stored as sounds rather than strings in Settings

This commit is contained in:
William278 committed 2021-02-06 16:11:10 +00:00
1 parent 7fef1b7356
commit c03c44252a
3 files changed
+9 -8

No files matched your search

@@ -2,6 +2,7 @@ package me.william278.huskhomes2.Objects;
import me.william278.huskhomes2.HuskHomes; import me.william278.huskhomes2.HuskHomes;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@@ -54,8 +55,8 @@ public class Settings {
int teleportWarmupTime; int teleportWarmupTime;
// Sounds // Sounds
String teleportationCompleteSound; Sound teleportationCompleteSound;
String teleportWarmupSound; Sound teleportWarmupSound;
// Number of items per page on lists // Number of items per page on lists
int privateHomesPerPage; int privateHomesPerPage;
@@ -134,8 +135,8 @@ public class Settings {
this.publicHomeCost = configFile.getDouble("economy_integration.costs.make_home_public"); this.publicHomeCost = configFile.getDouble("economy_integration.costs.make_home_public");
this.rtpCost = configFile.getDouble("economy_integration.costs.random_teleport"); this.rtpCost = configFile.getDouble("economy_integration.costs.random_teleport");
this.teleportationCompleteSound = configFile.getString("general.sounds.teleportation_complete"); this.teleportationCompleteSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_complete"));
this.teleportWarmupSound = configFile.getString("general.sounds.teleportation_warmup"); this.teleportWarmupSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_warmup"));
this.checkVanishedPlayers = configFile.getBoolean("handle_vanished_players"); this.checkVanishedPlayers = configFile.getBoolean("handle_vanished_players");
@@ -316,11 +317,11 @@ public class Settings {
return warpsPerPage; return warpsPerPage;
} }
public String getTeleportationCompleteSound() { public Sound getTeleportationCompleteSound() {
return teleportationCompleteSound; return teleportationCompleteSound;
} }
public String getTeleportWarmupSound() { public Sound getTeleportWarmupSound() {
return teleportWarmupSound; return teleportWarmupSound;
} }
} }
@@ -53,7 +53,7 @@ public class runEverySecond {
if (timedTeleport.getTimeRemaining() > 0) { if (timedTeleport.getTimeRemaining() > 0) {
if (!timedTeleport.hasMoved(teleporter)) { if (!timedTeleport.hasMoved(teleporter)) {
if (!timedTeleport.hasLostHealth(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", messageManager.sendActionBarMessage(teleporter, "teleporting_action_bar_countdown",
Integer.toString(timedTeleport.getTimeRemaining())); Integer.toString(timedTeleport.getTimeRemaining()));
timedTeleport.decrementTimeRemaining(); timedTeleport.decrementTimeRemaining();
@@ -34,7 +34,7 @@ public class teleportManager {
String server = teleportationPoint.getServer(); String server = teleportationPoint.getServer();
if (!HuskHomes.settings.doBungee() || server.equals(HuskHomes.settings.getServerID())) { if (!HuskHomes.settings.doBungee() || server.equals(HuskHomes.settings.getServerID())) {
p.teleport(teleportationPoint.getLocation()); 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"); messageManager.sendMessage(p, "teleporting_complete");
dataManager.setPlayerTeleporting(p, false); dataManager.setPlayerTeleporting(p, false);
dataManager.clearPlayerDestination(p.getName()); dataManager.clearPlayerDestination(p.getName());