Fixed internal error caused by trying to demote a player who already has the lowest rank

This commit is contained in:
Stefan923 2020-05-09 14:53:02 +03:00 committed by BrowkS
parent 842eb097c6
commit 31b8f0be25
2 changed files with 7 additions and 1 deletions

View File

@ -57,6 +57,11 @@ public class FPromoteCommand extends FCommand {
context.msg(TL.COMMAND_PROMOTE_NOT_SAME);
return;
}
// Don't allow people to demote people who already have the lowest rank.
if (current.value == 0 && relative <= 0) {
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());
return;
}
// Don't allow people to promote people to their same or higher rank.
if (context.fPlayer.getRole().value <= promotion.value) {
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);

View File

@ -712,6 +712,7 @@ public enum TL {
COMMAND_PROMOTE_SUCCESS("&c&l[!]&7 You successfully&c %1$s %2$s &cto&7 %3$s"),
COMMAND_PROMOTE_PROMOTED("promoted"),
COMMAND_PROMOTE_DEMOTED("demoted"),
COMMAND_PROMOTE_LOWEST_RANK("&c&l[!]&7 &c%1$s&7 already has the lowest rank in the faction."),
COMMAND_PROMOTE_COLEADER_ADMIN("&c&l[!]&7 &cColeaders cant promote players to Admin!"),
COMMAND_PERMANENTPOWER_DESCRIPTION("Toggle permanent faction power option"),