Fix recently introduced kick bug

This commit is contained in:
BuildTools 2016-02-06 10:03:46 +01:00 committed by Olof Larsson
parent 89dd975a6e
commit e0f551286e

View File

@ -6,16 +6,15 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.type.TypeMPlayer; import com.massivecraft.factions.cmd.type.TypeMPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; 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;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm; import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
public class CmdFactionsKick extends FactionsCommand public class CmdFactionsKick extends FactionsCommand
@ -50,20 +49,23 @@ public class CmdFactionsKick extends FactionsCommand
if (msender == mplayer) if (msender == mplayer)
{ {
msg("<b>You can't kick yourself."); msg("<b>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; return;
} }
if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || msender.isOverriding())) if (mplayer.getRole() == Rel.LEADER && !msender.isOverriding())
{ {
msg("<b>The leader can not be kicked."); throw new MassiveException().addMsg("<b>The leader cannot be kicked.");
return;
} }
if (mplayer.getRole().compareTo(msender.getRole()) < 0 && !(this.senderIsConsole || msender.isOverriding())) if (mplayer.getRole().isMoreThan(msender.getRole()) && ! msender.isOverriding())
{ {
msg("<b>You can't kick people of higher rank than yourself."); throw new MassiveException().addMsg("<b>You can't kick people of higher rank than yourself.");
return; }
if (mplayer.getRole() == msender.getRole() && ! msender.isOverriding())
{
throw new MassiveException().addMsg("<b>You can't kick people of the same rank as yourself.");
} }
if ( ! MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0 && ! msender.isOverriding()) if ( ! MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0 && ! msender.isOverriding())