mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 19:25:12 +01:00
Fixes owner being allowed to demote himself (#834)
* Fixes owner demoting himself to subowner This occurred whilst owner demoted himself to a subowner that led to non existence of the true owner * Adds error on demote-yourself message
This commit is contained in:
parent
1c1996ba4c
commit
dd0396161e
@ -52,6 +52,11 @@ public class IslandTeamPromoteCommand extends CompositeCommand {
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return true;
|
||||
}
|
||||
// Check if the user is not trying to promote/ demote himself
|
||||
if (target == user) {
|
||||
user.sendMessage("demote.errors.cant-demote-yourself");
|
||||
return true;
|
||||
}
|
||||
if (!inTeam(getWorld(), target) || !getOwner(getWorld(), user).equals(getOwner(getWorld(), target))) {
|
||||
user.sendMessage("general.errors.not-in-team");
|
||||
return true;
|
||||
|
@ -507,6 +507,8 @@ commands:
|
||||
demote:
|
||||
description: "demote a player on your island down a rank"
|
||||
parameters: "<player>"
|
||||
errors:
|
||||
cant-demote-yourself: "&cYou can't demote yourself!"
|
||||
failure: "&cPlayer cannot be demoted any further!"
|
||||
success: "&aDemoted [name] to [rank]"
|
||||
promote:
|
||||
|
Loading…
Reference in New Issue
Block a user