mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Update Cloud to 1.0.1
find and replace OP
This commit is contained in:
1 parent
0f104ab212
commit
548955134e
23 files changed
+130
-130
No files matched your search
@@ -20,7 +20,7 @@ dependencies {
|
||||
compile 'net.kyori:event-api:3.0.0'
|
||||
compile 'net.kyori:registry:1.0.0-SNAPSHOT'
|
||||
|
||||
api 'com.intellectualsites:cloud-core:1.0-SNAPSHOT'
|
||||
api 'cloud.commandframework:cloud-core:1.0.1'
|
||||
|
||||
api 'org.spongepowered:configurate-hocon:4.0.0-SNAPSHOT'
|
||||
api 'org.slf4j:slf4j-api:1.7.25'
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
compile 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT'
|
||||
|
||||
// Commands
|
||||
compile "com.intellectualsites:cloud-paper:1.0-SNAPSHOT"
|
||||
compile "cloud.commandframework:cloud-paper:1.0.1"
|
||||
|
||||
// Plugins
|
||||
compileOnly('com.gmail.nossr50.mcMMO:mcMMO:2.1.143') {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon;
|
||||
|
||||
import com.intellectualsites.commands.execution.CommandExecutionCoordinator;
|
||||
import com.intellectualsites.commands.paper.PaperCommandManager;
|
||||
import cloud.commandframework.execution.CommandExecutionCoordinator;
|
||||
import cloud.commandframework.paper.PaperCommandManager;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.config.CarbonTranslations;
|
||||
|
||||
+7
-7
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.standard.StringArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.TextChannel;
|
||||
@@ -27,11 +27,11 @@ public class AliasedChannelCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(this.commandName,
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.channel") // carbonchat.channel.message
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.channel") // carbonchat.channel.message
|
||||
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().asOptional().build())
|
||||
.handler(context -> {
|
||||
if (context.get("message").isPresent()) {
|
||||
if (context.getOptional("message").isPresent()) {
|
||||
this.sendMessage(context);
|
||||
} else {
|
||||
this.channel(context);
|
||||
@@ -56,7 +56,7 @@ public class AliasedChannelCommand {
|
||||
}
|
||||
|
||||
private void sendMessage(@NonNull final CommandContext<CarbonUser> context) {
|
||||
context.<String>get("message").ifPresent(message -> {
|
||||
context.<String>getOptional("message").ifPresent(message -> {
|
||||
this.chatChannel().sendComponentsAndLog(
|
||||
this.chatChannel().parseMessage((PlayerUser) context.getSender(), message, false));
|
||||
});
|
||||
|
||||
+9
-9
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.standard.StringArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.TextChannel;
|
||||
@@ -30,12 +30,12 @@ public class ChannelCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.channel")
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.channel")
|
||||
.argument(ChannelArgument.requiredChannelArgument())
|
||||
.argument(StringArgument.optional("message")) // carbonchat.channel.message
|
||||
.handler(context -> {
|
||||
if (context.get("message").isPresent()) {
|
||||
if (context.getOptional("message").isPresent()) {
|
||||
this.sendMessage(context);
|
||||
} else {
|
||||
this.channel(context);
|
||||
@@ -47,7 +47,7 @@ public class ChannelCommand {
|
||||
|
||||
private void channel(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
final TextChannel channel = context.getRequired("channel");
|
||||
final TextChannel channel = context.get("channel");
|
||||
|
||||
if (user.channelSettings(channel).ignored()) {
|
||||
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor().processMessage(channel.cannotUseMessage(),
|
||||
@@ -61,8 +61,8 @@ public class ChannelCommand {
|
||||
}
|
||||
|
||||
private void sendMessage(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final ChatChannel channel = context.getRequired("channel");
|
||||
final String message = context.getRequired("message");
|
||||
final ChatChannel channel = context.get("channel");
|
||||
final String message = context.get("message");
|
||||
|
||||
channel.sendComponentsAndLog(channel.parseMessage((PlayerUser) context.getSender(),
|
||||
message, false));
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -35,12 +35,12 @@ public class ChannelListCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // console & player
|
||||
.withPermission("carbonchat.channellist")
|
||||
.senderType(CarbonUser.class) // console & player
|
||||
.permission("carbonchat.channellist")
|
||||
// TODO: make this return a PlayerUser
|
||||
.argument(PlayerUserArgument.optionalPlayerUserArgument()) // carbonchat.channellist.other
|
||||
.handler(context -> {
|
||||
if (context.get("user").isPresent()) {
|
||||
if (context.getOptional("user").isPresent()) {
|
||||
this.channelListOther(context);
|
||||
} else {
|
||||
this.channelListSelf(context);
|
||||
@@ -56,7 +56,7 @@ public class ChannelListCommand {
|
||||
|
||||
public void channelListOther(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final CarbonUser sender = context.getSender();
|
||||
final PlayerUser user = context.getRequired("user");
|
||||
final PlayerUser user = context.get("user");
|
||||
|
||||
if (!user.online()) {
|
||||
final String mustBeOnline = this.carbonChat.translations().userMustBeOnline();
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.commands.settings.CommandSettings;
|
||||
@@ -26,8 +26,8 @@ public class ChatReloadCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.reload")
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.reload")
|
||||
.handler(this::reloadConfig)
|
||||
.build()
|
||||
);
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
@@ -26,8 +26,8 @@ public class ClearChatCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.clearchat.clear")
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.clearchat.clear")
|
||||
.handler(this::clearChat)
|
||||
.build()
|
||||
);
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.commands.settings.CommandSettings;
|
||||
@@ -28,8 +28,8 @@ public class IgnoreCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.ignore")
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.ignore")
|
||||
.argument(PlayerUserArgument.requiredPlayerUserArgument())
|
||||
.handler(this::ignoreUser)
|
||||
.build()
|
||||
@@ -38,7 +38,7 @@ public class IgnoreCommand {
|
||||
|
||||
private void ignoreUser(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser sender = (PlayerUser) context.getSender();
|
||||
final PlayerUser targetUser = context.getRequired("user");
|
||||
final PlayerUser targetUser = context.get("user");
|
||||
|
||||
if (sender.ignoringUser(targetUser)) {
|
||||
sender.ignoringUser(targetUser, false);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.standard.StringArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
@@ -28,8 +28,8 @@ public class MeCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.me")
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.me")
|
||||
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().build())
|
||||
.handler(this::message)
|
||||
.build()
|
||||
@@ -39,7 +39,7 @@ public class MeCommand {
|
||||
private void message(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
|
||||
final String message = context.<String>getRequired("message").replace("</pre>", "");
|
||||
final String message = context.<String>get("message").replace("</pre>", "");
|
||||
String format = this.carbonChat.translations().roleplayFormat();
|
||||
|
||||
if (!user.hasPermission("carbonchat.me.formatting")) {
|
||||
|
||||
+7
-7
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.standard.StringArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -34,8 +34,8 @@ public class MessageCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.message")
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.message")
|
||||
.argument(PlayerUserArgument.requiredPlayerUserArgument())
|
||||
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().asOptional().build())
|
||||
.handler(this::sendMessage)
|
||||
@@ -45,7 +45,7 @@ public class MessageCommand {
|
||||
|
||||
private void sendMessage(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser sender = (PlayerUser) context.getSender();
|
||||
final PlayerUser receiver = context.getRequired("user");
|
||||
final PlayerUser receiver = context.get("user");
|
||||
|
||||
if (sender.equals(receiver)) {
|
||||
final String message = this.carbonChat.translations().cannotWhisperSelf();
|
||||
@@ -74,7 +74,7 @@ public class MessageCommand {
|
||||
}
|
||||
}
|
||||
|
||||
final Optional<String> message = context.get("message");
|
||||
final Optional<String> message = context.getOptional("message");
|
||||
|
||||
if (message.isPresent()) {
|
||||
receiver.sendMessage(sender, message.get());
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -29,11 +29,11 @@ public class MsgToggleCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.msgtoggle")
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.msgtoggle")
|
||||
.argument(PlayerUserArgument.optionalPlayerUserArgument()) // carbonchat.msgtoggle.other
|
||||
.handler(context -> {
|
||||
if (context.get("user").isPresent()) {
|
||||
if (context.getOptional("user").isPresent()) {
|
||||
this.toggleOther(context);
|
||||
} else if (context.getSender() instanceof PlayerUser) {
|
||||
// TODO: better handling of this
|
||||
@@ -67,7 +67,7 @@ public class MsgToggleCommand {
|
||||
|
||||
private void toggleOther(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final CarbonUser sender = context.getSender();
|
||||
final PlayerUser user = context.getRequired("user");
|
||||
final PlayerUser user = context.get("user");
|
||||
final ChatChannel channel = this.carbonChat.channelRegistry().get("whisper");
|
||||
|
||||
final String message;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
@@ -28,8 +28,8 @@ public class MuteCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.mute")
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.mute")
|
||||
.argument(PlayerUserArgument.requiredPlayerUserArgument())
|
||||
.handler(this::mute)
|
||||
.build()
|
||||
@@ -38,7 +38,7 @@ public class MuteCommand {
|
||||
|
||||
private void mute(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final CarbonUser user = context.getSender();
|
||||
final PlayerUser target = context.getRequired("user");
|
||||
final PlayerUser target = context.get("user");
|
||||
|
||||
if (target.muted()) {
|
||||
target.muted(false);
|
||||
|
||||
+10
-10
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.standard.StringArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.commands.settings.CommandSettings;
|
||||
@@ -28,12 +28,12 @@ public class NicknameCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.nickname")
|
||||
.argument(StringArgument.required("nickname"))
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.nickname")
|
||||
.argument(StringArgument.of("nickname"))
|
||||
.argument(PlayerUserArgument.optionalPlayerUserArgument()) // carbonchat.nickname.other
|
||||
.handler(context -> {
|
||||
if (context.get("user").isPresent()) {
|
||||
if (context.getOptional("user").isPresent()) {
|
||||
this.nicknameOther(context);
|
||||
} else if (context.getSender() instanceof PlayerUser) {
|
||||
// TODO: better handling of this
|
||||
@@ -46,7 +46,7 @@ public class NicknameCommand {
|
||||
|
||||
private void nicknameSelf(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
String nickname = context.getRequired("nickname");
|
||||
String nickname = context.get("nickname");
|
||||
|
||||
if (nickname.equalsIgnoreCase("off") || nickname.equalsIgnoreCase(user.name())) {
|
||||
nickname = null;
|
||||
@@ -68,8 +68,8 @@ public class NicknameCommand {
|
||||
}
|
||||
|
||||
private void nicknameOther(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser target = context.getRequired("user");
|
||||
String nickname = context.getRequired("nickname");
|
||||
final PlayerUser target = context.get("user");
|
||||
String nickname = context.get("nickname");
|
||||
|
||||
if (nickname.equalsIgnoreCase("off") ||
|
||||
nickname.equalsIgnoreCase(target.name())) {
|
||||
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.standard.StringArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
@@ -28,8 +28,8 @@ public class ReplyCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.reply")
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.reply")
|
||||
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().build())
|
||||
.handler(this::reply)
|
||||
.build()
|
||||
@@ -38,7 +38,7 @@ public class ReplyCommand {
|
||||
|
||||
private void reply(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
final String input = context.getRequired("message");
|
||||
final String input = context.get("message");
|
||||
|
||||
if (input.isEmpty()) {
|
||||
final String message = this.carbonChat.translations().replyMessageBlank();
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -30,13 +30,13 @@ public class SetColorCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.setcolor")
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.setcolor")
|
||||
// TODO: colorArgument
|
||||
//.argument(CommandUtils.colorArgument())
|
||||
.handler(context -> {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
final TextColor color = context.getRequired("color");
|
||||
final TextColor color = context.get("color");
|
||||
|
||||
if (!user.hasPermission("carbonchat.setcolor." + channel.key())) {
|
||||
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor().processMessage(
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
@@ -28,8 +28,8 @@ public class ShadowMuteCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.shadowmute")
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.shadowmute")
|
||||
.argument(PlayerUserArgument.requiredPlayerUserArgument())
|
||||
.handler(this::shadowMute)
|
||||
.build()
|
||||
@@ -38,7 +38,7 @@ public class ShadowMuteCommand {
|
||||
|
||||
private void shadowMute(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final CarbonUser user = context.getSender();
|
||||
final PlayerUser target = context.getRequired("user");
|
||||
final PlayerUser target = context.get("user");
|
||||
|
||||
if (target.shadowMuted()) {
|
||||
target.shadowMuted(false);
|
||||
|
||||
+15
-15
@@ -1,9 +1,9 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.StaticArgument;
|
||||
import com.intellectualsites.commands.arguments.standard.BooleanArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.StaticArgument;
|
||||
import cloud.commandframework.arguments.standard.BooleanArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -32,8 +32,8 @@ public class SpyChannelCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.spy")
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.spy")
|
||||
.argument(ChannelArgument.requiredChannelArgument())
|
||||
.handler(this::spyChannel)
|
||||
.build()
|
||||
@@ -42,9 +42,9 @@ public class SpyChannelCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.spy")
|
||||
.argument(StaticArgument.required("whispers"))
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.spy")
|
||||
.argument(StaticArgument.of("whispers"))
|
||||
.handler(this::spyWhispers)
|
||||
.build()
|
||||
);
|
||||
@@ -52,10 +52,10 @@ public class SpyChannelCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(PlayerUser.class) // player
|
||||
.withPermission("carbonchat.spy")
|
||||
.argument(StaticArgument.required("everything"))
|
||||
.argument(BooleanArgument.required("enabled"))
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.spy")
|
||||
.argument(StaticArgument.of("everything"))
|
||||
.argument(BooleanArgument.of("enabled"))
|
||||
.handler(this::spyEverything)
|
||||
.build()
|
||||
);
|
||||
@@ -63,7 +63,7 @@ public class SpyChannelCommand {
|
||||
|
||||
private void spyChannel(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
final ChatChannel chatChannel = context.getRequired("channel");
|
||||
final ChatChannel chatChannel = context.get("channel");
|
||||
|
||||
final String message;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class SpyChannelCommand {
|
||||
|
||||
private void spyEverything(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
final Boolean shouldSpy = context.getRequired("enabled");
|
||||
final Boolean shouldSpy = context.get("enabled");
|
||||
|
||||
final String message;
|
||||
|
||||
|
||||
+11
-11
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.arguments.standard.StringArgument;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.standard.StringArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -30,13 +30,13 @@ public class SudoChannelCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.channel.others.message")
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.channel.others.message")
|
||||
.argument(PlayerUserArgument.requiredPlayerUserArgument())
|
||||
.argument(ChannelArgument.requiredChannelArgument())
|
||||
.argument(StringArgument.<CarbonUser>newBuilder("message").greedy().asOptional().build())
|
||||
.handler(context -> {
|
||||
if (context.get("message").isPresent()) {
|
||||
if (context.getOptional("message").isPresent()) {
|
||||
this.sendMessageOther(context);
|
||||
} else {
|
||||
this.otherChannel(context);
|
||||
@@ -48,8 +48,8 @@ public class SudoChannelCommand {
|
||||
|
||||
private void otherChannel(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final CarbonUser sender = context.getSender();
|
||||
final CarbonUser user = context.getRequired("user");
|
||||
final ChatChannel channel = context.getRequired("channel");
|
||||
final CarbonUser user = context.get("user");
|
||||
final ChatChannel channel = context.get("channel");
|
||||
|
||||
user.selectedChannel(channel);
|
||||
|
||||
@@ -66,9 +66,9 @@ public class SudoChannelCommand {
|
||||
}
|
||||
|
||||
private void sendMessageOther(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = context.getRequired("user");
|
||||
final ChatChannel channel = context.getRequired("channel");
|
||||
final String message = context.getRequired("message");
|
||||
final PlayerUser user = context.get("user");
|
||||
final ChatChannel channel = context.get("channel");
|
||||
final String message = context.get("message");
|
||||
|
||||
channel.sendComponentsAndLog(channel.parseMessage(user, message, false));
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -30,12 +30,12 @@ public class ToggleCommand {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.withSenderType(CarbonUser.class) // player & console
|
||||
.withPermission("carbonchat.toggle")
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.toggle")
|
||||
.argument(ChannelArgument.requiredChannelArgument())
|
||||
.argument(PlayerUserArgument.optionalPlayerUserArgument()) // carbonchat.toggle.other
|
||||
.handler(context -> {
|
||||
if (context.get("user").isPresent()) {
|
||||
if (context.getOptional("user").isPresent()) {
|
||||
this.toggleOther(context);
|
||||
} else if (context.getSender() instanceof PlayerUser) {
|
||||
this.toggleSelf(context);
|
||||
@@ -47,7 +47,7 @@ public class ToggleCommand {
|
||||
|
||||
private void toggleSelf(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser user = (PlayerUser) context.getSender();
|
||||
final ChatChannel channel = context.getRequired("channel");
|
||||
final ChatChannel channel = context.get("channel");
|
||||
|
||||
final String message;
|
||||
|
||||
@@ -70,8 +70,8 @@ public class ToggleCommand {
|
||||
|
||||
private void toggleOther(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final CarbonUser sender = context.getSender();
|
||||
final PlayerUser user = context.getRequired("user");
|
||||
final ChatChannel channel = context.getRequired("channel");
|
||||
final PlayerUser user = context.get("user");
|
||||
final ChatChannel channel = context.get("channel");
|
||||
|
||||
final String message;
|
||||
final String otherMessage;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands.arguments;
|
||||
|
||||
import com.intellectualsites.commands.arguments.CommandArgument;
|
||||
import com.intellectualsites.commands.arguments.parser.ArgumentParseResult;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.arguments.CommandArgument;
|
||||
import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.channels.TextChannel;
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package net.draycia.carbon.common.commands.arguments;
|
||||
|
||||
import com.intellectualsites.commands.arguments.CommandArgument;
|
||||
import com.intellectualsites.commands.arguments.parser.ArgumentParseResult;
|
||||
import com.intellectualsites.commands.context.CommandContext;
|
||||
import cloud.commandframework.arguments.CommandArgument;
|
||||
import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.PlayerUser;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -22,7 +22,7 @@ public final class PlayerUserArgument<C> extends CommandArgument<C, PlayerUser>
|
||||
}
|
||||
|
||||
private static <C> ArgumentParseResult<PlayerUser> parser(final @NonNull CommandContext<C> commandContext,
|
||||
final @NonNull Queue<String> inputs) {
|
||||
final @NonNull Queue<String> inputs) {
|
||||
final String input = inputs.poll();
|
||||
|
||||
if (input == null) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package net.draycia.carbon.common.commands.misc;
|
||||
|
||||
import com.intellectualsites.commands.CommandManager;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.common.commands.ChannelCommand;
|
||||
import net.draycia.carbon.common.commands.ChannelListCommand;
|
||||
|
||||
Reference in new issue
Block a user