From 6803cd09996b8102c0f9083c57a0531d54f528e3 Mon Sep 17 00:00:00 2001 From: "BT (calcastor/mame)" <43831917+calcastor@users.noreply.github.com> Date: Sun, 1 Feb 2026 18:28:22 -0800 Subject: [PATCH] Define sounds using PGM for modern support Signed-off-by: BT (calcastor/mame) <43831917+calcastor@users.noreply.github.com> --- .../pgm/community/freeze/FreezeManager.java | 12 ++---- .../java/dev/pgm/community/utils/Sounds.java | 41 ++++++++++--------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/core/src/main/java/dev/pgm/community/freeze/FreezeManager.java b/core/src/main/java/dev/pgm/community/freeze/FreezeManager.java index 5c78c2a8..ec450154 100644 --- a/core/src/main/java/dev/pgm/community/freeze/FreezeManager.java +++ b/core/src/main/java/dev/pgm/community/freeze/FreezeManager.java @@ -1,7 +1,5 @@ package dev.pgm.community.freeze; -import static net.kyori.adventure.key.Key.key; -import static net.kyori.adventure.sound.Sound.sound; import static net.kyori.adventure.text.Component.empty; import static net.kyori.adventure.text.Component.space; import static net.kyori.adventure.text.Component.text; @@ -14,11 +12,11 @@ import dev.pgm.community.CommunityPermissions; import dev.pgm.community.utils.BroadcastUtils; import dev.pgm.community.utils.CommandAudience; +import dev.pgm.community.utils.Sounds; import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import net.kyori.adventure.sound.Sound; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.ClickEvent; @@ -43,10 +41,6 @@ /** FreezeManager - Handles freezing of players */ public class FreezeManager { - private final Sound FREEZE_SOUND = - sound(key("mob.enderdragon.growl"), Sound.Source.PLAYER, 1f, 1f); - private final Sound THAW_SOUND = sound(key("mob.enderdragon.growl"), Sound.Source.PLAYER, 1f, 2f); - private final OnlinePlayerMapAdapter frozenPlayers; private final Cache offlineFrozenCache = CacheBuilder.newBuilder().expireAfterWrite(3, TimeUnit.MINUTES).build(); @@ -142,7 +136,7 @@ private void freeze(Player freezee, Component senderName, boolean silent) { freezeTitle.build(), Times.of(Ticks.duration(5), Ticks.duration(9999), Ticks.duration(5)))); } - Audience.get(freezee).playSound(FREEZE_SOUND); + Audience.get(freezee).playSound(Sounds.FREEZE_SOUND); BroadcastUtils.sendAdminChatMessage( createInteractiveBroadcast(senderName, freezee, true), CommunityPermissions.FREEZE); @@ -160,7 +154,7 @@ private void thaw(Player freezee, Component senderName, boolean silent) { } freezee.resetTitle(); - Audience.get(freezee).playSound(THAW_SOUND); + Audience.get(freezee).playSound(Sounds.THAW_SOUND); Audience.get(freezee).sendMessage(thawedTitle.color(NamedTextColor.GREEN)); BroadcastUtils.sendAdminChatMessage( diff --git a/core/src/main/java/dev/pgm/community/utils/Sounds.java b/core/src/main/java/dev/pgm/community/utils/Sounds.java index afaced84..9d25b21f 100644 --- a/core/src/main/java/dev/pgm/community/utils/Sounds.java +++ b/core/src/main/java/dev/pgm/community/utils/Sounds.java @@ -1,56 +1,59 @@ package dev.pgm.community.utils; -import static net.kyori.adventure.key.Key.key; -import static net.kyori.adventure.sound.Sound.sound; +import static tc.oc.pgm.util.bukkit.Sounds.sound; import net.kyori.adventure.sound.Sound; public class Sounds { // Played when a player is reported - public static final Sound PLAYER_REPORT = sound(key("random.pop"), Sound.Source.MASTER, 1f, 1.2f); + public static final Sound PLAYER_REPORT = sound("ITEM_PICKUP", "ENTITY_ITEM_PICKUP", 1f, 1.2f); // Played when a ban evader joins the server - public static final Sound BAN_EVASION = sound(key("random.pop"), Sound.Source.MASTER, 1f, 0.8f); + public static final Sound BAN_EVASION = sound("ITEM_PICKUP", "ENTITY_ITEM_PICKUP", 1f, 0.8f); // Played when a player is warned - public static final Sound WARN_SOUND = - sound(key("mob.enderdragon.growl"), Sound.Source.MASTER, 1f, 1f); + public static final Sound WARN_SOUND = sound("ENDERDRAGON_GROWL", "ENTITY_ENDER_DRAGON_GROWL"); + + // Played when a player is frozen + public static final Sound FREEZE_SOUND = WARN_SOUND; + + // Played when a player is unfrozen + public static final Sound THAW_SOUND = + sound("ENDERDRAGON_GROWL", "ENTITY_ENDER_DRAGON_GROWL", 1f, 2f); // Played when an infraction is lifted public static final Sound PUNISHMENT_PARDON = - sound(key("note.harp"), Sound.Source.MASTER, 0.7f, 1.5f); + sound("NOTE_PIANO", "BLOCK_NOTE_BLOCK_HARP", 0.7f, 1.5f); // Played when a player is teleported via command public static final Sound TELEPORT = - sound(key("mob.endermen.portal"), Sound.Source.MASTER, 0.7f, 0.9f); + sound("ENDERMAN_TELEPORT", "ENTITY_ENDERMAN_TELEPORT", 0.7f, 0.9f); // Played when player logs in and has a pending friend request public static final Sound FRIEND_REQUEST_LOGIN = - sound(key("note.harp"), Sound.Source.MASTER, 1f, 1.2f); + sound("NOTE_PIANO", "BLOCK_NOTE_BLOCK_HARP", 1f, 1.2f); // Played when a player requests help - public static final Sound HELP_REQUEST = - sound(key("mob.cat.meow"), Sound.Source.MASTER, 1f, 0.9f); + public static final Sound HELP_REQUEST = sound("CAT_MEOW", "ENTITY_CAT_AMBIENT", 1f, 0.9f); // Played when a message is broadcasted (/broadcast) - public static final Sound BROADCAST = sound(key("note.pling"), Sound.Source.MASTER, 1f, 1.4f); + public static final Sound BROADCAST = sound("NOTE_PLING", "BLOCK_NOTE_BLOCK_PLING", 1f, 1.4f); // Played when a message is sent to admin chat - public static final Sound ADMIN_CHAT = sound(key("random.orb"), Sound.Source.MASTER, 1f, 0.7f); + public static final Sound ADMIN_CHAT = + sound("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP", 1f, 0.7f); // Played when a a prominent message is broadcasted - public static final Sound ALERT = sound(key("note.harp"), Sound.Source.MASTER, 1f, 0.1f); + public static final Sound ALERT = sound("NOTE_PIANO", "BLOCK_NOTE_BLOCK_HARP", 1f, 0.1f); // Played when a target is selected for the teleport hook public static final Sound TARGET_CONFIRM = - sound(key("random.wood_click"), Sound.Source.MASTER, 1f, 1.5f); + sound("WOOD_CLICK", "BLOCK_WOODEN_BUTTON_CLICK_ON", 1f, 1.5f); // Played when a player receives tokens (login or /token give) - public static final Sound GET_TOKENS = - sound(key("random.levelup"), Sound.Source.MASTER, 1f, 1.1f); + public static final Sound GET_TOKENS = sound("LEVEL_UP", "ENTITY_PLAYER_LEVELUP", 1f, 1.1f); // Played when a player spends tokens (/sponsor) - public static final Sound SPEND_TOKENS = - sound(key("random.anvil_land"), Sound.Source.MASTER, 1f, 1.3f); + public static final Sound SPEND_TOKENS = sound("ANVIL_LAND", "BLOCK_ANVIL_LAND", 1f, 1.3f); }