Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ public enum ActionType {
CLOSE("[close]", "Close the viewers open menu", "- '[close]"),
REFRESH("[refresh]", "Refresh items in the current menu view", "- '[refresh]"),
BROADCAST_SOUND("[broadcastsound]", "Broadcast a sound to the server", "- '[broadcastsound]"),
BROADCAST_RAW_SOUND("[broadcastrawsound]", "Broadcast a RAW sound to the server", "- '[broadcastrawsound]"),
BROADCAST_WORLD_SOUND("[broadcastsoundworld]", "Broadcast a sound to the player's world", "- '[broadcastsoundworld]"),
BROADCAST_WORLD_RAW_SOUND("[broadcastrawsoundworld]", "Broadcast a RAW sound to the player's world", "- '[broadcastrawsoundworld]"),
PLAY_SOUND("[sound]", "Play a sound for a the specific player", "- '[sound]"),
PLAY_RAW_SOUND("[rawsound]", "Play a RAW sound for a the specific player", "- '[rawsound]"),
TAKE_MONEY("[takemoney]", "Take money from a player (requires Vault)", "- '[takemoney] <amount>"),
GIVE_MONEY("[givemoney]", "Give money to a player (requires Vault)", "- '[givemoney] <amount>"),
TAKE_EXP("[takeexp]", "Take exp points/levels from a player", "- '[takeexp] <amount>L'"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,15 @@ public void run() {
break;

case BROADCAST_SOUND:
case BROADCAST_RAW_SOUND:
case BROADCAST_WORLD_SOUND:
case BROADCAST_WORLD_RAW_SOUND:
case PLAY_RAW_SOUND:
case PLAY_SOUND:
final Sound sound;
boolean isRaw = isRaw(actionType);

Sound sound = null;
String soundName = executable;
float volume = 1;
float pitch = 1;

Expand Down Expand Up @@ -453,6 +459,21 @@ public void run() {
}

switch (actionType) {
case BROADCAST_WORLD_RAW_SOUND:
for (final Player broadcastTarget : player.getWorld().getPlayers()) {
broadcastTarget.playSound(broadcastTarget.getLocation(), soundName, volume, pitch);
}
break;

case BROADCAST_RAW_SOUND:
for (final Player broadcastTarget : Bukkit.getOnlinePlayers()) {
broadcastTarget.playSound(broadcastTarget.getLocation(), soundName, volume, pitch);
}
break;

case PLAY_RAW_SOUND:
player.playSound(player.getLocation(), soundName, volume, pitch);
break;
case BROADCAST_SOUND:
for (final Player broadcastTarget : Bukkit.getOnlinePlayers()) {
broadcastTarget.playSound(broadcastTarget.getLocation(), sound, volume, pitch);
Expand All @@ -475,4 +496,9 @@ public void run() {
break;
}
}

private boolean isRaw(ActionType actionType) {
return actionType == ActionType.PLAY_RAW_SOUND || actionType == ActionType.BROADCAST_RAW_SOUND || actionType == ActionType.BROADCAST_WORLD_RAW_SOUND;
}

}
Loading