From 68539232648f6ceffe243a784bf5c1ab777eb120 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 26 Aug 2015 08:23:08 +0200 Subject: [PATCH] Fix title edit permission check. --- .../factions/cmd/CmdFactionsTitle.java | 8 +++- .../factions/cmd/FactionsCommand.java | 42 ------------------- 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java index a454e7d1..a9c464c6 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java @@ -51,8 +51,12 @@ public class CmdFactionsTitle extends FactionsCommand // MPerm if ( ! MPerm.getPermTitle().has(msender, you.getFaction(), true)) return; - // Verify - if ( ! canIAdministerYou(msender, you)) return; + // Rank Check + if (you.getRole().isMoreThan(msender.getRole())) + { + msg("You can not edit titles for higher ranks."); + return; + } // Event EventFactionsTitleChange event = new EventFactionsTitleChange(sender, you, newTitle); diff --git a/src/com/massivecraft/factions/cmd/FactionsCommand.java b/src/com/massivecraft/factions/cmd/FactionsCommand.java index 2adcce69..f5c3f6be 100644 --- a/src/com/massivecraft/factions/cmd/FactionsCommand.java +++ b/src/com/massivecraft/factions/cmd/FactionsCommand.java @@ -1,10 +1,8 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.Rel; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.massivecore.cmd.MassiveCommand; -import com.massivecraft.massivecore.util.Txt; public class FactionsCommand extends MassiveCommand { @@ -34,44 +32,4 @@ public class FactionsCommand extends MassiveCommand this.msenderFaction = null; } - // -------------------------------------------- // - // COMMONLY USED LOGIC - // -------------------------------------------- // - - public boolean canIAdministerYou(MPlayer i, MPlayer you) - { - if ( ! i.getFaction().equals(you.getFaction())) - { - i.sendMessage(Txt.parse("%s is not in the same faction as you.",you.describeTo(i, true))); - return false; - } - - if (i.getRole().isMoreThan(you.getRole()) || i.getRole().equals(Rel.LEADER) ) - { - return true; - } - - if (you.getRole().equals(Rel.LEADER)) - { - i.sendMessage(Txt.parse("Only the faction leader can do that.")); - } - else if (i.getRole().equals(Rel.OFFICER)) - { - if ( i == you ) - { - return true; //Moderators can control themselves - } - else - { - i.sendMessage(Txt.parse("Officers can't control each other...")); - } - } - else - { - i.sendMessage(Txt.parse("You must be a faction officer to do that.")); - } - - return false; - } - }