From e0f551286ed391ce05e8ee375b6bf61bb79580b5 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sat, 6 Feb 2016 10:03:46 +0100 Subject: [PATCH] Fix recently introduced kick bug --- .../factions/cmd/CmdFactionsKick.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java index 18b6e720..1361b794 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java @@ -6,16 +6,15 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.type.TypeMPlayer; +import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColl; +import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPlayer; -import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.event.EventFactionsMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.command.requirement.RequirementHasPerm; -import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.util.IdUtil; public class CmdFactionsKick extends FactionsCommand @@ -50,20 +49,23 @@ public class CmdFactionsKick extends FactionsCommand if (msender == mplayer) { msg("You can't kick yourself."); - message(Mson.mson(mson("You might want to: ").color(ChatColor.YELLOW), Factions.get().getOuterCmdFactions().cmdFactionsLeave.getTemplate(false))); + message(mson(mson("You might want to: ").color(ChatColor.YELLOW), Factions.get().getOuterCmdFactions().cmdFactionsLeave.getTemplate(false))); return; } - if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || msender.isOverriding())) + if (mplayer.getRole() == Rel.LEADER && !msender.isOverriding()) { - msg("The leader can not be kicked."); - return; + throw new MassiveException().addMsg("The leader cannot be kicked."); } - if (mplayer.getRole().compareTo(msender.getRole()) < 0 && !(this.senderIsConsole || msender.isOverriding())) + if (mplayer.getRole().isMoreThan(msender.getRole()) && ! msender.isOverriding()) { - msg("You can't kick people of higher rank than yourself."); - return; + throw new MassiveException().addMsg("You can't kick people of higher rank than yourself."); + } + + if (mplayer.getRole() == msender.getRole() && ! msender.isOverriding()) + { + throw new MassiveException().addMsg("You can't kick people of the same rank as yourself."); } if ( ! MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0 && ! msender.isOverriding())