Fixed an internal error caused by some unhandled cases.
This commit is contained in:
@@ -57,6 +57,11 @@ public class FPromoteCommand extends FCommand {
|
||||
context.msg(TL.COMMAND_PROMOTE_NOT_SAME);
|
||||
return;
|
||||
}
|
||||
// Don't allow people to promote people with same or higher rank than their.
|
||||
if (context.fPlayer.getRole().value <= target.getRole().value) {
|
||||
context.msg(TL.COMMAND_PROMOTE_HIGHER_RANK, target.getName());
|
||||
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());
|
||||
@@ -69,11 +74,16 @@ public class FPromoteCommand extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (promotion == null) {
|
||||
context.msg(TL.COMMAND_PROMOTE_NOTTHATPLAYER);
|
||||
// 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 who already have the highest rank.
|
||||
if (current.value == 4 && relative > 0) {
|
||||
context.msg(TL.COMMAND_PROMOTE_HIGHEST_RANK, target.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow people to promote people to their same or higher rnak.
|
||||
if (context.fPlayer.getRole().value <= promotion.value) {
|
||||
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
|
||||
|
||||
Reference in New Issue
Block a user