Skip to content

Commit

Permalink
🐛 handle /ch join (name) (message)
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed May 13, 2024
1 parent 8dd25f3 commit e78d4ae
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ChannelMsgFromCommandListener implements Listener {
private final List<String> lunaChatSubCommands =
Arrays.asList(
"create",
"join",
//"join",
"leave",
"list",
"info",
Expand Down Expand Up @@ -59,7 +59,14 @@ public void onCommand(PlayerCommandPreprocessEvent e) {
return;
}

Channel ch = LunaChat.getAPI().getChannel(labelAndArgs[1]);
String channelName;
if (labelAndArgs[1].equals("join")) {
channelName = labelAndArgs[2];
} else {
channelName = labelAndArgs[1];
}

Channel ch = LunaChat.getAPI().getChannel(channelName);
if (ch == null) {
return;
}
Expand All @@ -75,8 +82,12 @@ public void onCommand(PlayerCommandPreprocessEvent e) {
return;
}

String chatMessage =
e.getMessage().substring(labelAndArgs[0].length() + labelAndArgs[1].length() + 1).trim();
String chatMessage;
if (labelAndArgs[1].equals("join")) {
chatMessage = e.getMessage().substring(labelAndArgs[0].length() + labelAndArgs[1].length() + channelName.length() + 2).trim();
} else {
chatMessage = e.getMessage().substring(labelAndArgs[0].length() + channelName.length() + 1).trim();
}

ChannelChatMessageData data =
plugin
Expand Down

0 comments on commit e78d4ae

Please sign in to comment.