mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Sound is now Nullable
messageSound is now singular not plural Removed ToDo
This commit is contained in:
1 parent
c00e614abf
commit
2d194bbb3e
5 files changed
+21
-7
No files matched your search
+6
-1
@@ -38,9 +38,11 @@ import net.draycia.carbon.common.config.ConfigFactory;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.draycia.carbon.common.util.CloudUtils;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@@ -132,7 +134,10 @@ public class ContinueCommand extends CarbonCommand {
|
||||
this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message);
|
||||
this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message);
|
||||
|
||||
recipient.playSound(this.configFactory.primaryConfig().messageSounds());
|
||||
final @Nullable Sound messageSound = this.configFactory.primaryConfig().messageSound();
|
||||
if (messageSound != null) {
|
||||
recipient.playSound(messageSound);
|
||||
}
|
||||
sender.lastWhisperTarget(recipient.uuid());
|
||||
sender.whisperReplyTarget(recipient.uuid());
|
||||
recipient.whisperReplyTarget(sender.uuid());
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.draycia.carbon.common.config.ConfigFactory;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.draycia.carbon.common.util.CloudUtils;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -132,7 +133,10 @@ public class ReplyCommand extends CarbonCommand {
|
||||
this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message);
|
||||
this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message);
|
||||
|
||||
recipient.playSound(this.configFactory.primaryConfig().messageSounds());
|
||||
final @Nullable Sound messageSound = this.configFactory.primaryConfig().messageSound();
|
||||
if (messageSound != null) {
|
||||
recipient.playSound(messageSound);
|
||||
}
|
||||
sender.lastWhisperTarget(recipient.uuid());
|
||||
sender.whisperReplyTarget(recipient.uuid());
|
||||
recipient.whisperReplyTarget(sender.uuid());
|
||||
|
||||
@@ -37,8 +37,10 @@ import net.draycia.carbon.common.config.ConfigFactory;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.draycia.carbon.common.util.CloudUtils;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@@ -126,7 +128,10 @@ public class WhisperCommand extends CarbonCommand {
|
||||
this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message);
|
||||
this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message);
|
||||
|
||||
recipient.playSound(this.configFactory.primaryConfig().messageSounds());
|
||||
final @Nullable Sound messageSound = this.configFactory.primaryConfig().messageSound();
|
||||
if (messageSound != null) {
|
||||
recipient.playSound(messageSound);
|
||||
}
|
||||
sender.lastWhisperTarget(recipient.uuid());
|
||||
sender.whisperReplyTarget(recipient.uuid());
|
||||
recipient.whisperReplyTarget(sender.uuid());
|
||||
|
||||
@@ -71,7 +71,7 @@ public class PrimaryConfig {
|
||||
private PingSettings pingSettings = new PingSettings();
|
||||
|
||||
@Comment("Various sound settings for messages.")
|
||||
private Sound messageSounds = Sound.sound(
|
||||
private Sound messageSound = Sound.sound(
|
||||
Key.key("entity.experience_orb.pickup"),
|
||||
Sound.Source.MASTER,
|
||||
1.0F,
|
||||
@@ -120,8 +120,9 @@ public class PrimaryConfig {
|
||||
return this.messagingSettings;
|
||||
}
|
||||
|
||||
public Sound messageSounds() {
|
||||
return this.messageSounds;
|
||||
@Nullable
|
||||
public Sound messageSound() {
|
||||
return this.messageSound;
|
||||
}
|
||||
|
||||
public enum StorageType {
|
||||
|
||||
@@ -45,7 +45,6 @@ public class PingHandler {
|
||||
|
||||
@Inject
|
||||
public PingHandler(final CarbonChat carbonChat, final ConfigFactory configFactory) {
|
||||
//TODO: there is an issue with this, it only works if the player is sending the message pings themself
|
||||
this.renderer = keyedRenderer(this.muteKey, (sender, recipient, message, originalMessage) -> {
|
||||
if (!(recipient instanceof CarbonPlayer recipientPlayer)) {
|
||||
return new RenderedMessage(message, MessageType.CHAT);
|
||||
|
||||
Reference in new issue
Block a user