Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ConsoleCommandManager implements ConsoleCommand {
public ConsoleCommandManager() {
consoleCommandMap = new HashMap<>();
consoleCommandMap.put("sendToUser", new SendToUserConsoleCommand());
consoleCommandMap.put("logout", new LoginConsoleCommand());
consoleCommandMap.put("logout", new LogoutConsoleCommand());
consoleCommandMap.put("createGroup", new CreateGroupConsoleCommand());
consoleCommandMap.put("joinGroup", new JoinGroupConsoleCommand());
consoleCommandMap.put("quitGroup", new QuitGroupConsoleCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ public void exec(Scanner scanner, Channel channel) {
LoginRequestPacket loginRequestPacket = new LoginRequestPacket();

System.out.print("输入用户名登录: ");
loginRequestPacket.setUserName(scanner.nextLine());
String userIdStr; // 在退出登录logout之后 这里会读取到最后一个回车符 用户名就是空字符串会导致无法退出登录
while ((userIdStr = scanner.nextLine()).isEmpty()) {
System.out.println("用户名异常, 请重新输入");
}
loginRequestPacket.setUserName(userIdStr);
loginRequestPacket.setPassword("pwd");

// 发送登录数据包
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.