Merge pull request #7 from Hexaoxide/2.1

merge sounds
This commit is contained in:
Olzie-12 authored and GitHub committed 2022-12-15 22:49:50 +00:00
commit 93cc9a7b49
12 files changed
+79 -18

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ repositories {
dependencies { dependencies {
implementation(libs.shadow) implementation(libs.shadow)
implementation(libs.indraCommon) implementation(libs.indraCommon)
implementation(libs.indraLicenseHeader)
implementation(libs.licenser) implementation(libs.licenser)
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 // https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
@@ -34,12 +34,15 @@ import net.draycia.carbon.common.command.CommandSettings;
import net.draycia.carbon.common.command.Commander; import net.draycia.carbon.common.command.Commander;
import net.draycia.carbon.common.command.PlayerCommander; import net.draycia.carbon.common.command.PlayerCommander;
import net.draycia.carbon.common.command.argument.CarbonPlayerArgument; import net.draycia.carbon.common.command.argument.CarbonPlayerArgument;
import net.draycia.carbon.common.config.ConfigFactory;
import net.draycia.carbon.common.messages.CarbonMessages; import net.draycia.carbon.common.messages.CarbonMessages;
import net.draycia.carbon.common.util.CloudUtils; import net.draycia.carbon.common.util.CloudUtils;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import net.kyori.adventure.sound.Sound;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
@DefaultQualifier(NonNull.class) @DefaultQualifier(NonNull.class)
@@ -48,16 +51,19 @@ public class ContinueCommand extends CarbonCommand {
final CarbonChat carbonChat; final CarbonChat carbonChat;
final CommandManager<Commander> commandManager; final CommandManager<Commander> commandManager;
final CarbonMessages carbonMessages; final CarbonMessages carbonMessages;
final ConfigFactory configFactory;
@Inject @Inject
public ContinueCommand( public ContinueCommand(
final CarbonChat carbonChat, final CarbonChat carbonChat,
final CommandManager<Commander> commandManager, final CommandManager<Commander> commandManager,
final CarbonMessages carbonMessages final CarbonMessages carbonMessages,
final ConfigFactory configFactory
) { ) {
this.carbonChat = carbonChat; this.carbonChat = carbonChat;
this.commandManager = commandManager; this.commandManager = commandManager;
this.carbonMessages = carbonMessages; this.carbonMessages = carbonMessages;
this.configFactory = configFactory;
} }
@Override @Override
@@ -128,6 +134,10 @@ public class ContinueCommand extends CarbonCommand {
this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message); this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message);
this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message); this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message);
final @Nullable Sound messageSound = this.configFactory.primaryConfig().messageSound();
if (messageSound != null) {
recipient.playSound(messageSound);
}
sender.lastWhisperTarget(recipient.uuid()); sender.lastWhisperTarget(recipient.uuid());
sender.whisperReplyTarget(recipient.uuid()); sender.whisperReplyTarget(recipient.uuid());
recipient.whisperReplyTarget(sender.uuid()); recipient.whisperReplyTarget(sender.uuid());
@@ -34,9 +34,11 @@ import net.draycia.carbon.common.command.CommandSettings;
import net.draycia.carbon.common.command.Commander; import net.draycia.carbon.common.command.Commander;
import net.draycia.carbon.common.command.PlayerCommander; import net.draycia.carbon.common.command.PlayerCommander;
import net.draycia.carbon.common.command.argument.CarbonPlayerArgument; import net.draycia.carbon.common.command.argument.CarbonPlayerArgument;
import net.draycia.carbon.common.config.ConfigFactory;
import net.draycia.carbon.common.messages.CarbonMessages; import net.draycia.carbon.common.messages.CarbonMessages;
import net.draycia.carbon.common.util.CloudUtils; import net.draycia.carbon.common.util.CloudUtils;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import net.kyori.adventure.sound.Sound;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@@ -49,16 +51,19 @@ public class ReplyCommand extends CarbonCommand {
final CarbonChat carbonChat; final CarbonChat carbonChat;
final CommandManager<Commander> commandManager; final CommandManager<Commander> commandManager;
final CarbonMessages carbonMessages; final CarbonMessages carbonMessages;
final ConfigFactory configFactory;
@Inject @Inject
public ReplyCommand( public ReplyCommand(
final CarbonChat carbonChat, final CarbonChat carbonChat,
final CommandManager<Commander> commandManager, final CommandManager<Commander> commandManager,
final CarbonMessages carbonMessages final CarbonMessages carbonMessages,
final ConfigFactory configFactory
) { ) {
this.carbonChat = carbonChat; this.carbonChat = carbonChat;
this.commandManager = commandManager; this.commandManager = commandManager;
this.carbonMessages = carbonMessages; this.carbonMessages = carbonMessages;
this.configFactory = configFactory;
} }
@Override @Override
@@ -128,6 +133,10 @@ public class ReplyCommand extends CarbonCommand {
this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message); this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message);
this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message); this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message);
final @Nullable Sound messageSound = this.configFactory.primaryConfig().messageSound();
if (messageSound != null) {
recipient.playSound(messageSound);
}
sender.lastWhisperTarget(recipient.uuid()); sender.lastWhisperTarget(recipient.uuid());
sender.whisperReplyTarget(recipient.uuid()); sender.whisperReplyTarget(recipient.uuid());
recipient.whisperReplyTarget(sender.uuid()); recipient.whisperReplyTarget(sender.uuid());
@@ -33,11 +33,14 @@ import net.draycia.carbon.common.command.Commander;
import net.draycia.carbon.common.command.PlayerCommander; import net.draycia.carbon.common.command.PlayerCommander;
import net.draycia.carbon.common.command.argument.CarbonPlayerArgument; import net.draycia.carbon.common.command.argument.CarbonPlayerArgument;
import net.draycia.carbon.common.command.argument.PlayerSuggestions; import net.draycia.carbon.common.command.argument.PlayerSuggestions;
import net.draycia.carbon.common.config.ConfigFactory;
import net.draycia.carbon.common.messages.CarbonMessages; import net.draycia.carbon.common.messages.CarbonMessages;
import net.draycia.carbon.common.util.CloudUtils; import net.draycia.carbon.common.util.CloudUtils;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import net.kyori.adventure.sound.Sound;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
@DefaultQualifier(NonNull.class) @DefaultQualifier(NonNull.class)
@@ -47,18 +50,21 @@ public class WhisperCommand extends CarbonCommand {
final CommandManager<Commander> commandManager; final CommandManager<Commander> commandManager;
final CarbonMessages carbonMessages; final CarbonMessages carbonMessages;
final PlayerSuggestions playerSuggestions; final PlayerSuggestions playerSuggestions;
final ConfigFactory configFactory;
@Inject @Inject
public WhisperCommand( public WhisperCommand(
final CarbonChat carbonChat, final CarbonChat carbonChat,
final CommandManager<Commander> commandManager, final CommandManager<Commander> commandManager,
final CarbonMessages carbonMessages, final CarbonMessages carbonMessages,
final PlayerSuggestions playerSuggestions final PlayerSuggestions playerSuggestions,
final ConfigFactory configFactory
) { ) {
this.carbonChat = carbonChat; this.carbonChat = carbonChat;
this.commandManager = commandManager; this.commandManager = commandManager;
this.carbonMessages = carbonMessages; this.carbonMessages = carbonMessages;
this.playerSuggestions = playerSuggestions; this.playerSuggestions = playerSuggestions;
this.configFactory = configFactory;
} }
@Override @Override
@@ -122,6 +128,10 @@ public class WhisperCommand extends CarbonCommand {
this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message); this.carbonMessages.whisperRecipient(new SourcedAudience(sender, recipient), senderName, recipientName, message);
this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message); this.carbonMessages.whisperConsoleLog(this.carbonChat.server().console(), senderName, recipientName, message);
final @Nullable Sound messageSound = this.configFactory.primaryConfig().messageSound();
if (messageSound != null) {
recipient.playSound(messageSound);
}
sender.lastWhisperTarget(recipient.uuid()); sender.lastWhisperTarget(recipient.uuid());
sender.whisperReplyTarget(recipient.uuid()); sender.whisperReplyTarget(recipient.uuid());
recipient.whisperReplyTarget(sender.uuid()); recipient.whisperReplyTarget(sender.uuid());
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import net.kyori.adventure.key.Key; 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.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
@@ -69,6 +70,14 @@ public class PrimaryConfig {
@Comment("Various settings related to pinging players in channels.") @Comment("Various settings related to pinging players in channels.")
private PingSettings pingSettings = new PingSettings(); private PingSettings pingSettings = new PingSettings();
@Comment("Various sound settings for messages.")
private @Nullable Sound messageSound = Sound.sound(
Key.key("entity.experience_orb.pickup"),
Sound.Source.MASTER,
1.0F,
1.0F
);
private MessagingSettings messagingSettings = new MessagingSettings(); private MessagingSettings messagingSettings = new MessagingSettings();
public Locale defaultLocale() { public Locale defaultLocale() {
@@ -111,6 +120,10 @@ public class PrimaryConfig {
return this.messagingSettings; return this.messagingSettings;
} }
public @Nullable Sound messageSound() {
return this.messageSound;
}
public enum StorageType { public enum StorageType {
JSON, JSON,
MYSQL, MYSQL,
+6 -2
View File
@@ -6,11 +6,11 @@ metadata:
plugins: plugins:
net.kyori.blossom: 1.3.0 net.kyori.blossom: 1.3.0
net.minecrell.plugin-yml.bukkit: 0.5.1 net.minecrell.plugin-yml.bukkit: 0.5.1
org.spongepowered.gradle.plugin: 2.0.2 org.spongepowered.gradle.plugin: 2.1.1
xyz.jpenilla.run-paper: 2.0.1 xyz.jpenilla.run-paper: 2.0.1
versions: versions:
indra: 2.2.0 indra: 3.0.1
licenser: 0.6.1 licenser: 0.6.1
shadow: 7.1.2 shadow: 7.1.2
adventure: 4.12.0 adventure: 4.12.0
@@ -290,6 +290,10 @@ dependencies:
group: net.kyori group: net.kyori
name: indra-common name: indra-common
version: { ref: indra } version: { ref: indra }
indraLicenseHeader:
group: net.kyori
name: indra-licenser-cadix
version: { ref: indra }
shadow: shadow:
group: gradle.plugin.com.github.johnrengelman group: gradle.plugin.com.github.johnrengelman
name: shadow name: shadow
Binary file not shown.
+2 -1
View File
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+14 -4
View File
@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Vendored
+9 -6
View File
@@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
+1 -1
View File
@@ -82,7 +82,7 @@ sequenceOf(
"api", "api",
"common", "common",
"paper", "paper",
"sponge", // "sponge", // TODO API 10
// "fabric", // TODO 1.19.3 // "fabric", // TODO 1.19.3
"velocity" "velocity"
).forEach { ).forEach {
+1 -1
View File
@@ -27,7 +27,7 @@ tasks {
sponge { sponge {
injectRepositories(false) // We specify repositories in settings.gradle.kts injectRepositories(false) // We specify repositories in settings.gradle.kts
apiVersion("9.0.0-SNAPSHOT") apiVersion("10.0.0-SNAPSHOT")
plugin(rootProject.name.toLowerCase(Locale.ROOT)) { plugin(rootProject.name.toLowerCase(Locale.ROOT)) {
loader { loader {
name(PluginLoaders.JAVA_PLAIN) name(PluginLoaders.JAVA_PLAIN)