aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Ilin <hevav@hevav.dev>2022-02-07 07:05:08 +0300
committerPetr Ilin <hevav@hevav.dev>2022-02-07 07:05:08 +0300
commita322bd93e4e4d22ed7805d66d1545c39de87fd38 (patch)
tree6f7c94e10ab4b6cd9ad369e36735e41866be9b91
parent000f091872d98e91e3d6c45a5ebfa86393a719da (diff)
downloadLimboAuth-a322bd93e4e4d22ed7805d66d1545c39de87fd38.tar.gz
LimboAuth-a322bd93e4e4d22ed7805d66d1545c39de87fd38.tar.bz2
LimboAuth-a322bd93e4e4d22ed7805d66d1545c39de87fd38.zip
Fix some premium commands
-rw-r--r--src/main/java/net/elytrium/limboauth/Settings.java3
-rw-r--r--src/main/java/net/elytrium/limboauth/command/ChangePasswordCommand.java4
-rw-r--r--src/main/java/net/elytrium/limboauth/command/TotpCommand.java4
-rw-r--r--src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java4
4 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java
index edbe130..432dc97 100644
--- a/src/main/java/net/elytrium/limboauth/Settings.java
+++ b/src/main/java/net/elytrium/limboauth/Settings.java
@@ -145,7 +145,8 @@ public class Settings extends Config {
public String ERROR_OCCURRED = "{PRFX} &cAn internal error has occurred!";
public String NOT_PLAYER = "{PRFX} &cСonsole is not allowed to execute this command!";
- public String NOT_REGISTERED = "{PRFX} &cYou are not registered!";
+ public String NOT_REGISTERED = "{PRFX} &cYou are not registered or your account is &6PREMIUM!";
+ public String CRACKED_COMMAND = "{PRFX}{NL}&aYou can not use this command since your account is &6PREMIUM&a!";
public String WRONG_PASSWORD = "{PRFX} &cPassword is wrong!";
public String NICKNAME_INVALID_KICK = "{PRFX}{NL}&cYour nickname contains forbidden characters. Please, change your nickname!";
diff --git a/src/main/java/net/elytrium/limboauth/command/ChangePasswordCommand.java b/src/main/java/net/elytrium/limboauth/command/ChangePasswordCommand.java
index abda93d..63a8c73 100644
--- a/src/main/java/net/elytrium/limboauth/command/ChangePasswordCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/ChangePasswordCommand.java
@@ -41,6 +41,7 @@ public class ChangePasswordCommand implements SimpleCommand {
private final Component successful;
private final Component errorOccurred;
private final Component usage;
+ private final Component crackedCommand;
public ChangePasswordCommand(Dao<RegisteredPlayer, String> playerDao) {
this.playerDao = playerDao;
@@ -52,6 +53,7 @@ public class ChangePasswordCommand implements SimpleCommand {
this.successful = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.CHANGE_PASSWORD_SUCCESSFUL);
this.errorOccurred = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.ERROR_OCCURRED);
this.usage = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.CHANGE_PASSWORD_USAGE);
+ this.crackedCommand = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.CRACKED_COMMAND);
}
@Override
@@ -70,6 +72,8 @@ public class ChangePasswordCommand implements SimpleCommand {
if (player == null) {
source.sendMessage(this.notRegistered);
return;
+ } else if (player.getHash().isEmpty()) {
+ source.sendMessage(this.crackedCommand);
} else if (!AuthSessionHandler.checkPassword(args[0], player, this.playerDao)) {
source.sendMessage(this.wrongPassword);
return;
diff --git a/src/main/java/net/elytrium/limboauth/command/TotpCommand.java b/src/main/java/net/elytrium/limboauth/command/TotpCommand.java
index d7306bd..a14129c 100644
--- a/src/main/java/net/elytrium/limboauth/command/TotpCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/TotpCommand.java
@@ -60,6 +60,7 @@ public class TotpCommand implements SimpleCommand {
private final String recovery;
private final Component disabled;
private final Component wrong;
+ private final Component crackedCommand;
public TotpCommand(Dao<RegisteredPlayer, String> playerDao) {
this.playerDao = playerDao;
@@ -80,6 +81,7 @@ public class TotpCommand implements SimpleCommand {
this.recovery = Settings.IMP.MAIN.STRINGS.TOTP_RECOVERY;
this.disabled = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.TOTP_DISABLED);
this.wrong = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.TOTP_WRONG);
+ this.crackedCommand = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.CRACKED_COMMAND);
}
@Override
@@ -107,6 +109,8 @@ public class TotpCommand implements SimpleCommand {
if (playerInfo == null) {
source.sendMessage(this.notRegistered);
return;
+ } else if (playerInfo.getHash().isEmpty()) {
+ source.sendMessage(this.crackedCommand);
} else if (this.needPassword && !AuthSessionHandler.checkPassword(args[1], playerInfo, this.playerDao)) {
source.sendMessage(this.wrongPassword);
return;
diff --git a/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java b/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java
index 5fe8643..0811007 100644
--- a/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java
@@ -42,6 +42,7 @@ public class UnregisterCommand implements SimpleCommand {
private final Component errorOccurred;
private final Component wrongPassword;
private final Component usage;
+ private final Component crackedCommand;
public UnregisterCommand(LimboAuth plugin, Dao<RegisteredPlayer, String> playerDao) {
this.plugin = plugin;
@@ -53,6 +54,7 @@ public class UnregisterCommand implements SimpleCommand {
this.errorOccurred = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.ERROR_OCCURRED);
this.wrongPassword = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.WRONG_PASSWORD);
this.usage = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.UNREGISTER_USAGE);
+ this.crackedCommand = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.CRACKED_COMMAND);
}
@Override
@@ -71,6 +73,8 @@ public class UnregisterCommand implements SimpleCommand {
RegisteredPlayer player = AuthSessionHandler.fetchInfo(this.playerDao, username);
if (player == null) {
source.sendMessage(this.notRegistered);
+ } else if (player.getHash().isEmpty()) {
+ source.sendMessage(this.crackedCommand);
} else if (AuthSessionHandler.checkPassword(args[0], player, this.playerDao)) {
try {
this.playerDao.deleteById(username.toLowerCase(Locale.ROOT));