Skip to content

Commit

Permalink
add optional sound to invitation to join message
Browse files Browse the repository at this point in the history
  • Loading branch information
steve4744 committed Feb 22, 2022
1 parent 4a0bea4 commit 71e50a5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/main/java/tntrun/arena/handlers/SoundHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public void ITEM_SELECT(Player p) {
}
}

@Override
public void INVITE_MESSAGE(Player p) {
if (isSoundEnabled("invitationmessage")) {
p.playSound(p.getLocation(), getSound("invitationmessage"), getVolume("invitationmessage"), getPitch("invitationmessage"));
}
}

@Override
public void BLOCK_BREAK(Block fblock) {
if (isSoundEnabled("blockbreak")) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/tntrun/utils/Sounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public abstract class Sounds {
public abstract void NOTE_PLING(Player p, float volume, float pitch);
public abstract void ARENA_START(Player p);
public abstract void ITEM_SELECT(Player p);
public abstract void INVITE_MESSAGE(Player p);
public abstract void BLOCK_BREAK(Block block);

}
1 change: 1 addition & 0 deletions src/main/java/tntrun/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public static void displayJoinMessage(Player player, String arenaname, String jo
jointc.addExtra(getJoinTextComponent(joinMessage, arenaname));
jointc.addExtra(new TextComponent(TextComponent.fromLegacyText("\n" + border)));
player.spigot().sendMessage(jointc);
TNTRun.getInstance().getSound().INVITE_MESSAGE(player);
}

private static TextComponent getJoinTextComponent(String text, String arenaname) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ broadcastwinlevel: 2
invitationmessage:
enabled: false
#
# if true, players join as spectators if arena is already running
# if true, players that join will join as spectators if arena is already running
allowspectate: false
#
# if true, players already playing TNTRun will not receive the message
Expand Down Expand Up @@ -126,6 +126,11 @@ sounds:
sound: BLOCK_SAND_BREAK
volume: 5
pitch: 1.0
invitationmessage:
enabled: false
sound: ENTITY_PLAYER_LEVELUP
volume: 10
pitch: 1.0
#
# if enabled, all players in arena teleport to arena spawn when countdown = 5 seconds
anticamping:
Expand Down

0 comments on commit 71e50a5

Please sign in to comment.