asdf
This commit is contained in:
parent
5f437b1862
commit
8eec55e37e
@ -17,7 +17,6 @@ import com.massivecraft.factions.Factions;
|
|||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.struct.FPerm;
|
import com.massivecraft.factions.struct.FPerm;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
|
||||||
import com.massivecraft.factions.util.RelationUtil;
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
|
|
||||||
public class Econ
|
public class Econ
|
||||||
@ -95,9 +94,6 @@ public class Econ
|
|||||||
// Bypassing players can do any kind of transaction
|
// Bypassing players can do any kind of transaction
|
||||||
if (i instanceof FPlayer && ((FPlayer)i).isAdminBypassing()) return true;
|
if (i instanceof FPlayer && ((FPlayer)i).isAdminBypassing()) return true;
|
||||||
|
|
||||||
// Players with the any withdraw can do.
|
|
||||||
if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer)i).getPlayer())) return true;
|
|
||||||
|
|
||||||
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
|
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
|
||||||
if (i == you) return true;
|
if (i == you) return true;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public enum FFlag
|
|||||||
MONSTERS("monsters", "<i>Can monsters spawn in this territory?", true, false),
|
MONSTERS("monsters", "<i>Can monsters spawn in this territory?", true, false),
|
||||||
EXPLOSIONS("explosions", "<i>Can explosions occur in this territory?", true, false),
|
EXPLOSIONS("explosions", "<i>Can explosions occur in this territory?", true, false),
|
||||||
FIRESPREAD("firespread", "<i>Can fire spread in territory?", true, false),
|
FIRESPREAD("firespread", "<i>Can fire spread in territory?", true, false),
|
||||||
LIGHTNING("lightning", "<i>Can lightning strike in this territory?", true, false),
|
//LIGHTNING("lightning", "<i>Can lightning strike in this territory?", true, false), Possible to add later.
|
||||||
ENDERGRIEF("endergrief", "<i>Can endermen grief in this territory?", false, true),
|
ENDERGRIEF("endergrief", "<i>Can endermen grief in this territory?", false, true),
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -86,13 +86,13 @@ public enum FFlag
|
|||||||
if (str.startsWith("m")) return MONSTERS;
|
if (str.startsWith("m")) return MONSTERS;
|
||||||
if (str.startsWith("e")) return EXPLOSIONS;
|
if (str.startsWith("e")) return EXPLOSIONS;
|
||||||
if (str.startsWith("fi")) return FIRESPREAD;
|
if (str.startsWith("fi")) return FIRESPREAD;
|
||||||
if (str.startsWith("l")) return LIGHTNING;
|
//if (str.startsWith("l")) return LIGHTNING;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStateInfo(boolean value, boolean withDesc)
|
public String getStateInfo(boolean value, boolean withDesc)
|
||||||
{
|
{
|
||||||
String ret = (value ? "<g>YES" : "<b>NOO") + "<h> " + this.getNicename();
|
String ret = (value ? "<g>YES" : "<b>NOO") + "<c> " + this.getNicename();
|
||||||
if (withDesc)
|
if (withDesc)
|
||||||
{
|
{
|
||||||
ret += " " + this.getDescription();
|
ret += " " + this.getDescription();
|
||||||
|
@ -14,7 +14,6 @@ import com.massivecraft.factions.FLocation;
|
|||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.iface.RelationParticipator;
|
import com.massivecraft.factions.iface.RelationParticipator;
|
||||||
import com.massivecraft.factions.util.RelationUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permissions that you (a player) may or may not have in the territory of a certain faction.
|
* Permissions that you (a player) may or may not have in the territory of a certain faction.
|
||||||
@ -103,7 +102,7 @@ public enum FPerm
|
|||||||
ret += " ";
|
ret += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
ret +="<h>"+this.getNicename();
|
ret +="<c>"+this.getNicename();
|
||||||
if (withDesc)
|
if (withDesc)
|
||||||
{
|
{
|
||||||
ret += " <i>" + this.getDescription();
|
ret += " <i>" + this.getDescription();
|
||||||
@ -149,8 +148,15 @@ public enum FPerm
|
|||||||
private static final String errorpattern = "<b>%s<b> can't %s in the territory of %s<b>.";
|
private static final String errorpattern = "<b>%s<b> can't %s in the territory of %s<b>.";
|
||||||
public boolean has(RelationParticipator testSubject, Faction hostFaction, boolean informIfNot)
|
public boolean has(RelationParticipator testSubject, Faction hostFaction, boolean informIfNot)
|
||||||
{
|
{
|
||||||
Faction factionDoer = RelationUtil.getFaction(testSubject);
|
//Faction factionDoer = RelationUtil.getFaction(testSubject);
|
||||||
boolean ret = hostFaction.getPermittedRelations(this).contains(hostFaction.getRelationTo(factionDoer));
|
//P.p.log("Testing the permission "+this.toString()+" for a "+testSubject.getClass().getSimpleName());
|
||||||
|
//P.p.log("hostFaction: "+hostFaction);
|
||||||
|
Rel rel = testSubject.getRelationTo(hostFaction);
|
||||||
|
|
||||||
|
//P.p.log("rel: "+rel);
|
||||||
|
|
||||||
|
boolean ret = hostFaction.getPermittedRelations(this).contains(rel);
|
||||||
|
|
||||||
if (!ret && informIfNot && testSubject instanceof FPlayer)
|
if (!ret && informIfNot && testSubject instanceof FPlayer)
|
||||||
{
|
{
|
||||||
FPlayer fplayer = (FPlayer)testSubject;
|
FPlayer fplayer = (FPlayer)testSubject;
|
||||||
|
@ -16,7 +16,7 @@ public enum Permission
|
|||||||
DEINVITE("deinvite"),
|
DEINVITE("deinvite"),
|
||||||
DESCRIPTION("description"),
|
DESCRIPTION("description"),
|
||||||
DISBAND("disband"),
|
DISBAND("disband"),
|
||||||
DISBAND_ANY("disband.any"),
|
DISBAND_ANY("disband.any"), // WHAT TO DO?
|
||||||
FLAG("flag"),
|
FLAG("flag"),
|
||||||
FLAG_ANY("flag.any"),
|
FLAG_ANY("flag.any"),
|
||||||
PERM("perm"),
|
PERM("perm"),
|
||||||
@ -36,7 +36,7 @@ public enum Permission
|
|||||||
MONEY_BALANCE_ANY("money.balance.any"),
|
MONEY_BALANCE_ANY("money.balance.any"),
|
||||||
MONEY_DEPOSIT("money.deposit"),
|
MONEY_DEPOSIT("money.deposit"),
|
||||||
MONEY_WITHDRAW("money.withdraw"),
|
MONEY_WITHDRAW("money.withdraw"),
|
||||||
MONEY_WITHDRAW_ANY("money.withdraw.any"),
|
MONEY_WITHDRAW_ANY("money.withdraw.any"), // WHAT TO DO?
|
||||||
MONEY_F2F("money.f2f"),
|
MONEY_F2F("money.f2f"),
|
||||||
MONEY_F2P("money.f2p"),
|
MONEY_F2P("money.f2p"),
|
||||||
MONEY_P2F("money.p2f"),
|
MONEY_P2F("money.p2f"),
|
||||||
@ -48,7 +48,7 @@ public enum Permission
|
|||||||
RELOAD("reload"),
|
RELOAD("reload"),
|
||||||
SAVE("save"),
|
SAVE("save"),
|
||||||
SETHOME("sethome"),
|
SETHOME("sethome"),
|
||||||
SETHOME_ANY("sethome.any"),
|
SETHOME_ANY("sethome.any"), // WHAT TO DO?
|
||||||
SHOW("show"),
|
SHOW("show"),
|
||||||
TAG("tag"),
|
TAG("tag"),
|
||||||
TITLE("title"),
|
TITLE("title"),
|
||||||
|
@ -70,39 +70,41 @@ public class RelationUtil
|
|||||||
|
|
||||||
public static Rel getRelationOfThatToMe(RelationParticipator that, RelationParticipator me)
|
public static Rel getRelationOfThatToMe(RelationParticipator that, RelationParticipator me)
|
||||||
{
|
{
|
||||||
return getRelationOfThatToMe(me, that, false);
|
return getRelationOfThatToMe(that, me, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Rel getRelationOfThatToMe(RelationParticipator that, RelationParticipator me, boolean ignorePeaceful)
|
public static Rel getRelationOfThatToMe(RelationParticipator that, RelationParticipator me, boolean ignorePeaceful)
|
||||||
{
|
{
|
||||||
Rel ret = null;
|
Rel ret = null;
|
||||||
|
|
||||||
Faction fthat = getFaction(me);
|
Faction myFaction = getFaction(me);
|
||||||
if (fthat == null) return Rel.NEUTRAL; // ERROR
|
if (myFaction == null) return Rel.NEUTRAL; // ERROR
|
||||||
|
|
||||||
Faction fme = getFaction(that);
|
Faction thatFaction = getFaction(that);
|
||||||
if (fme == null) return Rel.NEUTRAL; // ERROR
|
if (thatFaction == null) return Rel.NEUTRAL; // ERROR
|
||||||
|
|
||||||
// The faction with the lowest wish "wins"
|
// The faction with the lowest wish "wins"
|
||||||
if (fme.getRelationWish(fthat).isLessThan(fthat.getRelationWish(fme)))
|
if (thatFaction.getRelationWish(myFaction).isLessThan(myFaction.getRelationWish(thatFaction)))
|
||||||
{
|
{
|
||||||
ret = fme.getRelationWish(fthat);
|
ret = thatFaction.getRelationWish(myFaction);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = fthat.getRelationWish(fme);
|
ret = myFaction.getRelationWish(thatFaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fthat.equals(fme))
|
if (myFaction.equals(thatFaction))
|
||||||
{
|
{
|
||||||
ret = Rel.MEMBER;
|
ret = Rel.MEMBER;
|
||||||
// Do officer and leader check
|
// Do officer and leader check
|
||||||
|
//P.p.log("getRelationOfThatToMe the factions are the same for "+that.getClass().getSimpleName()+" and observer "+me.getClass().getSimpleName());
|
||||||
if (that instanceof FPlayer)
|
if (that instanceof FPlayer)
|
||||||
{
|
{
|
||||||
ret = ((FPlayer)that).getRole();
|
ret = ((FPlayer)that).getRole();
|
||||||
|
//P.p.log("getRelationOfThatToMe it was a player and role is "+ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!ignorePeaceful && (fme.getFlag(FFlag.PEACEFUL) || fthat.getFlag(FFlag.PEACEFUL)))
|
else if (!ignorePeaceful && (thatFaction.getFlag(FFlag.PEACEFUL) || myFaction.getFlag(FFlag.PEACEFUL)))
|
||||||
{
|
{
|
||||||
ret = Rel.TRUCE;
|
ret = Rel.TRUCE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user