mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 22:16:22 +00:00
Add sound for teleport cancelled; is possible to specify in config.yml
Added handling if an invalid sound is set in config.yml; plugin will use defaults instead.
This commit is contained in:
1 parent
c03c44252a
commit
b10856baae
3 files changed
+19
No files matched your search
@@ -57,6 +57,7 @@ public class Settings {
|
|||||||
// Sounds
|
// Sounds
|
||||||
Sound teleportationCompleteSound;
|
Sound teleportationCompleteSound;
|
||||||
Sound teleportWarmupSound;
|
Sound teleportWarmupSound;
|
||||||
|
Sound teleportCancelledSound;
|
||||||
|
|
||||||
// Number of items per page on lists
|
// Number of items per page on lists
|
||||||
int privateHomesPerPage;
|
int privateHomesPerPage;
|
||||||
@@ -135,8 +136,18 @@ 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");
|
||||||
|
|
||||||
|
// Retrieve sounds used in plugin; if invalid, use defaults.
|
||||||
|
try {
|
||||||
this.teleportationCompleteSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_complete"));
|
this.teleportationCompleteSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_complete"));
|
||||||
this.teleportWarmupSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_warmup"));
|
this.teleportWarmupSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_warmup"));
|
||||||
|
this.teleportCancelledSound = Sound.valueOf(configFile.getString("general.sounds.teleportation_cancelled"));
|
||||||
|
} catch (IllegalArgumentException exception) {
|
||||||
|
Bukkit.getLogger().severe("Invalid sound specified in config.yml; using default sounds instead.");
|
||||||
|
this.teleportationCompleteSound = Sound.ENTITY_ENDERMAN_TELEPORT;
|
||||||
|
this.teleportWarmupSound = Sound.BLOCK_NOTE_BLOCK_BANJO;
|
||||||
|
this.teleportCancelledSound = Sound.ENTITY_ITEM_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.checkVanishedPlayers = configFile.getBoolean("handle_vanished_players");
|
this.checkVanishedPlayers = configFile.getBoolean("handle_vanished_players");
|
||||||
|
|
||||||
@@ -324,4 +335,8 @@ public class Settings {
|
|||||||
public Sound getTeleportWarmupSound() {
|
public Sound getTeleportWarmupSound() {
|
||||||
return teleportWarmupSound;
|
return teleportWarmupSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Sound getTeleportCancelledSound() {
|
||||||
|
return teleportCancelledSound;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import me.william278.huskhomes2.Objects.RandomPoint;
|
|||||||
import me.william278.huskhomes2.Objects.TimedTeleport;
|
import me.william278.huskhomes2.Objects.TimedTeleport;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Husk;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
|
||||||
@@ -60,11 +61,13 @@ public class runEverySecond {
|
|||||||
} else {
|
} else {
|
||||||
messageManager.sendActionBarMessage(teleporter, "teleporting_action_bar_cancelled");
|
messageManager.sendActionBarMessage(teleporter, "teleporting_action_bar_cancelled");
|
||||||
messageManager.sendMessage(teleporter, "teleporting_cancelled_damage");
|
messageManager.sendMessage(teleporter, "teleporting_cancelled_damage");
|
||||||
|
teleporter.playSound(teleporter.getLocation(), HuskHomes.settings.getTeleportCancelledSound(), 1, 1);
|
||||||
completedTeleports.add(timedTeleport);
|
completedTeleports.add(timedTeleport);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendActionBarMessage(teleporter, "teleporting_action_bar_cancelled");
|
messageManager.sendActionBarMessage(teleporter, "teleporting_action_bar_cancelled");
|
||||||
messageManager.sendMessage(teleporter, "teleporting_cancelled_movement");
|
messageManager.sendMessage(teleporter, "teleporting_cancelled_movement");
|
||||||
|
teleporter.playSound(teleporter.getLocation(), HuskHomes.settings.getTeleportCancelledSound(), 1, 1);
|
||||||
completedTeleports.add(timedTeleport);
|
completedTeleports.add(timedTeleport);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ general:
|
|||||||
sounds:
|
sounds:
|
||||||
teleportation_complete: 'ENTITY_ENDERMAN_TELEPORT'
|
teleportation_complete: 'ENTITY_ENDERMAN_TELEPORT'
|
||||||
teleportation_warmup: 'BLOCK_NOTE_BLOCK_BANJO'
|
teleportation_warmup: 'BLOCK_NOTE_BLOCK_BANJO'
|
||||||
|
teleportation_cancelled: 'ENTITY_ITEM_BREAK'
|
||||||
lists:
|
lists:
|
||||||
private_homes_per_page: 10
|
private_homes_per_page: 10
|
||||||
public_homes_per_page: 10
|
public_homes_per_page: 10
|
||||||
|
|||||||
Reference in new issue
Block a user