Added more faction permissions. Allies can now teleport to each others homes per default.

This commit is contained in:
Olof Larsson 2014-10-03 09:01:36 +02:00
parent ebfbbf4555
commit e722662223
26 changed files with 133 additions and 120 deletions

View File

@ -25,7 +25,6 @@ public enum Perm
FACTION("faction"),
FLAG("flag"),
HOME("home"),
HOME_OTHER("home.other"),
INVITE("invite"),
JOIN("join"),
JOIN_ANY("join.any"),
@ -61,7 +60,6 @@ public enum Perm
UNCLAIM("unclaim"),
UNCLAIM_ALL("unclaimall"),
UNSETHOME("unsethome"),
UNSETHOME_OTHER("unsethome.other"),
VERSION("version"),
// END OF LIST

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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();

View File

@ -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()))

View File

@ -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())

View File

@ -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());

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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

View File

@ -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)

View File

@ -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))

View File

@ -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;

View File

@ -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);

View File

@ -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())

View File

@ -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;

View File

@ -105,11 +105,11 @@ public class FactionColl extends Coll<Faction>
faction.setFlag(MFlag.getFirespread(), true);
faction.setFlag(MFlag.getEndergrief(), true);
faction.setPermittedRelations(MPerm.getBuild(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getDoor(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getContainer(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getButton(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getLever(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermBuild(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermDoor(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermContainer(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermButton(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermLever(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
return faction;
}
@ -138,11 +138,11 @@ public class FactionColl extends Coll<Faction>
faction.setFlag(MFlag.getFirespread(), false);
faction.setFlag(MFlag.getEndergrief(), false);
faction.setPermittedRelations(MPerm.getDoor(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getContainer(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getButton(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getLever(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getTerritory(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER);
faction.setPermittedRelations(MPerm.getPermDoor(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermContainer(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermButton(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermLever(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermTerritory(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER);
return faction;
}
@ -171,11 +171,11 @@ public class FactionColl extends Coll<Faction>
faction.setFlag(MFlag.getFirespread(), true);
faction.setFlag(MFlag.getEndergrief(), true);
faction.setPermittedRelations(MPerm.getDoor(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getContainer(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getButton(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getLever(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getTerritory(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER);
faction.setPermittedRelations(MPerm.getPermDoor(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermContainer(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermButton(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermLever(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY);
faction.setPermittedRelations(MPerm.getPermTerritory(), Rel.LEADER, Rel.OFFICER, Rel.MEMBER);
return faction;
}

View File

@ -28,12 +28,19 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
public final static transient String ID_BUTTON = "button";
public final static transient String ID_LEVER = "lever";
public final static transient String ID_CONTAINER = "container";
public final static transient String ID_NAME = "name";
public final static transient String ID_DESC = "desc";
public final static transient String ID_MOTD = "motd";
public final static transient String ID_INVITE = "invite";
public final static transient String ID_KICK = "kick";
public final static transient String ID_TITLE = "title";
public final static transient String ID_HOME = "home";
public final static transient String ID_SETHOME = "sethome";
public final static transient String ID_WITHDRAW = "withdraw";
public final static transient String ID_TERRITORY = "territory";
public final static transient String ID_ACCESS = "access";
public final static transient String ID_REL = "rel";
public final static transient String ID_DISBAND = "disband";
public final static transient String ID_FLAGS = "flags";
public final static transient String ID_PERMS = "perms";
@ -44,15 +51,22 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
public final static transient int PRIORITY_BUTTON = 4000;
public final static transient int PRIORITY_LEVER = 5000;
public final static transient int PRIORITY_CONTAINER = 6000;
public final static transient int PRIORITY_INVITE = 7000;
public final static transient int PRIORITY_KICK = 8000;
public final static transient int PRIORITY_SETHOME = 9000;
public final static transient int PRIORITY_WITHDRAW = 10000;
public final static transient int PRIORITY_TERRITORY = 12000;
public final static transient int PRIORITY_ACCESS = 13000;
public final static transient int PRIORITY_DISBAND = 14000;
public final static transient int PRIORITY_FLAGS = 15000;
public final static transient int PRIORITY_PERMS = 16000;
public final static transient int PRIORITY_NAME = 7000;
public final static transient int PRIORITY_DESC = 8000;
public final static transient int PRIORITY_MOTD = 9000;
public final static transient int PRIORITY_INVITE = 10000;
public final static transient int PRIORITY_KICK = 11000;
public final static transient int PRIORITY_TITLE = 12000;
public final static transient int PRIORITY_HOME = 13000;
public final static transient int PRIORITY_SETHOME = 14000;
public final static transient int PRIORITY_WITHDRAW = 15000;
public final static transient int PRIORITY_TERRITORY = 16000;
public final static transient int PRIORITY_ACCESS = 17000;
public final static transient int PRIORITY_REL = 18000;
public final static transient int PRIORITY_DISBAND = 19000;
public final static transient int PRIORITY_FLAGS = 20000;
public final static transient int PRIORITY_PERMS = 21000;
// -------------------------------------------- //
// META: CORE
@ -70,40 +84,52 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
public static void setupStandardPerms()
{
getBuild();
getPainbuild();
getDoor();
getButton();
getLever();
getContainer();
getPermBuild();
getPermPainbuild();
getPermDoor();
getPermButton();
getPermLever();
getPermContainer();
getInvite();
getKick();
getSethome();
getWithdraw();
getTerritory();
getAccess();
getDisband();
getFlags();
getPerms();
getPermName();
getPermDesc();
getPermMotd();
getPermInvite();
getPermKick();
getPermTitle();
getPermHome();
getPermSethome();
getPermWithdraw();
getPermTerritory();
getPermAccess();
getPermRel();
getPermDisband();
getPermFlags();
getPermPerms();
}
public static MPerm getBuild() { return getCreative(PRIORITY_BUILD, ID_BUILD, ID_BUILD, "edit the terrain", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY), true, true, true); }
public static MPerm getPainbuild() { return getCreative(PRIORITY_PAINBUILD, ID_PAINBUILD, ID_PAINBUILD, "edit, take damage", new LinkedHashSet<Rel>(), true, true, true); }
public static MPerm getDoor() { return getCreative(PRIORITY_DOOR, ID_DOOR, ID_DOOR, "use doors", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); }
public static MPerm getButton() { return getCreative(PRIORITY_BUTTON, ID_BUTTON, ID_BUTTON, "use stone buttons", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); }
public static MPerm getLever() { return getCreative(PRIORITY_LEVER, ID_LEVER, ID_LEVER, "use levers", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); }
public static MPerm getContainer() { return getCreative(PRIORITY_CONTAINER, ID_CONTAINER, ID_CONTAINER, "use containers", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER), true, true, true); }
public static MPerm getPermBuild() { return getCreative(PRIORITY_BUILD, ID_BUILD, ID_BUILD, "edit the terrain", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY), true, true, true); }
public static MPerm getPermPainbuild() { return getCreative(PRIORITY_PAINBUILD, ID_PAINBUILD, ID_PAINBUILD, "edit, take damage", new LinkedHashSet<Rel>(), true, true, true); }
public static MPerm getPermDoor() { return getCreative(PRIORITY_DOOR, ID_DOOR, ID_DOOR, "use doors", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); }
public static MPerm getPermButton() { return getCreative(PRIORITY_BUTTON, ID_BUTTON, ID_BUTTON, "use stone buttons", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); }
public static MPerm getPermLever() { return getCreative(PRIORITY_LEVER, ID_LEVER, ID_LEVER, "use levers", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); }
public static MPerm getPermContainer() { return getCreative(PRIORITY_CONTAINER, ID_CONTAINER, ID_CONTAINER, "use containers", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER), true, true, true); }
public static MPerm getInvite() { return getCreative(PRIORITY_INVITE, ID_INVITE, ID_INVITE, "invite players", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getKick() { return getCreative(PRIORITY_KICK, ID_KICK, ID_KICK, "kick members", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getSethome() { return getCreative(PRIORITY_SETHOME, ID_SETHOME, ID_SETHOME, "set the home", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getWithdraw() { return getCreative(PRIORITY_WITHDRAW, ID_WITHDRAW, ID_WITHDRAW, "withdraw money", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getTerritory() { return getCreative(PRIORITY_TERRITORY, ID_TERRITORY, ID_TERRITORY, "claim or unclaim", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getAccess() { return getCreative(PRIORITY_ACCESS, ID_ACCESS, ID_ACCESS, "grant territory", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getDisband() { return getCreative(PRIORITY_DISBAND, ID_DISBAND, ID_DISBAND, "disband the faction", MUtil.set(Rel.LEADER), false, true, true); }
public static MPerm getFlags() { return getCreative(PRIORITY_FLAGS, ID_FLAGS, ID_FLAGS, "manage flags", MUtil.set(Rel.LEADER), false, true, true); }
public static MPerm getPerms() { return getCreative(PRIORITY_PERMS, ID_PERMS, ID_PERMS, "manage permissions", MUtil.set(Rel.LEADER), false, true, true); }
public static MPerm getPermName() { return getCreative(PRIORITY_NAME, ID_NAME, ID_NAME, "set name", MUtil.set(Rel.LEADER), false, true, true); }
public static MPerm getPermDesc() { return getCreative(PRIORITY_DESC, ID_DESC, ID_DESC, "set description", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermMotd() { return getCreative(PRIORITY_MOTD, ID_MOTD, ID_MOTD, "set motd", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermInvite() { return getCreative(PRIORITY_INVITE, ID_INVITE, ID_INVITE, "invite players", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermKick() { return getCreative(PRIORITY_KICK, ID_KICK, ID_KICK, "kick members", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermTitle() { return getCreative(PRIORITY_TITLE, ID_TITLE, ID_TITLE, "set titles", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermHome() { return getCreative(PRIORITY_HOME, ID_HOME, ID_HOME, "teleport home", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), false, true, true); }
public static MPerm getPermSethome() { return getCreative(PRIORITY_SETHOME, ID_SETHOME, ID_SETHOME, "set the home", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermWithdraw() { return getCreative(PRIORITY_WITHDRAW, ID_WITHDRAW, ID_WITHDRAW, "withdraw money", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermTerritory() { return getCreative(PRIORITY_TERRITORY, ID_TERRITORY, ID_TERRITORY, "claim or unclaim", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermAccess() { return getCreative(PRIORITY_ACCESS, ID_ACCESS, ID_ACCESS, "grant territory", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermRel() { return getCreative(PRIORITY_REL, ID_REL, ID_REL, "change relations", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); }
public static MPerm getPermDisband() { return getCreative(PRIORITY_DISBAND, ID_DISBAND, ID_DISBAND, "disband the faction", MUtil.set(Rel.LEADER), false, true, true); }
public static MPerm getPermFlags() { return getCreative(PRIORITY_FLAGS, ID_FLAGS, ID_FLAGS, "manage flags", MUtil.set(Rel.LEADER), false, true, true); }
public static MPerm getPermPerms() { return getCreative(PRIORITY_PERMS, ID_PERMS, ID_PERMS, "manage permissions", MUtil.set(Rel.LEADER), false, true, true); }
public static MPerm getCreative(int priority, String id, String name, String desc, Set<Rel> standard, boolean territory, boolean editable, boolean visible)
{

View File

@ -710,7 +710,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
return false;
}
if (!MPerm.getTerritory().has(this, newFaction, true))
if (!MPerm.getPermTerritory().has(this, newFaction, true))
{
return false;
}
@ -760,7 +760,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
if (oldFaction.isNormal())
{
if (!MPerm.getTerritory().has(this, oldFaction, false))
if (!MPerm.getPermTerritory().has(this, oldFaction, false))
{
if (!mconf.claimingFromOthersAllowed)
{

View File

@ -88,8 +88,8 @@ public class Econ
// Factions can be controlled by those that have permissions
if (you instanceof Faction)
{
if (i instanceof Faction && MPerm.getWithdraw().has((Faction)i, fYou)) return true;
if (i instanceof MPlayer && MPerm.getWithdraw().has((MPlayer)i, fYou, false)) return true;
if (i instanceof Faction && MPerm.getPermWithdraw().has((Faction)i, fYou)) return true;
if (i instanceof MPlayer && MPerm.getPermWithdraw().has((MPlayer)i, fYou, false)) return true;
}
// Otherwise you may not! ;,,;

View File

@ -802,7 +802,7 @@ public class FactionsListenerMain implements Listener
if (mplayer.isUsingAdminMode()) return true;
if (!MPerm.getBuild().has(mplayer, ps, false) && MPerm.getPainbuild().has(mplayer, ps, false))
if (!MPerm.getPermBuild().has(mplayer, ps, false) && MPerm.getPermPainbuild().has(mplayer, ps, false))
{
if (verboose)
{
@ -817,7 +817,7 @@ public class FactionsListenerMain implements Listener
return true;
}
return MPerm.getBuild().has(mplayer, ps, verboose);
return MPerm.getPermBuild().has(mplayer, ps, verboose);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
@ -907,7 +907,7 @@ public class FactionsListenerMain implements Listener
if (targetFaction == pistonFaction) return;
// if potentially pushing into air/water/lava in another territory, we need to check it out
if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && ! MPerm.getBuild().has(pistonFaction, targetFaction))
if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && ! MPerm.getPermBuild().has(pistonFaction, targetFaction))
{
event.setCancelled(true);
}
@ -937,7 +937,7 @@ public class FactionsListenerMain implements Listener
Faction targetFaction = BoardColl.get().getFactionAt(retractPs);
if (targetFaction == pistonFaction) return;
if (!MPerm.getBuild().has(pistonFaction, targetFaction))
if (!MPerm.getPermBuild().has(pistonFaction, targetFaction))
{
event.setCancelled(true);
}
@ -985,7 +985,7 @@ public class FactionsListenerMain implements Listener
MPlayer mplayer = MPlayer.get(player);
if (mplayer.isUsingAdminMode()) return true;
return MPerm.getBuild().has(mplayer, ps, !justCheck);
return MPerm.getPermBuild().has(mplayer, ps, !justCheck);
}
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck)
@ -999,11 +999,11 @@ public class FactionsListenerMain implements Listener
PS ps = PS.valueOf(block);
Material material = block.getType();
if (MConf.get().materialsEditOnInteract.contains(material) && ! MPerm.getBuild().has(me, ps, ! justCheck)) return false;
if (MConf.get().materialsContainer.contains(material) && ! MPerm.getContainer().has(me, ps, ! justCheck)) return false;
if (MConf.get().materialsDoor.contains(material) && ! MPerm.getDoor().has(me, ps, ! justCheck)) return false;
if (material == Material.STONE_BUTTON && ! MPerm.getButton().has(me, ps, ! justCheck)) return false;
if (material == Material.LEVER && ! MPerm.getLever().has(me, ps, ! justCheck)) return false;
if (MConf.get().materialsEditOnInteract.contains(material) && ! MPerm.getPermBuild().has(me, ps, ! justCheck)) return false;
if (MConf.get().materialsContainer.contains(material) && ! MPerm.getPermContainer().has(me, ps, ! justCheck)) return false;
if (MConf.get().materialsDoor.contains(material) && ! MPerm.getPermDoor().has(me, ps, ! justCheck)) return false;
if (material == Material.STONE_BUTTON && ! MPerm.getPermButton().has(me, ps, ! justCheck)) return false;
if (material == Material.LEVER && ! MPerm.getPermLever().has(me, ps, ! justCheck)) return false;
return true;
}

View File

@ -25,7 +25,6 @@ permissions:
factions.faction: {description: show faction information, default: false}
factions.flag: {description: manage faction flags, default: false}
factions.home: {description: teleport to faction home, default: false}
factions.home.other: {description: teleport to another faction home, default: false}
factions.invite: {description: set if player is invited, default: false}
factions.join: {description: join faction, default: false}
factions.join.any: {description: join closed faction, default: false}
@ -61,7 +60,6 @@ permissions:
factions.unclaim: {description: unclaim land where you stand, default: false}
factions.unclaimall: {description: unclaim all land, default: false}
factions.unsethome: {description: unset faction home, default: false}
factions.unsethome.other: {description: unset other faction home, default: false}
factions.version: {description: see plugin version, default: false}
# -------------------------------------------- #
# STAR NOTATION
@ -83,7 +81,6 @@ permissions:
factions.faction: true
factions.flag: true
factions.home: true
factions.home.other: true
factions.invite: true
factions.join: true
factions.join.any: true
@ -119,7 +116,6 @@ permissions:
factions.unclaim: true
factions.unclaimall: true
factions.unsethome: true
factions.unsethome.other: true
factions.version: true
# -------------------------------------------- #
# KITS
@ -147,8 +143,6 @@ permissions:
children:
factions.kit.rank0: true
factions.admin: true
factions.home.other: true
factions.unsethome.other: true
factions.kit.rank0:
default: false
children: