Fix title edit permission check.
This commit is contained in:
parent
33964d4aa2
commit
6853923264
@ -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("<b>You can not edit titles for higher ranks.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Event
|
||||
EventFactionsTitleChange event = new EventFactionsTitleChange(sender, you, newTitle);
|
||||
|
@ -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 <b>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("<b>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("<b>Officers can't control each other..."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i.sendMessage(Txt.parse("<b>You must be a faction officer to do that."));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user