Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added sound component to messages (#1084)
- Loading branch information
1 parent
5a1c68a
commit 4bbd574
Showing
4 changed files
with
45 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
src/main/java/com/bgsoftware/superiorskyblock/lang/component/impl/SoundComponent.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,34 @@ | ||
package com.bgsoftware.superiorskyblock.lang.component.impl; | ||
|
||
import com.bgsoftware.superiorskyblock.lang.component.EmptyMessageComponent; | ||
import com.bgsoftware.superiorskyblock.lang.component.IMessageComponent; | ||
import com.bgsoftware.superiorskyblock.wrappers.SoundWrapper; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public final class SoundComponent implements IMessageComponent { | ||
|
||
private final SoundWrapper soundWrapper; | ||
|
||
public static IMessageComponent of(@Nullable SoundWrapper soundWrapper) { | ||
return SoundWrapper.isEmpty(soundWrapper) ? EmptyMessageComponent.getInstance() : new SoundComponent(soundWrapper); | ||
} | ||
|
||
private SoundComponent(SoundWrapper soundWrapper) { | ||
this.soundWrapper = soundWrapper; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public void sendMessage(CommandSender sender, Object... objects) { | ||
if (sender instanceof Player) | ||
soundWrapper.playSound((Player) sender); | ||
} | ||
|
||
} |
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