Closes #8, adds options for setting custom teleport sounds

This commit is contained in:
William278 committed 2021-01-25 14:18:57 +00:00
1 parent 5c6a3df5a4
commit 90127d819d
4 files changed
+21 -1

No files matched your search

@@ -53,6 +53,10 @@ public class Settings {
int teleportRequestExpiryTime;
int teleportWarmupTime;
// Sounds
String teleportationCompleteSound;
String teleportWarmupSound;
// Number of items per page on lists
int privateHomesPerPage;
int publicHomesPerPage;
@@ -130,6 +134,9 @@ 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.checkVanishedPlayers = configFile.getBoolean("handle_vanished_players");
this.doSpawnCommand = configFile.getBoolean("spawn_command.enabled");
@@ -308,4 +315,12 @@ public class Settings {
public int getWarpsPerPage() {
return warpsPerPage;
}
public String getTeleportationCompleteSound() {
return teleportationCompleteSound;
}
public String getTeleportWarmupSound() {
return teleportWarmupSound;
}
}
@@ -53,7 +53,7 @@ public class runEverySecond {
if (timedTeleport.getTimeRemaining() > 0) {
if (!timedTeleport.hasMoved(teleporter)) {
if (!timedTeleport.hasLostHealth(teleporter)) {
teleporter.playSound(teleporter.getLocation(), Sound.BLOCK_NOTE_BLOCK_BANJO, 2, 1);
teleporter.playSound(teleporter.getLocation(), Sound.valueOf(HuskHomes.settings.getTeleportWarmupSound()), 2, 1);
messageManager.sendActionBarMessage(teleporter, "teleporting_action_bar_countdown",
Integer.toString(timedTeleport.getTimeRemaining()));
timedTeleport.decrementTimeRemaining();
@@ -5,6 +5,7 @@ import me.william278.huskhomes2.Objects.RandomPoint;
import me.william278.huskhomes2.Objects.TeleportationPoint;
import me.william278.huskhomes2.Objects.TimedTeleport;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import java.time.Instant;
@@ -33,6 +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);
messageManager.sendMessage(p, "teleporting_complete");
dataManager.setPlayerTeleporting(p, false);
dataManager.clearPlayerDestination(p.getName());