Merged Relation and Role into one enum

This commit is contained in:
Olof Larsson 2011-10-23 17:55:53 +02:00
parent e6ff84ad9a
commit 842844969b
64 changed files with 254 additions and 363 deletions

View File

@ -48,7 +48,7 @@ permissions:
factions.kit.halfplayer: factions.kit.halfplayer:
description: Can do all but create factions. description: Can do all but create factions.
children: children:
factions.admin: true factions.leader: true
factions.autoclaim: true factions.autoclaim: true
factions.chat: true factions.chat: true
factions.claim: true factions.claim: true
@ -63,7 +63,7 @@ permissions:
factions.leave: true factions.leave: true
factions.list: true factions.list: true
factions.map: true factions.map: true
factions.mod: true factions.officer: true
factions.money.kit.standard: true factions.money.kit.standard: true
factions.noboom: true factions.noboom: true
factions.open: true factions.open: true
@ -79,8 +79,8 @@ permissions:
factions.version: true factions.version: true
factions.unclaim: true factions.unclaim: true
factions.unclaimall: true factions.unclaimall: true
factions.admin: factions.leader:
description: hand over your admin rights description: hand over your leader rights
factions.autoclaim: factions.autoclaim:
description: auto-claim land as you walk around description: auto-claim land as you walk around
factions.bypass: factions.bypass:
@ -125,8 +125,8 @@ permissions:
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 the territory map, and set optional auto update description: show the territory map, and set optional auto update
factions.mod: factions.officer:
description: give or revoke moderator rights description: give or revoke officer rights
factions.money.balance: factions.money.balance:
description: show your factions current money balance description: show your factions current money balance
factions.money.balance.any: factions.money.balance.any:

View File

@ -30,8 +30,8 @@ public class Conf
public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less
public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts) public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts)
public static String prefixAdmin = "**"; public static String prefixLeader = "**";
public static String prefixMod = "*"; public static String prefixOfficer = "*";
public static int factionTagLengthMin = 3; public static int factionTagLengthMin = 3;
public static int factionTagLengthMax = 10; public static int factionTagLengthMax = 10;
@ -181,8 +181,8 @@ public class Conf
// Spout features // Spout features
public static boolean spoutFactionTagsOverNames = true; // show faction tags over names over player heads public static boolean spoutFactionTagsOverNames = true; // show faction tags over names over player heads
public static boolean spoutFactionTitlesOverNames = true; // whether to include player's title in that public static boolean spoutFactionTitlesOverNames = true; // whether to include player's title in that
public static boolean spoutFactionAdminCapes = true; // Show capes on faction admins, colored based on the viewer's relation to the target player public static boolean spoutFactionLeaderCapes = true; // Show capes on faction admins, colored based on the viewer's relation to the target player
public static boolean spoutFactionModeratorCapes = true; // same, but for faction moderators public static boolean spoutFactionOfficerCapes = true; // same, but for faction moderators
public static int spoutTerritoryDisplayPosition = 3; // permanent territory display, instead of by chat; 0 = disabled, 1 = top left, 2 = top center, 3+ = top right public static int spoutTerritoryDisplayPosition = 3; // permanent territory display, instead of by chat; 0 = disabled, 1 = top left, 2 = top center, 3+ = top right
public static float spoutTerritoryDisplaySize = 1.0f; // text scale (size) for territory display public static float spoutTerritoryDisplaySize = 1.0f; // text scale (size) for territory display
public static boolean spoutTerritoryDisplayShowDescription = true; // whether to show the faction description, not just the faction tag public static boolean spoutTerritoryDisplayShowDescription = true; // whether to show the faction description, not just the faction tag

View File

