-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a6b980
commit 0ce3d02
Showing
6 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/dev/emortal/velocity/player/listener/PlayerJoinQuitListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package dev.emortal.velocity.player.listener; | ||
|
||
import com.velocitypowered.api.event.Subscribe; | ||
import com.velocitypowered.api.event.connection.DisconnectEvent; | ||
import com.velocitypowered.api.event.connection.LoginEvent; | ||
import dev.emortal.velocity.lang.ChatMessages; | ||
import net.kyori.adventure.audience.Audience; | ||
import net.kyori.adventure.key.Key; | ||
import net.kyori.adventure.sound.Sound; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public final class PlayerJoinQuitListener { | ||
private static final Key JOIN_QUIT_SOUND = Key.key(Key.MINECRAFT_NAMESPACE, "entity.item.pickup"); | ||
|
||
private final Audience audience; | ||
|
||
public PlayerJoinQuitListener(@NotNull Audience audience) { | ||
this.audience = audience; | ||
} | ||
|
||
@Subscribe | ||
public void onJoin(@NotNull LoginEvent event) { | ||
ChatMessages.JOIN.send(this.audience, event.getPlayer().getUsername()); | ||
this.audience.playSound(Sound.sound(JOIN_QUIT_SOUND, Sound.Source.MASTER, 1F, 1.2F)); | ||
} | ||
|
||
@Subscribe | ||
public void onQuit(@NotNull DisconnectEvent event) { | ||
ChatMessages.QUIT.send(this.audience, event.getPlayer().getUsername()); | ||
this.audience.playSound(Sound.sound(JOIN_QUIT_SOUND, Sound.Source.MASTER, 1F, 0.5F)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters