mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 15:22:16 +00:00
Fix account list
subcommand
This commit is contained in:
parent
a4ad781d61
commit
665263d9ba
@ -1,19 +1,18 @@
|
|||||||
package emu.grasscutter.command.commands;
|
package emu.grasscutter.command.commands;
|
||||||
|
|
||||||
import static emu.grasscutter.utils.lang.Language.translate;
|
|
||||||
|
|
||||||
import at.favre.lib.crypto.bcrypt.BCrypt;
|
import at.favre.lib.crypto.bcrypt.BCrypt;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.*;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
|
||||||
import emu.grasscutter.config.Configuration;
|
import emu.grasscutter.config.Configuration;
|
||||||
import emu.grasscutter.database.DatabaseHelper;
|
import emu.grasscutter.database.*;
|
||||||
import emu.grasscutter.database.DatabaseManager;
|
|
||||||
import emu.grasscutter.game.Account;
|
import emu.grasscutter.game.Account;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static emu.grasscutter.utils.lang.Language.translate;
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
label = "account",
|
label = "account",
|
||||||
usage = {
|
usage = {
|
||||||
@ -31,17 +30,17 @@ public final class AccountCommand implements CommandHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.size() < 2) {
|
|
||||||
sendUsageMessage(sender);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String action = args.get(0);
|
String action = args.get(0);
|
||||||
String username = args.get(1);
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
default -> this.sendUsageMessage(sender);
|
default -> this.sendUsageMessage(sender);
|
||||||
case "create" -> {
|
case "create" -> {
|
||||||
|
if (args.size() < 2) {
|
||||||
|
this.sendUsageMessage(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var username = args.get(1);
|
||||||
|
|
||||||
int uid = 0;
|
int uid = 0;
|
||||||
String password = "";
|
String password = "";
|
||||||
if (Configuration.ACCOUNT.EXPERIMENTAL_RealPassword) {
|
if (Configuration.ACCOUNT.EXPERIMENTAL_RealPassword) {
|
||||||
@ -94,6 +93,12 @@ public final class AccountCommand implements CommandHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "delete" -> {
|
case "delete" -> {
|
||||||
|
if (args.size() < 2) {
|
||||||
|
this.sendUsageMessage(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var username = args.get(1);
|
||||||
|
|
||||||
// Get the account we want to delete.
|
// Get the account we want to delete.
|
||||||
Account toDelete = DatabaseHelper.getAccountByName(username);
|
Account toDelete = DatabaseHelper.getAccountByName(username);
|
||||||
if (toDelete == null) {
|
if (toDelete == null) {
|
||||||
@ -104,6 +109,12 @@ public final class AccountCommand implements CommandHandler {
|
|||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.account.delete"));
|
CommandHandler.sendMessage(sender, translate(sender, "commands.account.delete"));
|
||||||
}
|
}
|
||||||
case "resetpass" -> {
|
case "resetpass" -> {
|
||||||
|
if (args.size() < 2) {
|
||||||
|
this.sendUsageMessage(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var username = args.get(1);
|
||||||
|
|
||||||
if (!Configuration.ACCOUNT.EXPERIMENTAL_RealPassword) {
|
if (!Configuration.ACCOUNT.EXPERIMENTAL_RealPassword) {
|
||||||
CommandHandler.sendMessage(
|
CommandHandler.sendMessage(
|
||||||
sender, "resetpass requires EXPERIMENTAL_RealPassword to be true.");
|
sender, "resetpass requires EXPERIMENTAL_RealPassword to be true.");
|
||||||
|
Loading…
Reference in New Issue
Block a user