@ -348,7 +348,7 @@ public class Faction extends Entity implements EconomyParticipator
return ret; return ret;
} }
public FPlayer getFPlayerAdmin() public FPlayer getFPlayerLeader()
{ {
if ( ! this.isNormal()) return null; if ( ! this.isNormal()) return null;

View File

@ -24,8 +24,10 @@ import com.massivecraft.factions.listeners.FactionsEntityListener;
import com.massivecraft.factions.listeners.FactionsPlayerListener; import com.massivecraft.factions.listeners.FactionsPlayerListener;
import com.massivecraft.factions.listeners.FactionsServerListener; import com.massivecraft.factions.listeners.FactionsServerListener;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Rel;
import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter; import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter;
import com.massivecraft.factions.util.MyLocationTypeAdapter; import com.massivecraft.factions.util.MyLocationTypeAdapter;
import com.massivecraft.factions.util.MyRelTypeAdapter;
import com.massivecraft.factions.zcore.MPlugin; import com.massivecraft.factions.zcore.MPlugin;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
@ -148,7 +150,8 @@ public class P extends MPlugin
.disableHtmlEscaping() .disableHtmlEscaping()
.excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE) .excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE)
.registerTypeAdapter(Location.class, new MyLocationTypeAdapter()) .registerTypeAdapter(Location.class, new MyLocationTypeAdapter())
.registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter()); .registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter())
.registerTypeAdapter(Rel.class, new MyRelTypeAdapter());
} }
@Override @Override

View File

@ -18,8 +18,8 @@ public class CmdAutoClaim extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -18,8 +18,8 @@ public class CmdBoom extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -18,8 +18,8 @@ public class CmdBypass extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -21,8 +21,8 @@ public class CmdChat extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -19,8 +19,8 @@ public class CmdClaim extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
aliases.add("claim"); aliases.add("claim");
} }

View File

@ -32,8 +32,8 @@ public class CmdConfig extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -25,8 +25,8 @@ public class CmdCreate extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -20,8 +20,8 @@ public class CmdDeinvite extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -22,8 +22,8 @@ public class CmdDescription extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -24,8 +24,8 @@ public class CmdDisband extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -26,8 +26,8 @@ public class CmdHelp extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override
@ -105,8 +105,8 @@ public class CmdHelp extends FCommand
pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdKick.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdKick.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdMod.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdOfficer.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdAdmin.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdLeader.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate(true) );
pageLines.add( p.txt.parse("<i>Player titles are just for fun. No rules connected to them." )); pageLines.add( p.txt.parse("<i>Player titles are just for fun. No rules connected to them." ));
helpPages.add(pageLines); helpPages.add(pageLines);

View File

