Merged Relation and Role into one enum
This commit is contained in:
parent
e6ff84ad9a
commit
842844969b
12
plugin.yml
12
plugin.yml
@ -48,7 +48,7 @@ permissions:
|
||||
factions.kit.halfplayer:
|
||||
description: Can do all but create factions.
|
||||
children:
|
||||
factions.admin: true
|
||||
factions.leader: true
|
||||
factions.autoclaim: true
|
||||
factions.chat: true
|
||||
factions.claim: true
|
||||
@ -63,7 +63,7 @@ permissions:
|
||||
factions.leave: true
|
||||
factions.list: true
|
||||
factions.map: true
|
||||
factions.mod: true
|
||||
factions.officer: true
|
||||
factions.money.kit.standard: true
|
||||
factions.noboom: true
|
||||
factions.open: true
|
||||
@ -79,8 +79,8 @@ permissions:
|
||||
factions.version: true
|
||||
factions.unclaim: true
|
||||
factions.unclaimall: true
|
||||
factions.admin:
|
||||
description: hand over your admin rights
|
||||
factions.leader:
|
||||
description: hand over your leader rights
|
||||
factions.autoclaim:
|
||||
description: auto-claim land as you walk around
|
||||
factions.bypass:
|
||||
@ -125,8 +125,8 @@ permissions:
|
||||
description: claim land as a war zone and build/destroy within war zones
|
||||
factions.map:
|
||||
description: show the territory map, and set optional auto update
|
||||
factions.mod:
|
||||
description: give or revoke moderator rights
|
||||
factions.officer:
|
||||
description: give or revoke officer rights
|
||||
factions.money.balance:
|
||||
description: show your factions current money balance
|
||||
factions.money.balance.any:
|
||||
|
@ -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 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 prefixMod = "*";
|
||||
public static String prefixLeader = "**";
|
||||
public static String prefixOfficer = "*";
|
||||
|
||||
public static int factionTagLengthMin = 3;
|
||||
public static int factionTagLengthMax = 10;
|
||||
@ -181,8 +181,8 @@ public class Conf
|
||||
// Spout features
|
||||
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 spoutFactionAdminCapes = 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 spoutFactionLeaderCapes = true; // Show capes on faction admins, colored based on the viewer's relation to the target player
|
||||
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 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
|
||||
|
@ -348,7 +348,7 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
return ret;
|
||||
}
|
||||
|
||||
public FPlayer getFPlayerAdmin()
|
||||
public FPlayer getFPlayerLeader()
|
||||
{
|
||||
if ( ! this.isNormal()) return null;
|
||||
|
||||
|
@ -24,8 +24,10 @@ import com.massivecraft.factions.listeners.FactionsEntityListener;
|
||||
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||
import com.massivecraft.factions.listeners.FactionsServerListener;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter;
|
||||
import com.massivecraft.factions.util.MyLocationTypeAdapter;
|
||||
import com.massivecraft.factions.util.MyRelTypeAdapter;
|
||||
import com.massivecraft.factions.zcore.MPlugin;
|
||||
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
@ -148,7 +150,8 @@ public class P extends MPlugin
|
||||
.disableHtmlEscaping()
|
||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE)
|
||||
.registerTypeAdapter(Location.class, new MyLocationTypeAdapter())
|
||||
.registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter());
|
||||
.registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter())
|
||||
.registerTypeAdapter(Rel.class, new MyRelTypeAdapter());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,8 +18,8 @@ public class CmdAutoClaim extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,8 +18,8 @@ public class CmdBoom extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,8 +18,8 @@ public class CmdBypass extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public class CmdChat extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,8 +19,8 @@ public class CmdClaim extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
|
||||
aliases.add("claim");
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ public class CmdConfig extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,8 +25,8 @@ public class CmdCreate extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,8 @@ public class CmdDeinvite extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,8 +22,8 @@ public class CmdDescription extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,8 +24,8 @@ public class CmdDisband extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,8 +26,8 @@ public class CmdHelp extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,8 +105,8 @@ public class CmdHelp extends FCommand
|
||||
pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdKick.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdMod.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdAdmin.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdOfficer.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdLeader.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." ));
|
||||
helpPages.add(pageLines);
|
||||
|
@ -33,8 +33,8 @@ public class CmdHome extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,8 @@ public class CmdInvite extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,8 +19,8 @@ public class CmdJoin extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,8 +22,8 @@ public class CmdKick extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,23 +5,23 @@ import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdAdmin extends FCommand
|
||||
public class CmdLeader extends FCommand
|
||||
{
|
||||
public CmdAdmin()
|
||||
public CmdLeader()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("admin");
|
||||
this.aliases.add("leader");
|
||||
|
||||
this.requiredArgs.add("player name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.ADMIN.node;
|
||||
this.permission = Permission.LEADER.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = true;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = true;
|
||||
}
|
||||
|
||||
@Override
|
@ -17,8 +17,8 @@ public class CmdLeave extends FCommand {
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,8 +27,8 @@ public class CmdList extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,8 +24,8 @@ public class CmdLock extends FCommand {
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public class CmdMap extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,8 +23,8 @@ public class CmdMoney extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
|
||||
this.setHelpShort("faction money commands");
|
||||
this.helpLong.add(p.txt.parseTags("<i>The faction money commands."));
|
||||
|
@ -20,8 +20,8 @@ public class CmdMoneyBalance extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,8 +22,8 @@ public class CmdMoneyDeposit extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,8 +22,8 @@ public class CmdMoneyTransferFf extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,8 +22,8 @@ public class CmdMoneyTransferFp extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,8 +22,8 @@ public class CmdMoneyTransferPf extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,8 +19,8 @@ public class CmdMoneyWithdraw extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,24 +4,24 @@ import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class CmdMod extends FCommand
|
||||
public class CmdOfficer extends FCommand
|
||||
{
|
||||
|
||||
public CmdMod()
|
||||
public CmdOfficer()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("mod");
|
||||
this.aliases.add("officer");
|
||||
|
||||
this.requiredArgs.add("player name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.MOD.node;
|
||||
this.permission = Permission.OFFICER.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = true;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = true;
|
||||
}
|
||||
|
||||
@Override
|
@ -20,8 +20,8 @@ public class CmdOpen extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,8 +26,8 @@ public class CmdOwner extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
// TODO: Fix colors!
|
||||
|
@ -22,8 +22,8 @@ public class CmdOwnerList extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,8 +22,8 @@ public class CmdPeaceful extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public class CmdPermanent extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,8 +19,8 @@ public class CmdPermanentPower extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public class CmdPower extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,8 +23,8 @@ public class CmdReload extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,8 @@ public class CmdSafeunclaimall extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
|
||||
this.setHelpShort("Unclaim all safezone land");
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ public class CmdSaveAll extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public class CmdSethome extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,8 +26,8 @@ public class CmdShow extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,8 +24,8 @@ public class CmdTag extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,8 @@ public class CmdTitle extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,8 +24,8 @@ public class CmdUnclaim extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public class CmdUnclaimall extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,8 +18,8 @@ public class CmdVersion extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,8 @@ public class CmdWarunclaimall extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
|
||||
this.setHelpShort("unclaim all warzone land");
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.massivecraft.factions.Conf;
|
||||
|
||||
public class FCmdRoot extends FCommand
|
||||
{
|
||||
public CmdAdmin cmdAdmin = new CmdAdmin();
|
||||
public CmdLeader cmdLeader = new CmdLeader();
|
||||
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
|
||||
public CmdBoom cmdBoom = new CmdBoom();
|
||||
public CmdBypass cmdBypass = new CmdBypass();
|
||||
@ -26,7 +26,7 @@ public class FCmdRoot extends FCommand
|
||||
public CmdList cmdList = new CmdList();
|
||||
public CmdLock cmdLock = new CmdLock();
|
||||
public CmdMap cmdMap = new CmdMap();
|
||||
public CmdMod cmdMod = new CmdMod();
|
||||
public CmdOfficer cmdOfficer = new CmdOfficer();
|
||||
public CmdMoney cmdMoney = new CmdMoney();
|
||||
public CmdOpen cmdOpen = new CmdOpen();
|
||||
public CmdOwner cmdOwner = new CmdOwner();
|
||||
@ -62,8 +62,8 @@ public class FCmdRoot extends FCommand
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
|
||||
this.disableOnLock = false;
|
||||
|
||||
@ -72,7 +72,7 @@ public class FCmdRoot extends FCommand
|
||||
|
||||
//this.subCommands.add(p.cmdHelp);
|
||||
|
||||
this.addSubCommand(this.cmdAdmin);
|
||||
this.addSubCommand(this.cmdLeader);
|
||||
this.addSubCommand(this.cmdAutoClaim);
|
||||
this.addSubCommand(this.cmdBoom);
|
||||
this.addSubCommand(this.cmdBypass);
|
||||
@ -92,7 +92,7 @@ public class FCmdRoot extends FCommand
|
||||
this.addSubCommand(this.cmdList);
|
||||
this.addSubCommand(this.cmdLock);
|
||||
this.addSubCommand(this.cmdMap);
|
||||
this.addSubCommand(this.cmdMod);
|
||||
this.addSubCommand(this.cmdOfficer);
|
||||
this.addSubCommand(this.cmdMoney);
|
||||
this.addSubCommand(this.cmdOpen);
|
||||
this.addSubCommand(this.cmdOwner);
|
||||
|
@ -23,8 +23,8 @@ public abstract class FCommand extends MCommand<P>
|
||||
public FPlayer fme;
|
||||
public Faction myFaction;
|
||||
public boolean senderMustBeMember;
|
||||
public boolean senderMustBeModerator;
|
||||
public boolean senderMustBeAdmin;
|
||||
public boolean senderMustBeOfficer;
|
||||
public boolean senderMustBeLeader;
|
||||
|
||||
public boolean isMoneyCommand;
|
||||
|
||||
@ -39,8 +39,8 @@ public abstract class FCommand extends MCommand<P>
|
||||
isMoneyCommand = false;
|
||||
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = false;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -89,7 +89,7 @@ public abstract class FCommand extends MCommand<P>
|
||||
boolean superValid = super.validSenderType(sender, informSenderIfNot);
|
||||
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;
|
||||
|
||||
@ -101,13 +101,13 @@ public abstract class FCommand extends MCommand<P>
|
||||
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()));
|
||||
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()));
|
||||
return false;
|
||||
|
@ -23,8 +23,8 @@ public abstract class FRelationCommand extends FCommand
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBeOfficer = true;
|
||||
senderMustBeLeader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,8 +13,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
import org.getspout.spoutapi.gui.Color;
|
||||
import org.getspout.spoutapi.player.AppearanceManager;
|
||||
@ -222,7 +221,7 @@ public class SpoutFeatures
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(viewer.getPlayer());
|
||||
Player pViewed = viewed.getPlayer();
|
||||
String viewedTitle = viewed.getTitle();
|
||||
Role viewedRole = viewed.getRole();
|
||||
Rel viewedRole = viewed.getRole();
|
||||
|
||||
if ((Conf.spoutFactionTagsOverNames || Conf.spoutFactionTitlesOverNames) && viewer != viewed)
|
||||
{
|
||||
@ -247,19 +246,19 @@ public class SpoutFeatures
|
||||
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 = "";
|
||||
if (!viewedFaction.isNormal())
|
||||
{
|
||||
@ -267,13 +266,13 @@ public class SpoutFeatures
|
||||
}
|
||||
else if (viewedFaction.isPeaceful())
|
||||
cape = Conf.capePeaceful;
|
||||
else if (relation.isNeutral())
|
||||
else if (relation == Rel.NEUTRAL)
|
||||
cape = Conf.capeNeutral;
|
||||
else if (relation.isMember())
|
||||
else if (relation == Rel.MEMBER)
|
||||
cape = Conf.capeMember;
|
||||
else if (relation.isEnemy())
|
||||
else if (relation == Rel.ENEMY)
|
||||
cape = Conf.capeEnemy;
|
||||
else if (relation.isAlly())
|
||||
else if (relation == Rel.ALLY)
|
||||
cape = Conf.capeAlly;
|
||||
|
||||
if (cape.isEmpty())
|
||||
@ -281,7 +280,7 @@ public class SpoutFeatures
|
||||
else
|
||||
spoutApp.setPlayerCloak(sPlayer, pViewed, cape);
|
||||
}
|
||||
else if (Conf.spoutFactionAdminCapes || Conf.spoutFactionModeratorCapes)
|
||||
else if (Conf.spoutFactionLeaderCapes || Conf.spoutFactionOfficerCapes)
|
||||
{
|
||||
spoutApp.resetPlayerCloak(sPlayer, pViewed);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
public class PluginCapiListener extends CapiListener
|
||||
{
|
||||
@ -81,7 +81,7 @@ public class PluginCapiListener extends CapiListener
|
||||
for (Player somePlayer : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
|
||||
public class FactionsBlockListener extends BlockListener
|
||||
@ -151,7 +151,7 @@ public class FactionsBlockListener extends BlockListener
|
||||
return false;
|
||||
}
|
||||
|
||||
Relation rel = pistonFaction.getRelationTo(otherFaction);
|
||||
Rel rel = pistonFaction.getRelationTo(otherFaction);
|
||||
|
||||
if (rel.confDenyBuild(otherFaction.hasPlayersOnline()))
|
||||
return false;
|
||||
@ -201,7 +201,7 @@ public class FactionsBlockListener extends BlockListener
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Relation rel = myFaction.getRelationTo(otherFaction);
|
||||
Rel rel = myFaction.getRelationTo(otherFaction);
|
||||
boolean online = otherFaction.hasPlayersOnline();
|
||||
boolean pain = !justCheck && rel.confPainBuild(online);
|
||||
boolean deny = rel.confDenyBuild(online);
|
||||
|
@ -13,7 +13,7 @@ import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
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
|
||||
@ -67,7 +67,7 @@ public class FactionsChatEarlyListener extends PlayerListener
|
||||
//Send to all our allies
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
if(myFaction.getRelationTo(fplayer) == Relation.ALLY)
|
||||
if(myFaction.getRelationTo(fplayer) == Rel.ALLY)
|
||||
fplayer.sendMessage(message);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
|
||||
|
||||
@ -321,10 +321,10 @@ public class FactionsEntityListener extends EntityListener
|
||||
return false;
|
||||
}
|
||||
|
||||
Relation relation = defendFaction.getRelationTo(attackFaction);
|
||||
Rel relation = defendFaction.getRelationTo(attackFaction);
|
||||
|
||||
// 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.");
|
||||
return false;
|
||||
@ -337,7 +337,7 @@ public class FactionsEntityListener extends EntityListener
|
||||
}
|
||||
|
||||
// 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));
|
||||
return false;
|
||||
@ -346,7 +346,7 @@ public class FactionsEntityListener extends EntityListener
|
||||
boolean ownTerritory = defender.isInOwnTerritory();
|
||||
|
||||
// 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));
|
||||
defender.msg("%s<i> tried to hurt you.", attacker.describeTo(defender, true));
|
||||
|
@ -32,7 +32,7 @@ import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
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 java.util.logging.Level;
|
||||
@ -376,7 +376,7 @@ public class FactionsPlayerListener extends PlayerListener
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Relation rel = myFaction.getRelationTo(otherFaction);
|
||||
Rel rel = myFaction.getRelationTo(otherFaction);
|
||||
|
||||
// Cancel if we are not in our own territory
|
||||
if (rel.confDenyUseage())
|
||||
@ -426,10 +426,10 @@ public class FactionsPlayerListener extends PlayerListener
|
||||
}
|
||||
|
||||
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...
|
||||
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)
|
||||
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;
|
||||
}
|
||||
|
||||
Relation rel = me.getRelationToLocation();
|
||||
if (rel.isAtLeast(Relation.ALLY))
|
||||
Rel rel = me.getRelationToLocation();
|
||||
if (rel.isAtLeast(Rel.ALLY))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -539,7 +539,7 @@ public class FactionsPlayerListener extends PlayerListener
|
||||
|
||||
if
|
||||
(
|
||||
rel.isNeutral()
|
||||
rel == Rel.NEUTRAL
|
||||
&&
|
||||
! Conf.territoryNeutralDenyCommands.isEmpty()
|
||||
&&
|
||||
@ -567,7 +567,7 @@ public class FactionsPlayerListener extends PlayerListener
|
||||
}
|
||||
else if
|
||||
(
|
||||
rel.isEnemy()
|
||||
rel == Rel.ENEMY
|
||||
&&
|
||||
! Conf.territoryEnemyDenyCommands.isEmpty()
|
||||
&&
|
||||
|
@ -9,7 +9,7 @@ public enum Permission
|
||||
MANAGE_SAFE_ZONE("managesafezone"),
|
||||
MANAGE_WAR_ZONE("managewarzone"),
|
||||
OWNERSHIP_BYPASS("ownershipbypass"),
|
||||
ADMIN("admin"),
|
||||
LEADER("leader"),
|
||||
AUTOCLAIM("autoclaim"),
|
||||
BYPASS("bypass"),
|
||||
CHAT("chat"),
|
||||
@ -30,7 +30,7 @@ public enum Permission
|
||||
LIST("list"),
|
||||
LOCK("lock"),
|
||||
MAP("map"),
|
||||
MOD("mod"),
|
||||
OFFICER("officer"),
|
||||
MONEY_BALANCE("money.balance"),
|
||||
MONEY_BALANCE_ANY("money.balance.any"),
|
||||
MONEY_DEPOSIT("money.deposit"),
|
||||
|
@ -95,12 +95,12 @@ public enum Rel
|
||||
{
|
||||
if (this == LEADER)
|
||||
{
|
||||
return Conf.prefixAdmin;
|
||||
return Conf.prefixLeader;
|
||||
}
|
||||
|
||||
if (this == OFFICER)
|
||||
{
|
||||
return Conf.prefixMod;
|
||||
return Conf.prefixOfficer;
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -116,4 +116,69 @@ public enum Rel
|
||||
else
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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 "";
|
||||
}
|
||||
}
|
21
src/com/massivecraft/factions/util/MyRelTypeAdapter.java
Normal file
21
src/com/massivecraft/factions/util/MyRelTypeAdapter.java
Normal 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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user