Fixed ownerlist command (though not sure just why it was failing as written, I need to investigate further), working on restructuring and fixing ownership handling for block placement/destruction/interaction/usage. Will finish that up in the next day or two.

This commit is contained in:
Brettflan 2011-10-11 20:14:59 -05:00
parent d37a4d6ff7
commit 0326a6e938
4 changed files with 16 additions and 59 deletions

View File

@ -127,7 +127,7 @@ permissions:
factions.managewarzone: factions.managewarzone:
description: claim land as a war zone and build/destroy within war zones description: claim land as a war zone and build/destroy within war zones
factions.map: factions.map:
description: show territory map, set optional auto update description: show the territory map, and set optional auto update
factions.mod: factions.mod:
description: give or revoke moderator rights description: give or revoke moderator rights
factions.noboom: factions.noboom:

View File

@ -582,14 +582,8 @@ public class Faction extends Entity
public boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc) public boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc)
{ {
// different faction?
if (fplayer.getFactionId() != this.getId())
{
return false;
}
// sufficient role to bypass ownership? // sufficient role to bypass ownership?
if (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.ADMIN)) if (fplayer.getFaction() == this && fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.ADMIN))
{ {
return true; return true;
} }

View File

@ -44,7 +44,7 @@ public class CmdOwnerList extends FCommand
FLocation flocation = new FLocation(fme); FLocation flocation = new FLocation(fme);
if (Board.getIdAt(flocation) != myFaction.getId()) if (Board.getFactionAt(flocation) != myFaction)
{ {
if (!hasBypass) if (!hasBypass)
{ {

View File

@ -26,25 +26,24 @@ public enum Relation
return this.nicename; return this.nicename;
} }
// TODO: Insane way to use enums!!!?
public boolean isMember() public boolean isMember()
{ {
return this.value == MEMBER.value; return this == MEMBER;
} }
public boolean isAlly() public boolean isAlly()
{ {
return this.value == ALLY.value; return this == ALLY;
} }
public boolean isNeutral() public boolean isNeutral()
{ {
return this.value == NEUTRAL.value; return this == NEUTRAL;
} }
public boolean isEnemy() public boolean isEnemy()
{ {
return this.value == ENEMY.value; return this == ENEMY;
} }
public boolean isAtLeast(Relation relation) public boolean isAtLeast(Relation relation)
@ -60,123 +59,87 @@ public enum Relation
public ChatColor getColor() public ChatColor getColor()
{ {
if (this.value == MEMBER.value) if (this.value == MEMBER.value)
{
return Conf.colorMember; return Conf.colorMember;
}
else if (this.value == ALLY.value) else if (this.value == ALLY.value)
{
return Conf.colorAlly; return Conf.colorAlly;
}
else if (this.value == NEUTRAL.value) else if (this.value == NEUTRAL.value)
{
return Conf.colorNeutral; return Conf.colorNeutral;
}
else else
{
return Conf.colorEnemy; return Conf.colorEnemy;
} }
}
// return appropriate Conf setting for DenyBuild based on this relation and their online status // return appropriate Conf setting for DenyBuild based on this relation and their online status
public boolean confDenyBuild(boolean online) public boolean confDenyBuild(boolean online)
{ {
if (isMember())
return false;
if (online) if (online)
{ {
if (isEnemy()) if (isEnemy())
{
return Conf.territoryEnemyDenyBuild; return Conf.territoryEnemyDenyBuild;
}
else if (isAlly()) else if (isAlly())
{
return Conf.territoryAllyDenyBuild; return Conf.territoryAllyDenyBuild;
}
else else
{
return Conf.territoryDenyBuild; return Conf.territoryDenyBuild;
} }
}
else else
{ {
if (isEnemy()) if (isEnemy())
{
return Conf.territoryEnemyDenyBuildWhenOffline; return Conf.territoryEnemyDenyBuildWhenOffline;
}
else if (isAlly()) else if (isAlly())
{
return Conf.territoryAllyDenyBuildWhenOffline; return Conf.territoryAllyDenyBuildWhenOffline;
}
else else
{
return Conf.territoryDenyBuildWhenOffline; return Conf.territoryDenyBuildWhenOffline;
} }
} }
}
// return appropriate Conf setting for PainBuild based on this relation and their online status // return appropriate Conf setting for PainBuild based on this relation and their online status
public boolean confPainBuild(boolean online) public boolean confPainBuild(boolean online)
{ {
if (isMember())
return false;
if (online) if (online)
{ {
if (isEnemy()) if (isEnemy())
{
return Conf.territoryEnemyPainBuild; return Conf.territoryEnemyPainBuild;
}
else if (isAlly()) else if (isAlly())
{
return Conf.territoryAllyPainBuild; return Conf.territoryAllyPainBuild;
}
else else
{
return Conf.territoryPainBuild; return Conf.territoryPainBuild;
} }
}
else else
{ {
if (isEnemy()) if (isEnemy())
{
return Conf.territoryEnemyPainBuildWhenOffline; return Conf.territoryEnemyPainBuildWhenOffline;
}
else if (isAlly()) else if (isAlly())
{
return Conf.territoryAllyPainBuildWhenOffline; return Conf.territoryAllyPainBuildWhenOffline;
}
else else
{
return Conf.territoryPainBuildWhenOffline; return Conf.territoryPainBuildWhenOffline;
} }
} }
}
// return appropriate Conf setting for DenyUseage based on this relation // return appropriate Conf setting for DenyUseage based on this relation
public boolean confDenyUseage() public boolean confDenyUseage()
{ {
if (isEnemy()) if (isMember())
{ return false;
else if (isEnemy())
return Conf.territoryEnemyDenyUseage; return Conf.territoryEnemyDenyUseage;
}
else if (isAlly()) else if (isAlly())
{
return Conf.territoryAllyDenyUseage; return Conf.territoryAllyDenyUseage;
}
else else
{
return Conf.territoryDenyUseage; return Conf.territoryDenyUseage;
} }
}
public double getRelationCost() public double getRelationCost()
{ {
if (isEnemy()) if (isEnemy())
{
return Conf.econCostEnemy; return Conf.econCostEnemy;
}
else if (isAlly()) else if (isAlly())
{
return Conf.econCostAlly; return Conf.econCostAlly;
}
else else
{
return Conf.econCostNeutral; return Conf.econCostNeutral;
} }
}
} }