mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
Add option to enable enhanced whisper functionality, disabled by default
This commit is contained in:
1 parent
564a3baede
commit
0a52817f1a
2 files changed
+32
-10
No files matched your search
@@ -12,6 +12,11 @@ public final class WhisperOptions {
|
|||||||
@Comment("Plays a sound when receiving private messages with /whisper /msg")
|
@Comment("Plays a sound when receiving private messages with /whisper /msg")
|
||||||
private @NonNull WhisperPings pings = new WhisperPings();
|
private @NonNull WhisperPings pings = new WhisperPings();
|
||||||
|
|
||||||
|
@Setting
|
||||||
|
@Comment("If enabled, players will be able to whisper other players as if they had their own private channel, " +
|
||||||
|
"without the need to type /r or /msg each message. /msg [player]")
|
||||||
|
private boolean useEnhancedWhispers = false;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
@Comment("")
|
@Comment("")
|
||||||
private @NonNull String switchMessage = "<gray>You are now in <color><channel> <gray>chat!";
|
private @NonNull String switchMessage = "<gray>You are now in <color><channel> <gray>chat!";
|
||||||
@@ -84,6 +89,10 @@ public final class WhisperOptions {
|
|||||||
return this.pings;
|
return this.pings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean useEnhancedWhispers() {
|
||||||
|
return this.useEnhancedWhispers;
|
||||||
|
}
|
||||||
|
|
||||||
public @NonNull String consoleFormat() {
|
public @NonNull String consoleFormat() {
|
||||||
return this.consoleFormat;
|
return this.consoleFormat;
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-10
@@ -32,16 +32,29 @@ public class MessageCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandManager.command(
|
if (this.carbonChat.carbonSettings().whisperOptions().useEnhancedWhispers()) {
|
||||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
commandManager.command(
|
||||||
commandManager.createDefaultCommandMeta())
|
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||||
.senderType(PlayerUser.class) // player
|
commandManager.createDefaultCommandMeta())
|
||||||
.permission("carbonchat.message")
|
.senderType(PlayerUser.class) // player
|
||||||
.argument(PlayerUserArgument.requiredPlayerUserArgument(commandSettings.name()))
|
.permission("carbonchat.message")
|
||||||
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().asOptional().build())
|
.argument(PlayerUserArgument.requiredPlayerUserArgument(commandSettings.name()))
|
||||||
.handler(this::sendMessage)
|
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().asOptional().build())
|
||||||
.build()
|
.handler(this::sendMessage)
|
||||||
);
|
.build()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
commandManager.command(
|
||||||
|
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||||
|
commandManager.createDefaultCommandMeta())
|
||||||
|
.senderType(PlayerUser.class) // player
|
||||||
|
.permission("carbonchat.message")
|
||||||
|
.argument(PlayerUserArgument.requiredPlayerUserArgument(commandSettings.name()))
|
||||||
|
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().asRequired().build())
|
||||||
|
.handler(this::sendMessage)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage(final @NonNull CommandContext<CarbonUser> context) {
|
private void sendMessage(final @NonNull CommandContext<CarbonUser> context) {
|
||||||
|
|||||||
Reference in new issue
Block a user