Added more faction permissions. Allies can now teleport to each others homes per default.
This commit is contained in:
@ -42,7 +42,7 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
|
||||
if (newValue == null) return;
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getAccess().has(msender, hostFaction, true)) return;
|
||||
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;
|
||||
|
||||
// Apply
|
||||
ta = ta.withFactionId(faction.getId(), newValue);
|
||||
|
@ -42,7 +42,7 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
|
||||
if (newValue == null) return;
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getAccess().has(msender, hostFaction, true)) return;
|
||||
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;
|
||||
|
||||
// Apply
|
||||
ta = ta.withPlayerId(mplayer.getId(), newValue);
|
||||
|
@ -45,7 +45,7 @@ public class CmdFactionsAutoClaim extends FactionsCommand
|
||||
}
|
||||
|
||||
// MPerm
|
||||
if (forFaction.isNormal() && !MPerm.getTerritory().has(msender, forFaction, true)) return;
|
||||
if (forFaction.isNormal() && !MPerm.getPermTerritory().has(msender, forFaction, true)) return;
|
||||
|
||||
msender.setAutoClaimFaction(forFaction);
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class CmdFactionsClaim extends FactionsCommand
|
||||
if (forFaction == null) return;
|
||||
|
||||
// MPerm
|
||||
if (forFaction.isNormal() && !MPerm.getTerritory().has(msender, forFaction, true)) return;
|
||||
if (forFaction.isNormal() && !MPerm.getPermTerritory().has(msender, forFaction, true)) return;
|
||||
|
||||
// Validate
|
||||
if (radius < 1)
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsDescriptionChange;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -27,7 +26,6 @@ public class CmdFactionsDescription extends FactionsCommand
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -40,6 +38,9 @@ public class CmdFactionsDescription extends FactionsCommand
|
||||
// Args
|
||||
String newDescription = this.argConcatFrom(0);
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermDesc().has(msender, msenderFaction, true)) return;
|
||||
|
||||
// Event
|
||||
EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, msenderFaction, newDescription);
|
||||
event.run();
|
||||
|
@ -46,7 +46,7 @@ public class CmdFactionsDisband extends FactionsCommand
|
||||
if (faction == null) return;
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getDisband().has(msender, faction, true)) return;
|
||||
if ( ! MPerm.getPermDisband().has(msender, faction, true)) return;
|
||||
|
||||
// Verify
|
||||
if (faction.getFlag(MFlag.getPermanent()))
|
||||
|
@ -67,7 +67,7 @@ public class CmdFactionsFlag extends FactionsCommand
|
||||
}
|
||||
|
||||
// Do the sender have the right to change flags for this faction?
|
||||
if ( ! MPerm.getFlags().has(msender, faction, true)) return;
|
||||
if ( ! MPerm.getPermFlags().has(msender, faction, true)) return;
|
||||
|
||||
// Is this flag editable?
|
||||
if (!msender.isUsingAdminMode() && !mflag.isEditable())
|
||||
|
@ -57,18 +57,17 @@ public class CmdFactionsHome extends FactionsCommandHome
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
boolean other = faction != msenderFaction;
|
||||
PS home = faction.getHome();
|
||||
String homeDesc = "home for " + faction.describeTo(msender, false);
|
||||
|
||||
// Other Perm
|
||||
if (other && !Perm.HOME_OTHER.has(sender, true)) return;
|
||||
// Any and MPerm
|
||||
if ( ! MPerm.getPermHome().has(msender, faction, true)) return;
|
||||
|
||||
if (home == null)
|
||||
{
|
||||
msender.msg("<b>%s <b>does not have a home.", faction.describeTo(msender, true));
|
||||
|
||||
if (MPerm.getSethome().has(msender, faction, false))
|
||||
if (MPerm.getPermSethome().has(msender, faction, false))
|
||||
{
|
||||
msender.msg("<i>You should:");
|
||||
msender.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
|
||||
|
@ -55,7 +55,7 @@ public class CmdFactionsInvite extends FactionsCommand
|
||||
}
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getInvite().has(msender, msenderFaction, true)) return;
|
||||
if ( ! MPerm.getPermInvite().has(msender, msenderFaction, true)) return;
|
||||
|
||||
// Event
|
||||
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, newInvited);
|
||||
|
@ -65,7 +65,7 @@ public class CmdFactionsKick extends FactionsCommand
|
||||
|
||||
// MPerm
|
||||
Faction mplayerFaction = mplayer.getFaction();
|
||||
if ( ! MPerm.getKick().has(msender, mplayerFaction, true)) return;
|
||||
if ( ! MPerm.getPermKick().has(msender, mplayerFaction, true)) return;
|
||||
|
||||
// Event
|
||||
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
@ -42,12 +41,8 @@ public class CmdFactionsMotd extends FactionsCommand
|
||||
return;
|
||||
}
|
||||
|
||||
// Check Role
|
||||
if ( ! ReqRoleIsAtLeast.get(Rel.OFFICER).apply(sender, this))
|
||||
{
|
||||
sendMessage(ReqRoleIsAtLeast.get(Rel.OFFICER).createErrorMessage(sender, this));
|
||||
return;
|
||||
}
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermMotd().has(msender, msenderFaction, true)) return;
|
||||
|
||||
// Args
|
||||
String target = this.argConcatFrom(0);
|
||||
|
@ -3,10 +3,9 @@ package com.massivecraft.factions.cmd;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsNameChange;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -28,7 +27,6 @@ public class CmdFactionsName extends FactionsCommand
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(Perm.NAME.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -41,8 +39,10 @@ public class CmdFactionsName extends FactionsCommand
|
||||
// Arg
|
||||
String newName = this.arg(0);
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermName().has(msender, msenderFaction, true)) return;
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
if (FactionColl.get().isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(msenderFaction.getComparisonName()))
|
||||
{
|
||||
msg("<b>That name is already taken");
|
||||
|
@ -70,7 +70,7 @@ public class CmdFactionsPerm extends FactionsCommand
|
||||
}
|
||||
|
||||
// Do the sender have the right to change perms for this faction?
|
||||
if ( ! MPerm.getPerms().has(msender, faction, true)) return;
|
||||
if ( ! MPerm.getPermPerms().has(msender, faction, true)) return;
|
||||
|
||||
// Is this perm editable?
|
||||
if (!msender.isUsingAdminMode() && !mperm.isEditable())
|
||||
@ -97,9 +97,9 @@ public class CmdFactionsPerm extends FactionsCommand
|
||||
faction.setRelationPermitted(mperm, rel, targetValue);
|
||||
|
||||
// The following is to make sure the leader always has the right to change perms if that is our goal.
|
||||
if (mperm == MPerm.getPerms() && MPerm.getPerms().getStandard().contains(Rel.LEADER))
|
||||
if (mperm == MPerm.getPermPerms() && MPerm.getPermPerms().getStandard().contains(Rel.LEADER))
|
||||
{
|
||||
faction.setRelationPermitted(MPerm.getPerms(), Rel.LEADER, true);
|
||||
faction.setRelationPermitted(MPerm.getPermPerms(), Rel.LEADER, true);
|
||||
}
|
||||
|
||||
// Inform
|
||||
|
@ -4,10 +4,10 @@ import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsRelationChange;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -27,7 +27,6 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(Perm.RELATION.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -49,6 +48,9 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
|
||||
return;
|
||||
}*/
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermRel().has(msender, msenderFaction, true)) return;
|
||||
|
||||
// Verify
|
||||
|
||||
if (otherFaction == msenderFaction)
|
||||
|
@ -43,7 +43,7 @@ public class CmdFactionsSethome extends FactionsCommandHome
|
||||
PS newHome = PS.valueOf(me.getLocation());
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getSethome().has(msender, faction, true)) return;
|
||||
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
|
||||
|
||||
// Verify
|
||||
if (!msender.isUsingAdminMode() && !faction.isValidHome(newHome))
|
||||
|
@ -3,9 +3,8 @@ package com.massivecraft.factions.cmd;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsTitleChange;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
@ -29,7 +28,6 @@ public class CmdFactionsTitle extends FactionsCommand
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(Perm.TITLE.node));
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -52,6 +50,9 @@ public class CmdFactionsTitle extends FactionsCommand
|
||||
newTitle = ChatColor.stripColor(newTitle);
|
||||
}
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermTitle().has(msender, you.getFaction(), true)) return;
|
||||
|
||||
// Verify
|
||||
if ( ! canIAdministerYou(msender, you)) return;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class CmdFactionsUnclaimall extends FactionsCommand
|
||||
Faction newFaction = FactionColl.get().getNone();
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getTerritory().has(msender, faction, true)) return;
|
||||
if ( ! MPerm.getPermTerritory().has(msender, faction, true)) return;
|
||||
|
||||
// Apply
|
||||
Set<PS> chunks = BoardColl.get().getChunks(faction);
|
||||
|
@ -36,11 +36,8 @@ public class CmdFactionsUnsethome extends FactionsCommandHome
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// Other Perm
|
||||
if (faction != msenderFaction && !Perm.HOME_OTHER.has(sender, true)) return;
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getSethome().has(msender, faction, true)) return;
|
||||
// Any and MPerm
|
||||
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
|
||||
|
||||
// NoChange
|
||||
if ( ! faction.hasHome())
|
||||
|
@ -63,12 +63,12 @@ public abstract class FactionsCommand extends MassiveCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
i.sendMessage(Txt.parse("<b>Moderators can't control each other..."));
|
||||
i.sendMessage(Txt.parse("<b>Officers can't control each other..."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i.sendMessage(Txt.parse("<b>You must be a faction moderator to do that."));
|
||||
i.sendMessage(Txt.parse("<b>You must be a faction officer to do that."));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user