Some flag tweaks. Use same name scheme as permissions. Also added deposit permission.
This commit is contained in:
parent
662dbb85ed
commit
4286a0c1a0
@ -49,7 +49,7 @@ public class CmdFactionsDisband extends FactionsCommand
|
||||
if ( ! MPerm.getPermDisband().has(msender, faction, true)) return;
|
||||
|
||||
// Verify
|
||||
if (faction.getFlag(MFlag.getPermanent()))
|
||||
if (faction.getFlag(MFlag.getFlagPermanent()))
|
||||
{
|
||||
msg("<i>This faction is designated as permanent, so you cannot disband it.");
|
||||
return;
|
||||
|
@ -78,7 +78,7 @@ public class CmdFactionsFaction extends FactionsCommand
|
||||
|
||||
// INFO: Open
|
||||
// TODO: Why hardcode displaying the open flag only? We should rather display everything publicly editable.
|
||||
msg("<a>Open: <i>"+(faction.getFlag(MFlag.getOpen()) ? "<lime>Yes<i>, anyone can join" : "<rose>No<i>, only invited people can join"));
|
||||
msg("<a>Open: <i>"+(faction.getFlag(MFlag.getFlagOpen()) ? "<lime>Yes<i>, anyone can join" : "<rose>No<i>, only invited people can join"));
|
||||
|
||||
// INFO: Power
|
||||
double powerBoost = faction.getPowerBoost();
|
||||
@ -120,12 +120,12 @@ public class CmdFactionsFaction extends FactionsCommand
|
||||
|
||||
// Display important flags
|
||||
// TODO: Find the non default flags, and display them instead.
|
||||
if (faction.getFlag(MFlag.getPermanent()))
|
||||
if (faction.getFlag(MFlag.getFlagPermanent()))
|
||||
{
|
||||
msg("<a>This faction is permanent - remaining even with no followers.");
|
||||
}
|
||||
|
||||
if (faction.getFlag(MFlag.getPeaceful()))
|
||||
if (faction.getFlag(MFlag.getFlagPeaceful()))
|
||||
{
|
||||
msg("<a>This faction is peaceful - in truce with everyone.");
|
||||
}
|
||||
@ -136,7 +136,7 @@ public class CmdFactionsFaction extends FactionsCommand
|
||||
// List the relations to other factions
|
||||
Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(msender, true);
|
||||
|
||||
if (faction.getFlag(MFlag.getPeaceful()))
|
||||
if (faction.getFlag(MFlag.getFlagPeaceful()))
|
||||
{
|
||||
sendMessage(Txt.parse("<a>In Truce with:<i> *everyone*"));
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class CmdFactionsHome extends FactionsCommandHome
|
||||
(
|
||||
MConf.get().homesTeleportAllowedEnemyDistance > 0
|
||||
&&
|
||||
factionHere.getFlag(MFlag.getPvp())
|
||||
factionHere.getFlag(MFlag.getFlagPvp())
|
||||
&&
|
||||
(
|
||||
! msender.isInOwnTerritory()
|
||||
|
@ -80,7 +80,7 @@ public class CmdFactionsJoin extends FactionsCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! (faction.getFlag(MFlag.getOpen()) || faction.isInvited(mplayer) || msender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
||||
if( ! (faction.getFlag(MFlag.getFlagOpen()) || faction.isInvited(mplayer) || msender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
||||
{
|
||||
msg("<i>This faction requires invitation.");
|
||||
if (samePlayer)
|
||||
|
@ -91,13 +91,13 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
|
||||
|
||||
// TODO: The ally case should work!!
|
||||
// * this might have to be bumped up to make that happen, & allow ALLY,NEUTRAL only
|
||||
if ( newRelation != Rel.TRUCE && otherFaction.getFlag(MFlag.getPeaceful()))
|
||||
if ( newRelation != Rel.TRUCE && otherFaction.getFlag(MFlag.getFlagPeaceful()))
|
||||
{
|
||||
otherFaction.msg("<i>This will have no effect while your faction is peaceful.");
|
||||
msenderFaction.msg("<i>This will have no effect while their faction is peaceful.");
|
||||
}
|
||||
|
||||
if ( newRelation != Rel.TRUCE && msenderFaction.getFlag(MFlag.getPeaceful()))
|
||||
if ( newRelation != Rel.TRUCE && msenderFaction.getFlag(MFlag.getFlagPeaceful()))
|
||||
{
|
||||
otherFaction.msg("<i>This will have no effect while their faction is peaceful.");
|
||||
msenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
|
||||
|
@ -885,7 +885,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
|
||||
public double getPower()
|
||||
{
|
||||
if (this.getFlag(MFlag.getInfpower())) return 999999;
|
||||
if (this.getFlag(MFlag.getFlagInfpower())) return 999999;
|
||||
|
||||
double ret = 0;
|
||||
for (MPlayer mplayer : this.getMPlayers())
|
||||
@ -906,7 +906,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
|
||||
public double getPowerMax()
|
||||
{
|
||||
if (this.getFlag(MFlag.getInfpower())) return 999999;
|
||||
if (this.getFlag(MFlag.getFlagInfpower())) return 999999;
|
||||
|
||||
double ret = 0;
|
||||
for (MPlayer mplayer : this.getMPlayers())
|
||||
@ -1065,7 +1065,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
public void promoteNewLeader()
|
||||
{
|
||||
if ( ! this.isNormal()) return;
|
||||
if (this.getFlag(MFlag.getPermanent()) && MConf.get().permanentFactionsDisableLeaderPromotion) return;
|
||||
if (this.getFlag(MFlag.getFlagPermanent()) && MConf.get().permanentFactionsDisableLeaderPromotion) return;
|
||||
|
||||
MPlayer oldLeader = this.getLeader();
|
||||
|
||||
@ -1079,7 +1079,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
if (replacements == null || replacements.isEmpty())
|
||||
{
|
||||
// faction leader is the only member; one-man faction
|
||||
if (this.getFlag(MFlag.getPermanent()))
|
||||
if (this.getFlag(MFlag.getFlagPermanent()))
|
||||
{
|
||||
if (oldLeader != null)
|
||||
{
|
||||
@ -1142,8 +1142,8 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
|
||||
public boolean isExplosionsAllowed()
|
||||
{
|
||||
boolean explosions = this.getFlag(MFlag.getExplosions());
|
||||
boolean offlineexplosions = this.getFlag(MFlag.getOfflineexplosions());
|
||||
boolean explosions = this.getFlag(MFlag.getFlagExplosions());
|
||||
boolean offlineexplosions = this.getFlag(MFlag.getFlagOfflineexplosions());
|
||||
boolean online = this.isFactionConsideredOnline();
|
||||
|
||||
return (online && explosions) || (!online && offlineexplosions);
|
||||
|
@ -92,24 +92,25 @@ public class FactionColl extends Coll<Faction>
|
||||
faction.setName(ChatColor.DARK_GREEN+"Wilderness");
|
||||
faction.setDescription(null);
|
||||
|
||||
faction.setFlag(MFlag.getOpen(), false);
|
||||
faction.setFlag(MFlag.getPermanent(), true);
|
||||
faction.setFlag(MFlag.getPeaceful(), false);
|
||||
faction.setFlag(MFlag.getInfpower(), true);
|
||||
faction.setFlag(MFlag.getPowerloss(), true);
|
||||
faction.setFlag(MFlag.getPvp(), true);
|
||||
faction.setFlag(MFlag.getFriendlyire(), false);
|
||||
faction.setFlag(MFlag.getMonsters(), true);
|
||||
faction.setFlag(MFlag.getExplosions(), true);
|
||||
faction.setFlag(MFlag.getOfflineexplosions(), true);
|
||||
faction.setFlag(MFlag.getFirespread(), true);
|
||||
faction.setFlag(MFlag.getEndergrief(), true);
|
||||
faction.setFlag(MFlag.getFlagOpen(), false);
|
||||
faction.setFlag(MFlag.getFlagPermanent(), true);
|
||||
faction.setFlag(MFlag.getFlagPeaceful(), false);
|
||||
faction.setFlag(MFlag.getFlagInfpower(), true);
|
||||
faction.setFlag(MFlag.getFlagPowerloss(), true);
|
||||
faction.setFlag(MFlag.getFlagPvp(), true);
|
||||
faction.setFlag(MFlag.getFlagFriendlyire(), false);
|
||||
faction.setFlag(MFlag.getFlagMonsters(), true);
|
||||
faction.setFlag(MFlag.getFlagExplosions(), true);
|
||||
faction.setFlag(MFlag.getFlagOfflineexplosions(), true);
|
||||
faction.setFlag(MFlag.getFlagFirespread(), true);
|
||||
faction.setFlag(MFlag.getFlagEndergrief(), true);
|
||||
|
||||
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);
|
||||
faction.setPermittedRelations(MPerm.getPermDeposit(), Rel.LEADER, Rel.OFFICER); // Wilderness deposit should be limited as an anti spam meassure.
|
||||
|
||||
return faction;
|
||||
}
|
||||
@ -125,18 +126,18 @@ public class FactionColl extends Coll<Faction>
|
||||
faction.setName("SafeZone");
|
||||
faction.setDescription("Free from PVP and monsters");
|
||||
|
||||
faction.setFlag(MFlag.getOpen(), false);
|
||||
faction.setFlag(MFlag.getPermanent(), true);
|
||||
faction.setFlag(MFlag.getPeaceful(), true);
|
||||
faction.setFlag(MFlag.getInfpower(), true);
|
||||
faction.setFlag(MFlag.getPowerloss(), false);
|
||||
faction.setFlag(MFlag.getPvp(), false);
|
||||
faction.setFlag(MFlag.getFriendlyire(), false);
|
||||
faction.setFlag(MFlag.getMonsters(), false);
|
||||
faction.setFlag(MFlag.getExplosions(), false);
|
||||
faction.setFlag(MFlag.getOfflineexplosions(), false);
|
||||
faction.setFlag(MFlag.getFirespread(), false);
|
||||
faction.setFlag(MFlag.getEndergrief(), false);
|
||||
faction.setFlag(MFlag.getFlagOpen(), false);
|
||||
faction.setFlag(MFlag.getFlagPermanent(), true);
|
||||
faction.setFlag(MFlag.getFlagPeaceful(), true);
|
||||
faction.setFlag(MFlag.getFlagInfpower(), true);
|
||||
faction.setFlag(MFlag.getFlagPowerloss(), false);
|
||||
faction.setFlag(MFlag.getFlagPvp(), false);
|
||||
faction.setFlag(MFlag.getFlagFriendlyire(), false);
|
||||
faction.setFlag(MFlag.getFlagMonsters(), false);
|
||||
faction.setFlag(MFlag.getFlagExplosions(), false);
|
||||
faction.setFlag(MFlag.getFlagOfflineexplosions(), false);
|
||||
faction.setFlag(MFlag.getFlagFirespread(), false);
|
||||
faction.setFlag(MFlag.getFlagEndergrief(), false);
|
||||
|
||||
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);
|
||||
@ -158,18 +159,18 @@ public class FactionColl extends Coll<Faction>
|
||||
faction.setName("WarZone");
|
||||
faction.setDescription("Not the safest place to be");
|
||||
|
||||
faction.setFlag(MFlag.getOpen(), false);
|
||||
faction.setFlag(MFlag.getPermanent(), true);
|
||||
faction.setFlag(MFlag.getPeaceful(), true);
|
||||
faction.setFlag(MFlag.getInfpower(), true);
|
||||
faction.setFlag(MFlag.getPowerloss(), true);
|
||||
faction.setFlag(MFlag.getPvp(), true);
|
||||
faction.setFlag(MFlag.getFriendlyire(), true);
|
||||
faction.setFlag(MFlag.getMonsters(), true);
|
||||
faction.setFlag(MFlag.getExplosions(), true);
|
||||
faction.setFlag(MFlag.getOfflineexplosions(), true);
|
||||
faction.setFlag(MFlag.getFirespread(), true);
|
||||
faction.setFlag(MFlag.getEndergrief(), true);
|
||||
faction.setFlag(MFlag.getFlagOpen(), false);
|
||||
faction.setFlag(MFlag.getFlagPermanent(), true);
|
||||
faction.setFlag(MFlag.getFlagPeaceful(), true);
|
||||
faction.setFlag(MFlag.getFlagInfpower(), true);
|
||||
faction.setFlag(MFlag.getFlagPowerloss(), true);
|
||||
faction.setFlag(MFlag.getFlagPvp(), true);
|
||||
faction.setFlag(MFlag.getFlagFriendlyire(), true);
|
||||
faction.setFlag(MFlag.getFlagMonsters(), true);
|
||||
faction.setFlag(MFlag.getFlagExplosions(), true);
|
||||
faction.setFlag(MFlag.getFlagOfflineexplosions(), true);
|
||||
faction.setFlag(MFlag.getFlagFirespread(), true);
|
||||
faction.setFlag(MFlag.getFlagEndergrief(), true);
|
||||
|
||||
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);
|
||||
@ -195,7 +196,7 @@ public class FactionColl extends Coll<Faction>
|
||||
for (Faction faction : this.getAll())
|
||||
{
|
||||
int landCount = faction.getLandCount();
|
||||
if (!faction.getFlag(MFlag.getPeaceful()) && landCount > 0)
|
||||
if (!faction.getFlag(MFlag.getFlagPeaceful()) && landCount > 0)
|
||||
{
|
||||
List<MPlayer> players = faction.getMPlayers();
|
||||
int playerCount = players.size();
|
||||
|
@ -56,32 +56,32 @@ public class MFlag extends Entity<MFlag> implements Prioritized, Registerable
|
||||
|
||||
public static void setupStandardFlags()
|
||||
{
|
||||
getOpen();
|
||||
getMonsters();
|
||||
getPowerloss();
|
||||
getPvp();
|
||||
getFriendlyire();
|
||||
getExplosions();
|
||||
getOfflineexplosions();
|
||||
getFirespread();
|
||||
getEndergrief();
|
||||
getPermanent();
|
||||
getPeaceful();
|
||||
getInfpower();
|
||||
getFlagOpen();
|
||||
getFlagMonsters();
|
||||
getFlagPowerloss();
|
||||
getFlagPvp();
|
||||
getFlagFriendlyire();
|
||||
getFlagExplosions();
|
||||
getFlagOfflineexplosions();
|
||||
getFlagFirespread();
|
||||
getFlagEndergrief();
|
||||
getFlagPermanent();
|
||||
getFlagPeaceful();
|
||||
getFlagInfpower();
|
||||
}
|
||||
|
||||
public static MFlag getOpen() { return getCreative(PRIORITY_OPEN, ID_OPEN, ID_OPEN, "Open factions can be joined without invite.", false, true, true); }
|
||||
public static MFlag getMonsters() { return getCreative(PRIORITY_MONSTERS, ID_MONSTERS, ID_MONSTERS, "Can monsters spawn in this territory?", false, true, true); }
|
||||
public static MFlag getPowerloss() { return getCreative(PRIORITY_POWERLOSS, ID_POWERLOSS, ID_POWERLOSS, "Is power lost on death in this territory?", true, false, true); }
|
||||
public static MFlag getPvp() { return getCreative(PRIORITY_PVP, ID_PVP, ID_PVP, "Can you PVP in territory?", true, false, true); }
|
||||
public static MFlag getFriendlyire() { return getCreative(PRIORITY_FRIENDLYFIRE, ID_FRIENDLYFIRE, ID_FRIENDLYFIRE, "Can friends hurt eachother here?", false, false, true); }
|
||||
public static MFlag getExplosions() { return getCreative(PRIORITY_EXPLOSIONS, ID_EXPLOSIONS, ID_EXPLOSIONS, "Can explosions occur in this territory?", true, false, true); }
|
||||
public static MFlag getOfflineexplosions() { return getCreative(PRIORITY_OFFLINEEXPLOSIONS, ID_OFFLINEEXPLOSIONS, ID_OFFLINEEXPLOSIONS, "Can explosions occur if faction is offline?", false, false, true); }
|
||||
public static MFlag getFirespread() { return getCreative(PRIORITY_FIRESPREAD, ID_FIRESPREAD, ID_FIRESPREAD, "Can fire spread in territory?", true, false, true); }
|
||||
public static MFlag getEndergrief() { return getCreative(PRIORITY_ENDERGRIEF, ID_ENDERGRIEF, ID_ENDERGRIEF, "Can endermen grief in this territory?", false, false, true); }
|
||||
public static MFlag getPermanent() { return getCreative(PRIORITY_PERMANENT, ID_PERMANENT, ID_PERMANENT, "A permanent faction will never be deleted.", false, false, true); }
|
||||
public static MFlag getPeaceful() { return getCreative(PRIORITY_PEACEFUL, ID_PEACEFUL, ID_PEACEFUL, "Always in truce with other factions.", false, false, true); }
|
||||
public static MFlag getInfpower() { return getCreative(PRIORITY_INFPOWER, ID_INFPOWER, ID_INFPOWER, "This flag gives the faction infinite power.", false, false, true); }
|
||||
public static MFlag getFlagOpen() { return getCreative(PRIORITY_OPEN, ID_OPEN, ID_OPEN, "Open factions can be joined without invite.", false, true, true); }
|
||||
public static MFlag getFlagMonsters() { return getCreative(PRIORITY_MONSTERS, ID_MONSTERS, ID_MONSTERS, "Can monsters spawn in this territory?", false, true, true); }
|
||||
public static MFlag getFlagPowerloss() { return getCreative(PRIORITY_POWERLOSS, ID_POWERLOSS, ID_POWERLOSS, "Is power lost on death in this territory?", true, false, true); }
|
||||
public static MFlag getFlagPvp() { return getCreative(PRIORITY_PVP, ID_PVP, ID_PVP, "Can you PVP in territory?", true, false, true); }
|
||||
public static MFlag getFlagFriendlyire() { return getCreative(PRIORITY_FRIENDLYFIRE, ID_FRIENDLYFIRE, ID_FRIENDLYFIRE, "Can friends hurt eachother here?", false, false, true); }
|
||||
public static MFlag getFlagExplosions() { return getCreative(PRIORITY_EXPLOSIONS, ID_EXPLOSIONS, ID_EXPLOSIONS, "Can explosions occur in this territory?", true, false, true); }
|
||||
public static MFlag getFlagOfflineexplosions() { return getCreative(PRIORITY_OFFLINEEXPLOSIONS, ID_OFFLINEEXPLOSIONS, ID_OFFLINEEXPLOSIONS, "Can explosions occur if faction is offline?", false, false, true); }
|
||||
public static MFlag getFlagFirespread() { return getCreative(PRIORITY_FIRESPREAD, ID_FIRESPREAD, ID_FIRESPREAD, "Can fire spread in territory?", true, false, true); }
|
||||
public static MFlag getFlagEndergrief() { return getCreative(PRIORITY_ENDERGRIEF, ID_ENDERGRIEF, ID_ENDERGRIEF, "Can endermen grief in this territory?", false, false, true); }
|
||||
public static MFlag getFlagPermanent() { return getCreative(PRIORITY_PERMANENT, ID_PERMANENT, ID_PERMANENT, "A permanent faction will never be deleted.", false, false, true); }
|
||||
public static MFlag getFlagPeaceful() { return getCreative(PRIORITY_PEACEFUL, ID_PEACEFUL, ID_PEACEFUL, "Always in truce with other factions.", false, false, true); }
|
||||
public static MFlag getFlagInfpower() { return getCreative(PRIORITY_INFPOWER, ID_INFPOWER, ID_INFPOWER, "This flag gives the faction infinite power.", false, false, true); }
|
||||
|
||||
public static MFlag getCreative(int priority, String id, String name, String desc, boolean standard, boolean editable, boolean visible)
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
|
||||
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_DEPOSIT = "deposit";
|
||||
public final static transient String ID_WITHDRAW = "withdraw";
|
||||
public final static transient String ID_TERRITORY = "territory";
|
||||
public final static transient String ID_ACCESS = "access";
|
||||
@ -62,13 +63,14 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
|
||||
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;
|
||||
public final static transient int PRIORITY_DEPOSIT = 15000;
|
||||
public final static transient int PRIORITY_WITHDRAW = 16000;
|
||||
public final static transient int PRIORITY_TERRITORY = 17000;
|
||||
public final static transient int PRIORITY_ACCESS = 18000;
|
||||
public final static transient int PRIORITY_REL = 19000;
|
||||
public final static transient int PRIORITY_DISBAND = 20000;
|
||||
public final static transient int PRIORITY_FLAGS = 21000;
|
||||
public final static transient int PRIORITY_PERMS = 22000;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// META: CORE
|
||||
@ -101,6 +103,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
|
||||
getPermTitle();
|
||||
getPermHome();
|
||||
getPermSethome();
|
||||
getPermDeposit();
|
||||
getPermWithdraw();
|
||||
getPermTerritory();
|
||||
getPermAccess();
|
||||
@ -125,6 +128,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
|
||||
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 getPermDeposit() { return getCreative(PRIORITY_DEPOSIT, ID_DEPOSIT, ID_DEPOSIT, "deposit money", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), false, false, false); } // non editable, non visible.
|
||||
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); }
|
||||
|
@ -734,7 +734,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
{
|
||||
Faction myFaction = this.getFaction();
|
||||
|
||||
boolean permanent = myFaction.getFlag(MFlag.getPermanent());
|
||||
boolean permanent = myFaction.getFlag(MFlag.getFlagPermanent());
|
||||
|
||||
if (myFaction.getMPlayers().size() > 1)
|
||||
{
|
||||
@ -824,7 +824,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
|
||||
int ownedLand = newFaction.getLandCount();
|
||||
|
||||
if (mconf.claimedLandsMax != 0 && ownedLand >= mconf.claimedLandsMax && ! newFaction.getFlag(MFlag.getInfpower()))
|
||||
if (mconf.claimedLandsMax != 0 && ownedLand >= mconf.claimedLandsMax && ! newFaction.getFlag(MFlag.getFlagInfpower()))
|
||||
{
|
||||
msg("<b>Limit reached. You can't claim more land.");
|
||||
return false;
|
||||
|
@ -66,30 +66,30 @@ public class Econ
|
||||
to.msg("<a>%s's<i> balance is <h>%s<i>.", about.describeTo(to, true), Money.format(Money.get(about)));
|
||||
}
|
||||
|
||||
public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you)
|
||||
public static boolean isMePermittedYou(EconomyParticipator me, EconomyParticipator you, MPerm mperm)
|
||||
{
|
||||
Faction fI = RelationUtil.getFaction(i);
|
||||
// Null means special system invocation and is always to be accepted.
|
||||
if (me == null) return true;
|
||||
|
||||
// Always accept when in admin mode.
|
||||
if (me instanceof MPlayer && ((MPlayer)me).isUsingAdminMode()) return true;
|
||||
|
||||
// Always accept control of self
|
||||
if (me == you) return true;
|
||||
|
||||
Faction fMe = RelationUtil.getFaction(me);
|
||||
Faction fYou = RelationUtil.getFaction(you);
|
||||
|
||||
// This is a system invoker. Accept it.
|
||||
if (fI == null) return true;
|
||||
|
||||
// Bypassing players can do any kind of transaction
|
||||
if (i instanceof MPlayer && ((MPlayer)i).isUsingAdminMode()) return true;
|
||||
|
||||
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
|
||||
if (i == you) return true;
|
||||
|
||||
// A faction can always transfer away the money of it's members and its own money...
|
||||
// This will however probably never happen as a faction does not have free will.
|
||||
// Ohh by the way... Yes it could. For daily rent to the faction.
|
||||
if (i == fI && fI == fYou) return true;
|
||||
if (me == fMe && fMe == fYou) return true;
|
||||
|
||||
// Factions can be controlled by those that have permissions
|
||||
if (you instanceof Faction)
|
||||
{
|
||||
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;
|
||||
if (me instanceof Faction && mperm.has((Faction)me, fYou)) return true;
|
||||
if (me instanceof MPlayer && mperm.has((MPlayer)me, fYou, false)) return true;
|
||||
}
|
||||
|
||||
// Otherwise you may not! ;,,;
|
||||
@ -114,10 +114,16 @@ public class Econ
|
||||
to = temp;
|
||||
}
|
||||
|
||||
// Check the rights
|
||||
if ( ! canIControllYou(by, from))
|
||||
// Check Permissions
|
||||
if ( ! isMePermittedYou(by, from, MPerm.getPermWithdraw()))
|
||||
{
|
||||
by.msg("<h>%s<i> lacks permission to control <h>%s's<i> money.", by.describeTo(by, true), from.describeTo(by));
|
||||
by.msg("<h>%s<i> lack permission to withdraw money from <h>%s's<i>.", by.describeTo(by, true), from.describeTo(by));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! isMePermittedYou(by, to, MPerm.getPermDeposit()))
|
||||
{
|
||||
by.msg("<h>%s<i> lack permission to deposit money to <h>%s's<i>.", by.describeTo(by, true), to.describeTo(by));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ public class FactionsListenerMain implements Listener
|
||||
// ... and powerloss can happen here ...
|
||||
Faction faction = BoardColl.get().getFactionAt(PS.valueOf(player));
|
||||
|
||||
if (!faction.getFlag(MFlag.getPowerloss()))
|
||||
if (!faction.getFlag(MFlag.getFlagPowerloss()))
|
||||
{
|
||||
mplayer.msg("<i>You didn't lose any power since the territory you died in works that way.");
|
||||
return;
|
||||
@ -430,7 +430,7 @@ public class FactionsListenerMain implements Listener
|
||||
Faction defenderPsFaction = BoardColl.get().getFactionAt(defenderPs);
|
||||
|
||||
// ... PVP flag may cause a damage block ...
|
||||
if (defenderPsFaction.getFlag(MFlag.getPvp()) == false)
|
||||
if (defenderPsFaction.getFlag(MFlag.getFlagPvp()) == false)
|
||||
{
|
||||
if (eattacker == null)
|
||||
{
|
||||
@ -448,7 +448,7 @@ public class FactionsListenerMain implements Listener
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return defenderPsFaction.getFlag(MFlag.getMonsters());
|
||||
return defenderPsFaction.getFlag(MFlag.getFlagMonsters());
|
||||
}
|
||||
|
||||
// ... and if the attacker is a player ...
|
||||
@ -466,7 +466,7 @@ public class FactionsListenerMain implements Listener
|
||||
// ... PVP flag may cause a damage block ...
|
||||
// (just checking the defender as above isn't enough. What about the attacker? It could be in a no-pvp area)
|
||||
// NOTE: This check is probably not that important but we could keep it anyways.
|
||||
if (attackerPsFaction.getFlag(MFlag.getPvp()) == false)
|
||||
if (attackerPsFaction.getFlag(MFlag.getFlagPvp()) == false)
|
||||
{
|
||||
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, event);
|
||||
if (!ret && notify) uattacker.msg("<i>PVP is disabled in %s.", attackerPsFaction.describeTo(uattacker));
|
||||
@ -503,7 +503,7 @@ public class FactionsListenerMain implements Listener
|
||||
Rel relation = defendFaction.getRelationTo(attackFaction);
|
||||
|
||||
// Check the relation
|
||||
if (udefender.hasFaction() && relation.isFriend() && defenderPsFaction.getFlag(MFlag.getFriendlyire()) == false)
|
||||
if (udefender.hasFaction() && relation.isFriend() && defenderPsFaction.getFlag(MFlag.getFlagFriendlyire()) == false)
|
||||
{
|
||||
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, event);
|
||||
if (!ret && notify) uattacker.msg("<i>You can't hurt %s<i>.", relation.getDescPlayerMany());
|
||||
@ -606,7 +606,7 @@ public class FactionsListenerMain implements Listener
|
||||
command = command.trim();
|
||||
|
||||
// ... the command may be denied for members of permanent factions ...
|
||||
if (mplayer.hasFaction() && mplayer.getFaction().getFlag(MFlag.getPermanent()) && containsCommand(command, MConf.get().denyCommandsPermanentFactionMember))
|
||||
if (mplayer.hasFaction() && mplayer.getFaction().getFlag(MFlag.getFlagPermanent()) && containsCommand(command, MConf.get().denyCommandsPermanentFactionMember))
|
||||
{
|
||||
mplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
|
||||
event.setCancelled(true);
|
||||
@ -673,7 +673,7 @@ public class FactionsListenerMain implements Listener
|
||||
Faction faction = BoardColl.get().getFactionAt(ps);
|
||||
if (faction == null) return;
|
||||
|
||||
if (faction.getFlag(MFlag.getMonsters())) return;
|
||||
if (faction.getFlag(MFlag.getFlagMonsters())) return;
|
||||
|
||||
// ... block the spawn.
|
||||
event.setCancelled(true);
|
||||
@ -692,7 +692,7 @@ public class FactionsListenerMain implements Listener
|
||||
// ... at a place where monsters are forbidden ...
|
||||
PS ps = PS.valueOf(target);
|
||||
Faction faction = BoardColl.get().getFactionAt(ps);
|
||||
if (faction.getFlag(MFlag.getMonsters())) return;
|
||||
if (faction.getFlag(MFlag.getFlagMonsters())) return;
|
||||
|
||||
// ... then if ghast target nothing ...
|
||||
if (event.getEntityType() == EntityType.GHAST)
|
||||
@ -796,7 +796,7 @@ public class FactionsListenerMain implements Listener
|
||||
// ... and the faction there has endergrief disabled ...
|
||||
PS ps = PS.valueOf(event.getBlock());
|
||||
Faction faction = BoardColl.get().getFactionAt(ps);
|
||||
if (faction.getFlag(MFlag.getEndergrief())) return;
|
||||
if (faction.getFlag(MFlag.getFlagEndergrief())) return;
|
||||
|
||||
// ... stop the block alteration.
|
||||
event.setCancelled(true);
|
||||
@ -812,7 +812,7 @@ public class FactionsListenerMain implements Listener
|
||||
PS ps = PS.valueOf(block);
|
||||
Faction faction = BoardColl.get().getFactionAt(ps);
|
||||
|
||||
if (faction.getFlag(MFlag.getFirespread())) return;
|
||||
if (faction.getFlag(MFlag.getFlagFirespread())) return;
|
||||
|
||||
// then cancel the event.
|
||||
cancellable.setCancelled(true);
|
||||
|
@ -108,7 +108,7 @@ public class RelationUtil
|
||||
//P.p.log("getRelationOfThatToMe it was a player and role is "+ret);
|
||||
}
|
||||
}
|
||||
else if (!ignorePeaceful && (thatFaction.getFlag(MFlag.getPeaceful()) || myFaction.getFlag(MFlag.getPeaceful())))
|
||||
else if (!ignorePeaceful && (thatFaction.getFlag(MFlag.getFlagPeaceful()) || myFaction.getFlag(MFlag.getFlagPeaceful())))
|
||||
{
|
||||
ret = Rel.TRUCE;
|
||||
}
|
||||
@ -137,12 +137,12 @@ public class RelationUtil
|
||||
Faction thatFaction = getFaction(that);
|
||||
if (thatFaction != null && thatFaction != getFaction(me))
|
||||
{
|
||||
if (thatFaction.getFlag(MFlag.getFriendlyire()) == true)
|
||||
if (thatFaction.getFlag(MFlag.getFlagFriendlyire()) == true)
|
||||
{
|
||||
return MConf.get().colorFriendlyFire;
|
||||
}
|
||||
|
||||
if (thatFaction.getFlag(MFlag.getPvp()) == false)
|
||||
if (thatFaction.getFlag(MFlag.getFlagPvp()) == false)
|
||||
{
|
||||
return MConf.get().colorNoPVP;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user