@ -33,8 +33,8 @@ public class CmdHome extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -20,8 +20,8 @@ public class CmdInvite extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -19,8 +19,8 @@ public class CmdJoin extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -22,8 +22,8 @@ public class CmdKick extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -5,23 +5,23 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.struct.Rel;
public class CmdAdmin extends FCommand public class CmdLeader extends FCommand
{ {
public CmdAdmin() public CmdLeader()
{ {
super(); super();
this.aliases.add("admin"); this.aliases.add("leader");
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.ADMIN.node; this.permission = Permission.LEADER.node;
this.disableOnLock = true; this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = true; senderMustBeLeader = true;
} }
@Override @Override

View File

@ -17,8 +17,8 @@ public class CmdLeave extends FCommand {
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -27,8 +27,8 @@ public class CmdList extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -24,8 +24,8 @@ public class CmdLock extends FCommand {
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -21,8 +21,8 @@ public class CmdMap extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -23,8 +23,8 @@ public class CmdMoney extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
this.setHelpShort("faction money commands"); this.setHelpShort("faction money commands");
this.helpLong.add(p.txt.parseTags("<i>The faction money commands.")); this.helpLong.add(p.txt.parseTags("<i>The faction money commands."));

View File

@ -20,8 +20,8 @@ public class CmdMoneyBalance extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -22,8 +22,8 @@ public class CmdMoneyDeposit extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -22,8 +22,8 @@ public class CmdMoneyTransferFf extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -22,8 +22,8 @@ public class CmdMoneyTransferFp extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -22,8 +22,8 @@ public class CmdMoneyTransferPf extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -19,8 +19,8 @@ public class CmdMoneyWithdraw extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -4,24 +4,24 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.struct.Rel;
public class CmdMod extends FCommand public class CmdOfficer extends FCommand
{ {
public CmdMod() public CmdOfficer()
{ {
super(); super();
this.aliases.add("mod"); this.aliases.add("officer");
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.MOD.node; this.permission = Permission.OFFICER.node;
this.disableOnLock = true; this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = true; senderMustBeLeader = true;
} }
@Override @Override

View File

@ -20,8 +20,8 @@ public class CmdOpen extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -26,8 +26,8 @@ public class CmdOwner extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
// TODO: Fix colors! // TODO: Fix colors!

View File

@ -22,8 +22,8 @@ public class CmdOwnerList extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -22,8 +22,8 @@ public class CmdPeaceful extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -21,8 +21,8 @@ public class CmdPermanent extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -19,8 +19,8 @@ public class CmdPermanentPower extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -21,8 +21,8 @@ public class CmdPower extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -23,8 +23,8 @@ public class CmdReload extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -20,8 +20,8 @@ public class CmdSafeunclaimall extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
this.setHelpShort("Unclaim all safezone land"); this.setHelpShort("Unclaim all safezone land");
} }

View File

@ -23,8 +23,8 @@ public class CmdSaveAll extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -21,8 +21,8 @@ public class CmdSethome extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -26,8 +26,8 @@ public class CmdShow extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -24,8 +24,8 @@ public class CmdTag extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -20,8 +20,8 @@ public class CmdTitle extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -24,8 +24,8 @@ public class CmdUnclaim extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -21,8 +21,8 @@ public class CmdUnclaimall extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -18,8 +18,8 @@ public class CmdVersion extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -20,8 +20,8 @@ public class CmdWarunclaimall extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
this.setHelpShort("unclaim all warzone land"); this.setHelpShort("unclaim all warzone land");
} }

View File

@ -6,7 +6,7 @@ import com.massivecraft.factions.Conf;
public class FCmdRoot extends FCommand public class FCmdRoot extends FCommand
{ {
public CmdAdmin cmdAdmin = new CmdAdmin(); public CmdLeader cmdLeader = new CmdLeader();
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim(); public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
public CmdBoom cmdBoom = new CmdBoom(); public CmdBoom cmdBoom = new CmdBoom();
public CmdBypass cmdBypass = new CmdBypass(); public CmdBypass cmdBypass = new CmdBypass();
@ -26,7 +26,7 @@ public class FCmdRoot extends FCommand
public CmdList cmdList = new CmdList(); public CmdList cmdList = new CmdList();
public CmdLock cmdLock = new CmdLock(); public CmdLock cmdLock = new CmdLock();
public CmdMap cmdMap = new CmdMap(); public CmdMap cmdMap = new CmdMap();
public CmdMod cmdMod = new CmdMod(); public CmdOfficer cmdOfficer = new CmdOfficer();
public CmdMoney cmdMoney = new CmdMoney(); public CmdMoney cmdMoney = new CmdMoney();
public CmdOpen cmdOpen = new CmdOpen(); public CmdOpen cmdOpen = new CmdOpen();
public CmdOwner cmdOwner = new CmdOwner(); public CmdOwner cmdOwner = new CmdOwner();
@ -62,8 +62,8 @@ public class FCmdRoot extends FCommand
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
this.disableOnLock = false; this.disableOnLock = false;
@ -72,7 +72,7 @@ public class FCmdRoot extends FCommand
//this.subCommands.add(p.cmdHelp); //this.subCommands.add(p.cmdHelp);
this.addSubCommand(this.cmdAdmin); this.addSubCommand(this.cmdLeader);
this.addSubCommand(this.cmdAutoClaim); this.addSubCommand(this.cmdAutoClaim);
this.addSubCommand(this.cmdBoom); this.addSubCommand(this.cmdBoom);
this.addSubCommand(this.cmdBypass); this.addSubCommand(this.cmdBypass);
@ -92,7 +92,7 @@ public class FCmdRoot extends FCommand
this.addSubCommand(this.cmdList); this.addSubCommand(this.cmdList);
this.addSubCommand(this.cmdLock); this.addSubCommand(this.cmdLock);
this.addSubCommand(this.cmdMap); this.addSubCommand(this.cmdMap);
this.addSubCommand(this.cmdMod); this.addSubCommand(this.cmdOfficer);
this.addSubCommand(this.cmdMoney); this.addSubCommand(this.cmdMoney);
this.addSubCommand(this.cmdOpen); this.addSubCommand(this.cmdOpen);
this.addSubCommand(this.cmdOwner); this.addSubCommand(this.cmdOwner);

View File

@ -23,8 +23,8 @@ public abstract class FCommand extends MCommand<P>
public FPlayer fme; public FPlayer fme;
public Faction myFaction; public Faction myFaction;
public boolean senderMustBeMember; public boolean senderMustBeMember;
public boolean senderMustBeModerator; public boolean senderMustBeOfficer;
public boolean senderMustBeAdmin; public boolean senderMustBeLeader;
public boolean isMoneyCommand; public boolean isMoneyCommand;
@ -39,8 +39,8 @@ public abstract class FCommand extends MCommand<P>
isMoneyCommand = false; isMoneyCommand = false;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeOfficer = false;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override
@ -89,7 +89,7 @@ public abstract class FCommand extends MCommand<P>
boolean superValid = super.validSenderType(sender, informSenderIfNot); boolean superValid = super.validSenderType(sender, informSenderIfNot);
if ( ! superValid) return false; if ( ! superValid) return false;
if ( ! (this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin)) return true; if ( ! (this.senderMustBeMember || this.senderMustBeOfficer || this.senderMustBeLeader)) return true;
if ( ! (sender instanceof Player)) return false; if ( ! (sender instanceof Player)) return false;
@ -101,13 +101,13 @@ public abstract class FCommand extends MCommand<P>
return false; return false;
} }
if (this.senderMustBeModerator && ! fplayer.getRole().isAtLeast(Rel.OFFICER)) if (this.senderMustBeOfficer && ! fplayer.getRole().isAtLeast(Rel.OFFICER))
{ {
sender.sendMessage(p.txt.parse("<b>Only faction moderators can %s.", this.getHelpShort())); sender.sendMessage(p.txt.parse("<b>Only faction moderators can %s.", this.getHelpShort()));
return false; return false;
} }
if (this.senderMustBeAdmin && ! fplayer.getRole().isAtLeast(Rel.LEADER)) if (this.senderMustBeLeader && ! fplayer.getRole().isAtLeast(Rel.LEADER))
{ {
sender.sendMessage(p.txt.parse("<b>Only faction admins can %s.", this.getHelpShort())); sender.sendMessage(p.txt.parse("<b>Only faction admins can %s.", this.getHelpShort()));
return false; return false;

View File

@ -23,8 +23,8 @@ public abstract class FRelationCommand extends FCommand
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = true; senderMustBeOfficer = true;
senderMustBeAdmin = false; senderMustBeLeader = false;
} }
@Override @Override

View File

@ -13,8 +13,7 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Rel;
import com.massivecraft.factions.struct.Role;
import org.getspout.spoutapi.gui.Color; import org.getspout.spoutapi.gui.Color;
import org.getspout.spoutapi.player.AppearanceManager; import org.getspout.spoutapi.player.AppearanceManager;
@ -222,7 +221,7 @@ public class SpoutFeatures
SpoutPlayer sPlayer = SpoutManager.getPlayer(viewer.getPlayer()); SpoutPlayer sPlayer = SpoutManager.getPlayer(viewer.getPlayer());
Player pViewed = viewed.getPlayer(); Player pViewed = viewed.getPlayer();
String viewedTitle = viewed.getTitle(); String viewedTitle = viewed.getTitle();
Role viewedRole = viewed.getRole(); Rel viewedRole = viewed.getRole();
if ((Conf.spoutFactionTagsOverNames || Conf.spoutFactionTitlesOverNames) && viewer != viewed) if ((Conf.spoutFactionTagsOverNames || Conf.spoutFactionTitlesOverNames) && viewer != viewed)
{ {
@ -247,19 +246,19 @@ public class SpoutFeatures
if if
( (
( (
Conf.spoutFactionAdminCapes Conf.spoutFactionLeaderCapes
&& &&
viewedRole.equals(Role.ADMIN) viewedRole.equals(Rel.LEADER)
) )
|| ||
( (
Conf.spoutFactionModeratorCapes Conf.spoutFactionOfficerCapes
&& &&
viewedRole.equals(Role.MODERATOR) viewedRole.equals(Rel.OFFICER)
) )
) )
{ {
Relation relation = viewer.getRelationTo(viewed); Rel relation = viewer.getRelationTo(viewed);
String cape = ""; String cape = "";
if (!viewedFaction.isNormal()) if (!viewedFaction.isNormal())
{ {
@ -267,13 +266,13 @@ public class SpoutFeatures
} }
else if (viewedFaction.isPeaceful()) else if (viewedFaction.isPeaceful())
cape = Conf.capePeaceful; cape = Conf.capePeaceful;
else if (relation.isNeutral()) else if (relation == Rel.NEUTRAL)
cape = Conf.capeNeutral; cape = Conf.capeNeutral;
else if (relation.isMember()) else if (relation == Rel.MEMBER)
cape = Conf.capeMember; cape = Conf.capeMember;
else if (relation.isEnemy()) else if (relation == Rel.ENEMY)
cape = Conf.capeEnemy; cape = Conf.capeEnemy;
else if (relation.isAlly()) else if (relation == Rel.ALLY)
cape = Conf.capeAlly; cape = Conf.capeAlly;
if (cape.isEmpty()) if (cape.isEmpty())
@ -281,7 +280,7 @@ public class SpoutFeatures
else else
spoutApp.setPlayerCloak(sPlayer, pViewed, cape); spoutApp.setPlayerCloak(sPlayer, pViewed, cape);
} }
else if (Conf.spoutFactionAdminCapes || Conf.spoutFactionModeratorCapes) else if (Conf.spoutFactionLeaderCapes || Conf.spoutFactionOfficerCapes)
{ {
spoutApp.resetPlayerCloak(sPlayer, pViewed); spoutApp.resetPlayerCloak(sPlayer, pViewed);
} }

View File

@ -17,7 +17,7 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Rel;
public class PluginCapiListener extends CapiListener public class PluginCapiListener extends CapiListener
{ {
@ -81,7 +81,7 @@ public class PluginCapiListener extends CapiListener
for (Player somePlayer : Bukkit.getServer().getOnlinePlayers()) for (Player somePlayer : Bukkit.getServer().getOnlinePlayers())
{ {
FPlayer someFPlayer = FPlayers.i.get(somePlayer); FPlayer someFPlayer = FPlayers.i.get(somePlayer);
if (someFPlayer.getRelationTo(fme).value >= Relation.ALLY.value) if (someFPlayer.getRelationTo(fme).value >= Rel.ALLY.value)
{ {
event.getThem().add(somePlayer); event.getThem().add(somePlayer);
} }

View File

@ -19,7 +19,7 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Rel;
public class FactionsBlockListener extends BlockListener public class FactionsBlockListener extends BlockListener
@ -151,7 +151,7 @@ public class FactionsBlockListener extends BlockListener
return false; return false;
} }
Relation rel = pistonFaction.getRelationTo(otherFaction); Rel rel = pistonFaction.getRelationTo(otherFaction);
if (rel.confDenyBuild(otherFaction.hasPlayersOnline())) if (rel.confDenyBuild(otherFaction.hasPlayersOnline()))
return false; return false;
@ -201,7 +201,7 @@ public class FactionsBlockListener extends BlockListener
} }
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction); Rel rel = myFaction.getRelationTo(otherFaction);
boolean online = otherFaction.hasPlayersOnline(); boolean online = otherFaction.hasPlayersOnline();
boolean pain = !justCheck && rel.confPainBuild(online); boolean pain = !justCheck && rel.confPainBuild(online);
boolean deny = rel.confDenyBuild(online); boolean deny = rel.confDenyBuild(online);

View File

@ -13,7 +13,7 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Rel;
// this is an addtional PlayerListener for handling slashless command usage and faction chat, to be set at low priority so Factions gets to them first // this is an addtional PlayerListener for handling slashless command usage and faction chat, to be set at low priority so Factions gets to them first
@ -67,7 +67,7 @@ public class FactionsChatEarlyListener extends PlayerListener
//Send to all our allies //Send to all our allies
for (FPlayer fplayer : FPlayers.i.getOnline()) for (FPlayer fplayer : FPlayers.i.getOnline())
{ {
if(myFaction.getRelationTo(fplayer) == Relation.ALLY) if(myFaction.getRelationTo(fplayer) == Rel.ALLY)
fplayer.sendMessage(message); fplayer.sendMessage(message);
} }

View File

@ -28,7 +28,7 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Rel;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
@ -321,10 +321,10 @@ public class FactionsEntityListener extends EntityListener
return false; return false;
} }
Relation relation = defendFaction.getRelationTo(attackFaction); Rel relation = defendFaction.getRelationTo(attackFaction);
// You can not hurt neutral factions // You can not hurt neutral factions
if (Conf.disablePVPBetweenNeutralFactions && relation.isNeutral()) if (Conf.disablePVPBetweenNeutralFactions && relation == Rel.NEUTRAL)
{ {
attacker.msg("<i>You can't hurt neutral factions. Declare them as an enemy."); attacker.msg("<i>You can't hurt neutral factions. Declare them as an enemy.");
return false; return false;
@ -337,7 +337,7 @@ public class FactionsEntityListener extends EntityListener
} }
// You can never hurt faction members or allies // You can never hurt faction members or allies
if (relation.isMember() || relation.isAlly()) if (relation == Rel.MEMBER || relation == Rel.ALLY)
{ {
attacker.msg("<i>You can't hurt %s<i>.", defender.describeTo(attacker)); attacker.msg("<i>You can't hurt %s<i>.", defender.describeTo(attacker));
return false; return false;
@ -346,7 +346,7 @@ public class FactionsEntityListener extends EntityListener
boolean ownTerritory = defender.isInOwnTerritory(); boolean ownTerritory = defender.isInOwnTerritory();
// You can not hurt neutrals in their own territory. // You can not hurt neutrals in their own territory.
if (ownTerritory && relation.isNeutral()) if (ownTerritory && relation == Rel.NEUTRAL)
{ {
attacker.msg("<i>You can't hurt %s<i> in their own territory unless you declare them as an enemy.", defender.describeTo(attacker)); attacker.msg("<i>You can't hurt %s<i> in their own territory unless you declare them as an enemy.", defender.describeTo(attacker));
defender.msg("%s<i> tried to hurt you.", attacker.describeTo(defender, true)); defender.msg("%s<i> tried to hurt you.", attacker.describeTo(defender, true));

View File

@ -32,7 +32,7 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Rel;
import com.massivecraft.factions.zcore.util.TextUtil; import com.massivecraft.factions.zcore.util.TextUtil;
import java.util.logging.Level; import java.util.logging.Level;
@ -376,7 +376,7 @@ public class FactionsPlayerListener extends PlayerListener
} }
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction); Rel rel = myFaction.getRelationTo(otherFaction);
// Cancel if we are not in our own territory // Cancel if we are not in our own territory
if (rel.confDenyUseage()) if (rel.confDenyUseage())
@ -426,10 +426,10 @@ public class FactionsPlayerListener extends PlayerListener
} }
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction); Rel rel = myFaction.getRelationTo(otherFaction);
// You may use any block unless it is another faction's territory... // You may use any block unless it is another faction's territory...
if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) if (rel == Rel.NEUTRAL || (rel == Rel.ENEMY && Conf.territoryEnemyProtectMaterials) || (rel == Rel.ALLY && Conf.territoryAllyProtectMaterials))
{ {
if (!justCheck) if (!justCheck)
me.msg("<b>You can't use <h>%s<b> in the territory of <h>%s<b>.", TextUtil.getMaterialName(material), otherFaction.getTag(myFaction)); me.msg("<b>You can't use <h>%s<b> in the territory of <h>%s<b>.", TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
@ -529,8 +529,8 @@ public class FactionsPlayerListener extends PlayerListener
return false; return false;
} }
Relation rel = me.getRelationToLocation(); Rel rel = me.getRelationToLocation();
if (rel.isAtLeast(Relation.ALLY)) if (rel.isAtLeast(Rel.ALLY))
{ {
return false; return false;
} }
@ -539,7 +539,7 @@ public class FactionsPlayerListener extends PlayerListener
if if
( (
rel.isNeutral() rel == Rel.NEUTRAL
&& &&
! Conf.territoryNeutralDenyCommands.isEmpty() ! Conf.territoryNeutralDenyCommands.isEmpty()
&& &&
@ -567,7 +567,7 @@ public class FactionsPlayerListener extends PlayerListener
} }
else if else if
( (
rel.isEnemy() rel == Rel.ENEMY
&& &&
! Conf.territoryEnemyDenyCommands.isEmpty() ! Conf.territoryEnemyDenyCommands.isEmpty()
&& &&

View File

@ -9,7 +9,7 @@ public enum Permission
MANAGE_SAFE_ZONE("managesafezone"), MANAGE_SAFE_ZONE("managesafezone"),
MANAGE_WAR_ZONE("managewarzone"), MANAGE_WAR_ZONE("managewarzone"),
OWNERSHIP_BYPASS("ownershipbypass"), OWNERSHIP_BYPASS("ownershipbypass"),
ADMIN("admin"), LEADER("leader"),
AUTOCLAIM("autoclaim"), AUTOCLAIM("autoclaim"),
BYPASS("bypass"), BYPASS("bypass"),
CHAT("chat"), CHAT("chat"),
@ -30,7 +30,7 @@ public enum Permission
LIST("list"), LIST("list"),
LOCK("lock"), LOCK("lock"),
MAP("map"), MAP("map"),
MOD("mod"), OFFICER("officer"),
MONEY_BALANCE("money.balance"), MONEY_BALANCE("money.balance"),
MONEY_BALANCE_ANY("money.balance.any"), MONEY_BALANCE_ANY("money.balance.any"),
MONEY_DEPOSIT("money.deposit"), MONEY_DEPOSIT("money.deposit"),

View File

@ -95,12 +95,12 @@ public enum Rel
{ {
if (this == LEADER) if (this == LEADER)
{ {
return Conf.prefixAdmin; return Conf.prefixLeader;
} }
if (this == OFFICER) if (this == OFFICER)
{ {
return Conf.prefixMod; return Conf.prefixOfficer;
} }
return ""; return "";
@ -116,4 +116,69 @@ public enum Rel
else else
return Conf.econCostNeutral; return Conf.econCostNeutral;
} }
// return appropriate Conf setting for DenyBuild based on this relation and their online status
public boolean confDenyBuild(boolean online)
{
if (this == MEMBER)
return false;
if (online)
{
if (this == ENEMY)
return Conf.territoryEnemyDenyBuild;
else if (this == ALLY)
return Conf.territoryAllyDenyBuild;
else
return Conf.territoryDenyBuild;
}
else
{
if (this == ENEMY)
return Conf.territoryEnemyDenyBuildWhenOffline;
else if (this == ALLY)
return Conf.territoryAllyDenyBuildWhenOffline;
else
return Conf.territoryDenyBuildWhenOffline;
}
}
// return appropriate Conf setting for PainBuild based on this relation and their online status
public boolean confPainBuild(boolean online)
{
if (this == MEMBER)
return false;
if (online)
{
if (this == ENEMY)
return Conf.territoryEnemyPainBuild;
else if (this == ALLY)
return Conf.territoryAllyPainBuild;
else
return Conf.territoryPainBuild;
}
else
{
if (this == ENEMY)
return Conf.territoryEnemyPainBuildWhenOffline;
else if (this == ALLY)
return Conf.territoryAllyPainBuildWhenOffline;
else
return Conf.territoryPainBuildWhenOffline;
}
}
// return appropriate Conf setting for DenyUseage based on this relation
public boolean confDenyUseage()
{
if (this == MEMBER)
return false;
else if (this == ENEMY)
return Conf.territoryEnemyDenyUseage;
else if (this == ALLY)
return Conf.territoryAllyDenyUseage;
else
return Conf.territoryDenyUseage;
}
} }

View File

@ -1,147 +0,0 @@
package com.massivecraft.factions.struct;
import org.bukkit.ChatColor;
import com.massivecraft.factions.Conf;
public enum RelationDEPR
{
MEMBER(3, "member"),
ALLY(2, "ally"),
NEUTRAL(1, "neutral"),
ENEMY(0, "enemy"),
;
public final int value;
public final String nicename;
private RelationDEPR(final int value, final String nicename)
{
this.value = value;
this.nicename = nicename;
}
@Override
public String toString()
{
return this.nicename;
}
public boolean isMember()
{
return this == MEMBER;
}
public boolean isAlly()
{
return this == ALLY;
}
public boolean isNeutral()
{
return this == NEUTRAL;
}
public boolean isEnemy()
{
return this == ENEMY;
}
public boolean isAtLeast(Relation relation)
{
return this.value >= relation.value;
}
public boolean isAtMost(Relation relation)
{
return this.value <= relation.value;
}
public ChatColor getColor()
{
if (this == MEMBER)
return Conf.colorMember;
else if (this == ALLY)
return Conf.colorAlly;
else if (this == NEUTRAL)
return Conf.colorNeutral;
else
return Conf.colorEnemy;
}
// return appropriate Conf setting for DenyBuild based on this relation and their online status
public boolean confDenyBuild(boolean online)
{
if (isMember())
return false;
if (online)
{
if (isEnemy())
return Conf.territoryEnemyDenyBuild;
else if (isAlly())
return Conf.territoryAllyDenyBuild;
else
return Conf.territoryDenyBuild;
}
else
{
if (isEnemy())
return Conf.territoryEnemyDenyBuildWhenOffline;
else if (isAlly())
return Conf.territoryAllyDenyBuildWhenOffline;
else
return Conf.territoryDenyBuildWhenOffline;
}
}
// return appropriate Conf setting for PainBuild based on this relation and their online status
public boolean confPainBuild(boolean online)
{
if (isMember())
return false;
if (online)
{
if (isEnemy())
return Conf.territoryEnemyPainBuild;
else if (isAlly())
return Conf.territoryAllyPainBuild;
else
return Conf.territoryPainBuild;
}
else
{
if (isEnemy())
return Conf.territoryEnemyPainBuildWhenOffline;
else if (isAlly())
return Conf.territoryAllyPainBuildWhenOffline;
else
return Conf.territoryPainBuildWhenOffline;
}
}
// return appropriate Conf setting for DenyUseage based on this relation
public boolean confDenyUseage()
{
if (isMember())
return false;
else if (isEnemy())
return Conf.territoryEnemyDenyUseage;
else if (isAlly())
return Conf.territoryAllyDenyUseage;
else
return Conf.territoryDenyUseage;
}
public double getRelationCost()
{
if (isEnemy())
return Conf.econCostEnemy;
else if (isAlly())
return Conf.econCostAlly;
else
return Conf.econCostNeutral;
}
}

View File

@ -1,50 +0,0 @@
package com.massivecraft.factions.struct;
import com.massivecraft.factions.Conf;
public enum RoleDEPR
{
ADMIN(2, "admin"),
MODERATOR(1, "moderator"),
NORMAL(0, "normal member");
public final int value;
public final String nicename;
private RoleDEPR(final int value, final String nicename)
{
this.value = value;
this.nicename = nicename;
}
public boolean isAtLeast(Role role)
{
return this.value >= role.value;
}
public boolean isAtMost(Role role)
{
return this.value <= role.value;
}
@Override
public String toString()
{
return this.nicename;
}
public String getPrefix()
{
if (this == Role.ADMIN)
{
return Conf.prefixAdmin;
}
if (this == Role.MODERATOR)
{
return Conf.prefixMod;
}
return "";
}
}

View File

@ -0,0 +1,21 @@
package com.massivecraft.factions.util;
import java.lang.reflect.Type;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.massivecraft.factions.struct.Rel;
/**
* This is a legacy solution. Since Relation and Role enums have ben merged AND the rename ADMIN -> LEADER, MODERATOR -> OFFICER
*/
public class MyRelTypeAdapter implements JsonDeserializer<Rel>
{
@Override
public Rel deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
return Rel.parse(json.getAsString());
}
}