mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Merge pull request #1 from Olzie-12/msgsound
changed to Adventure's sound object
This commit is contained in:
6 files changed
+38
-59
No files matched your search
+1
-1
@@ -132,7 +132,7 @@ 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().sound());
|
||||
recipient.playSound(this.configFactory.primaryConfig().messageSounds());
|
||||
sender.lastWhisperTarget(recipient.uuid());
|
||||
sender.whisperReplyTarget(recipient.uuid());
|
||||
recipient.whisperReplyTarget(sender.uuid());
|
||||
|
||||
@@ -132,7 +132,7 @@ 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().sound());
|
||||
recipient.playSound(this.configFactory.primaryConfig().messageSounds());
|
||||
sender.lastWhisperTarget(recipient.uuid());
|
||||
sender.whisperReplyTarget(recipient.uuid());
|
||||
recipient.whisperReplyTarget(sender.uuid());
|
||||
|
||||
@@ -126,7 +126,7 @@ 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().sound());
|
||||
recipient.playSound(this.configFactory.primaryConfig().messageSounds());
|
||||
sender.lastWhisperTarget(recipient.uuid());
|
||||
sender.whisperReplyTarget(recipient.uuid());
|
||||
recipient.whisperReplyTarget(sender.uuid());
|
||||
|
||||
@@ -19,13 +19,15 @@
|
||||
*/
|
||||
package net.draycia.carbon.common.config;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
||||
@ConfigSerializable
|
||||
public class PingSettings extends SoundSettings {
|
||||
public class PingSettings {
|
||||
|
||||
@Comment("The color your name will be when another player mentions you.")
|
||||
private TextColor highlightTextColor = NamedTextColor.YELLOW;
|
||||
@@ -33,6 +35,10 @@ public class PingSettings extends SoundSettings {
|
||||
private String prefix = "@";
|
||||
|
||||
private boolean playSound = false;
|
||||
private Key name = Key.key("block.anvil.use");
|
||||
private Sound.Source source = Sound.Source.MASTER;
|
||||
private float volume = 1.0f; // 0.0 -> infinity
|
||||
private float pitch = 1.0f; // 0.0 -> 2.0
|
||||
|
||||
public TextColor highlightTextColor() {
|
||||
return this.highlightTextColor;
|
||||
@@ -42,8 +48,28 @@ public class PingSettings extends SoundSettings {
|
||||
return this.playSound;
|
||||
}
|
||||
|
||||
public Key name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String prefix() {
|
||||
return this.prefix;
|
||||
}
|
||||
|
||||
public Sound.Source source() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public float volume() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public float pitch() {
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
public Sound sound() {
|
||||
return Sound.sound(this.name, this.source, this.volume, this.pitch);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@@ -70,7 +71,12 @@ public class PrimaryConfig {
|
||||
private PingSettings pingSettings = new PingSettings();
|
||||
|
||||
@Comment("Various sound settings for messages.")
|
||||
private SoundSettings messageSounds = new SoundSettings();
|
||||
private Sound messageSounds = Sound.sound(
|
||||
Key.key("entity.experience_orb.pickup"),
|
||||
Sound.Source.MASTER,
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
|
||||
private MessagingSettings messagingSettings = new MessagingSettings();
|
||||
|
||||
@@ -114,7 +120,7 @@ public class PrimaryConfig {
|
||||
return this.messagingSettings;
|
||||
}
|
||||
|
||||
public SoundSettings messageSounds() {
|
||||
public Sound messageSounds() {
|
||||
return this.messageSounds;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2021 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.draycia.carbon.common.config;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
@ConfigSerializable
|
||||
public class SoundSettings {
|
||||
|
||||
private Key name = Key.key("entity.arrow.hit_player");
|
||||
private Sound.Source source = Sound.Source.MASTER;
|
||||
private float volume = 1.0f; // 0.0 -> infinity
|
||||
private float pitch = 1.0f; // 0.0 -> 2.0
|
||||
|
||||
public Key name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Sound.Source source() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public float volume() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public float pitch() {
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
public Sound sound() {
|
||||
return Sound.sound(this.name, this.source, this.volume, this.pitch);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user