In the middle of refactoring to merged role and relation as one enum
This commit is contained in:
@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdAdmin extends FCommand
|
||||
{
|
||||
@ -42,8 +42,8 @@ public class CmdAdmin extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
fme.setRole(Role.MODERATOR);
|
||||
fyou.setRole(Role.ADMIN);
|
||||
fme.setRole(Rel.OFFICER);
|
||||
fyou.setRole(Rel.LEADER);
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
|
@ -8,8 +8,7 @@ import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdCreate extends FCommand
|
||||
{
|
||||
@ -67,7 +66,7 @@ public class CmdCreate extends FCommand
|
||||
}
|
||||
|
||||
faction.setTag(tag);
|
||||
fme.setRole(Role.ADMIN);
|
||||
fme.setRole(Rel.LEADER);
|
||||
fme.setFaction(faction);
|
||||
|
||||
for (FPlayer follower : FPlayers.i.getOnline())
|
||||
|
@ -7,8 +7,7 @@ import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdDisband extends FCommand
|
||||
{
|
||||
@ -40,7 +39,7 @@ public class CmdDisband extends FCommand
|
||||
|
||||
if (isMyFaction)
|
||||
{
|
||||
if ( ! assertMinRole(Role.ADMIN)) return;
|
||||
if ( ! assertMinRole(Rel.LEADER)) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -14,8 +14,7 @@ import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
import com.massivecraft.factions.zcore.util.SmokeUtil;
|
||||
|
||||
public class CmdHome extends FCommand
|
||||
@ -56,7 +55,7 @@ public class CmdHome extends FCommand
|
||||
|
||||
if ( ! myFaction.hasHome())
|
||||
{
|
||||
fme.msg("<b>You faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? "<i> Ask your leader to:" : "<i>You should:"));
|
||||
fme.msg("<b>You faction does not have a home. " + (fme.getRole().isLessThan(Rel.OFFICER) ? "<i> Ask your leader to:" : "<i>You should:"));
|
||||
fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate());
|
||||
return;
|
||||
}
|
||||
@ -105,7 +104,7 @@ public class CmdHome extends FCommand
|
||||
continue;
|
||||
|
||||
FPlayer fp = FPlayers.i.get(p);
|
||||
if (fme.getRelationTo(fp) != Relation.ENEMY)
|
||||
if (fme.getRelationTo(fp) != Rel.ENEMY)
|
||||
continue;
|
||||
|
||||
Location l = p.getLocation();
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdMod extends FCommand
|
||||
{
|
||||
@ -42,16 +42,16 @@ public class CmdMod extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole() == Role.MODERATOR)
|
||||
if (you.getRole() == Rel.OFFICER)
|
||||
{
|
||||
// Revoke
|
||||
you.setRole(Role.NORMAL);
|
||||
you.setRole(Rel.MEMBER);
|
||||
myFaction.msg("%s<i> is no longer moderator in your faction.", you.describeTo(myFaction, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Give
|
||||
you.setRole(Role.MODERATOR);
|
||||
you.setRole(Rel.OFFICER);
|
||||
myFaction.msg("%s<i> was promoted to moderator in your faction.", you.describeTo(myFaction, true));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
|
||||
public class CmdOwner extends FCommand
|
||||
@ -52,7 +52,7 @@ public class CmdOwner extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! hasBypass && !assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.ADMIN))
|
||||
if ( ! hasBypass && !assertMinRole(Conf.ownedAreasModeratorsCanSet ? Rel.OFFICER : Rel.LEADER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdRelationAlly extends FRelationCommand
|
||||
{
|
||||
public CmdRelationAlly()
|
||||
{
|
||||
aliases.add("ally");
|
||||
targetRelation = Relation.ALLY;
|
||||
targetRelation = Rel.ALLY;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdRelationEnemy extends FRelationCommand
|
||||
{
|
||||
public CmdRelationEnemy()
|
||||
{
|
||||
aliases.add("enemy");
|
||||
targetRelation = Relation.ENEMY;
|
||||
targetRelation = Rel.ENEMY;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdRelationNeutral extends FRelationCommand
|
||||
{
|
||||
public CmdRelationNeutral()
|
||||
{
|
||||
aliases.add("neutral");
|
||||
targetRelation = Relation.NEUTRAL;
|
||||
targetRelation = Rel.NEUTRAL;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdSethome extends FCommand
|
||||
{
|
||||
@ -40,7 +40,7 @@ public class CmdSethome extends FCommand
|
||||
// Can the player set the home for this faction?
|
||||
if (faction == myFaction)
|
||||
{
|
||||
if ( ! Permission.SETHOME_ANY.has(sender) && ! assertMinRole(Role.MODERATOR)) return;
|
||||
if ( ! Permission.SETHOME_ANY.has(sender) && ! assertMinRole(Rel.OFFICER)) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdShow extends FCommand
|
||||
{
|
||||
@ -43,9 +43,9 @@ public class CmdShow extends FCommand
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if ( ! payForCommand(Conf.econCostShow, "to show faction information", "for showing faction information")) return;
|
||||
|
||||
Collection<FPlayer> admins = faction.getFPlayersWhereRole(Role.ADMIN);
|
||||
Collection<FPlayer> mods = faction.getFPlayersWhereRole(Role.MODERATOR);
|
||||
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Role.NORMAL);
|
||||
Collection<FPlayer> admins = faction.getFPlayersWhereRole(Rel.LEADER);
|
||||
Collection<FPlayer> mods = faction.getFPlayersWhereRole(Rel.OFFICER);
|
||||
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER);
|
||||
|
||||
msg(p.txt.titleize(faction.getTag(fme)));
|
||||
msg("<a>Description: <i>%s", faction.getDescription());
|
||||
@ -98,11 +98,11 @@ public class CmdShow extends FCommand
|
||||
continue;
|
||||
}
|
||||
listpart = otherFaction.getTag(fme)+p.txt.parse("<i>")+", ";
|
||||
if (otherFaction.getRelationTo(faction).isAlly())
|
||||
if (otherFaction.getRelationTo(faction) == Rel.ALLY)
|
||||
{
|
||||
allyList += listpart;
|
||||
}
|
||||
else if (otherFaction.getRelationTo(faction).isEnemy())
|
||||
else if (otherFaction.getRelationTo(faction) == Rel.ENEMY)
|
||||
{
|
||||
enemyList += listpart;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdUnclaim extends FCommand
|
||||
{
|
||||
@ -74,7 +74,7 @@ public class CmdUnclaim extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR))
|
||||
if ( ! assertMinRole(Rel.OFFICER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
import com.massivecraft.factions.zcore.MCommand;
|
||||
|
||||
|
||||
@ -101,13 +101,13 @@ public abstract class FCommand extends MCommand<P>
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.senderMustBeModerator && ! fplayer.getRole().isAtLeast(Role.MODERATOR))
|
||||
if (this.senderMustBeModerator && ! fplayer.getRole().isAtLeast(Rel.OFFICER))
|
||||
{
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction moderators can %s.", this.getHelpShort()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.senderMustBeAdmin && ! fplayer.getRole().isAtLeast(Role.ADMIN))
|
||||
if (this.senderMustBeAdmin && ! fplayer.getRole().isAtLeast(Rel.LEADER))
|
||||
{
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction admins can %s.", this.getHelpShort()));
|
||||
return false;
|
||||
@ -132,7 +132,7 @@ public abstract class FCommand extends MCommand<P>
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean assertMinRole(Role role)
|
||||
public boolean assertMinRole(Rel role)
|
||||
{
|
||||
if (me == null) return true;
|
||||
|
||||
@ -285,16 +285,16 @@ public abstract class FCommand extends MCommand<P>
|
||||
return false;
|
||||
}
|
||||
|
||||
if (i.getRole().value > you.getRole().value || i.getRole().equals(Role.ADMIN) )
|
||||
if (i.getRole().value > you.getRole().value || i.getRole().equals(Rel.LEADER) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (you.getRole().equals(Role.ADMIN))
|
||||
if (you.getRole().equals(Rel.LEADER))
|
||||
{
|
||||
i.sendMessage(p.txt.parse("<b>Only the faction admin can do that."));
|
||||
}
|
||||
else if (i.getRole().equals(Role.MODERATOR))
|
||||
else if (i.getRole().equals(Rel.OFFICER))
|
||||
{
|
||||
if ( i == you )
|
||||
{
|
||||
|
@ -6,11 +6,11 @@ import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public abstract class FRelationCommand extends FCommand
|
||||
{
|
||||
public Relation targetRelation;
|
||||
public Rel targetRelation;
|
||||
|
||||
public FRelationCommand()
|
||||
{
|
||||
@ -49,7 +49,7 @@ public abstract class FRelationCommand extends FCommand
|
||||
if ( ! payForCommand(targetRelation.getRelationCost(), "to change a relation wish", "for changing a relation wish")) return;
|
||||
|
||||
myFaction.setRelationWish(them, targetRelation);
|
||||
Relation currentRelation = myFaction.getRelationTo(them, true);
|
||||
Rel currentRelation = myFaction.getRelationTo(them, true);
|
||||
ChatColor currentRelationColor = currentRelation.getColor();
|
||||
if (targetRelation.value == currentRelation.value)
|
||||
{
|
||||
@ -63,13 +63,13 @@ public abstract class FRelationCommand extends FCommand
|
||||
myFaction.msg(currentRelationColor+them.getTag()+"<i> were informed that you wish to be "+targetRelation.getColor()+targetRelation);
|
||||
}
|
||||
|
||||
if ( ! targetRelation.isNeutral() && them.isPeaceful())
|
||||
if ( targetRelation != Rel.NEUTRAL && them.isPeaceful())
|
||||
{
|
||||
them.msg("<i>This will have no effect while your faction is peaceful.");
|
||||
myFaction.msg("<i>This will have no effect while their faction is peaceful.");
|
||||
}
|
||||
|
||||
if ( ! targetRelation.isNeutral() && myFaction.isPeaceful())
|
||||
if ( targetRelation != Rel.NEUTRAL && myFaction.isPeaceful())
|
||||
{
|
||||
them.msg("<i>This will have no effect while their faction is peaceful.");
|
||||
myFaction.msg("<i>This will have no effect while your faction is peaceful.");
|
||||
|
Reference in New Issue
Block a user