Check System Added and Massive Reformat
This commit is contained in:
@@ -2,41 +2,41 @@ package com.massivecraft.factions.struct;
|
||||
|
||||
public class BanInfo {
|
||||
|
||||
// FPlayer IDs
|
||||
private final String banner;
|
||||
private final String banned;
|
||||
private final long time;
|
||||
// FPlayer IDs
|
||||
private final String banner;
|
||||
private final String banned;
|
||||
private final long time;
|
||||
|
||||
public BanInfo(String banner, String banned, long time) {
|
||||
this.banner = banner;
|
||||
this.banned = banned;
|
||||
this.time = time;
|
||||
}
|
||||
public BanInfo(String banner, String banned, long time) {
|
||||
this.banner = banner;
|
||||
this.banned = banned;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the FPlayer ID of the player who issued the ban.
|
||||
*
|
||||
* @return FPlayer ID.
|
||||
*/
|
||||
public String getBanner() {
|
||||
return this.banner;
|
||||
}
|
||||
/**
|
||||
* Get the FPlayer ID of the player who issued the ban.
|
||||
*
|
||||
* @return FPlayer ID.
|
||||
*/
|
||||
public String getBanner() {
|
||||
return this.banner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the FPlayer ID of the player who got banned.
|
||||
*
|
||||
* @return FPlayer ID.
|
||||
*/
|
||||
public String getBanned() {
|
||||
return banned;
|
||||
}
|
||||
/**
|
||||
* Get the FPlayer ID of the player who got banned.
|
||||
*
|
||||
* @return FPlayer ID.
|
||||
*/
|
||||
public String getBanned() {
|
||||
return banned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the server time when the ban was issued.
|
||||
*
|
||||
* @return system timestamp.
|
||||
*/
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
/**
|
||||
* Get the server time when the ban was issued.
|
||||
*
|
||||
* @return system timestamp.
|
||||
*/
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,40 +3,40 @@ package com.massivecraft.factions.struct;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public enum ChatMode {
|
||||
MOD(4, TL.CHAT_MOD),
|
||||
FACTION(3, TL.CHAT_FACTION),
|
||||
ALLIANCE(2, TL.CHAT_ALLIANCE),
|
||||
TRUCE(1, TL.CHAT_TRUCE),
|
||||
PUBLIC(0, TL.CHAT_PUBLIC);
|
||||
MOD(4, TL.CHAT_MOD),
|
||||
FACTION(3, TL.CHAT_FACTION),
|
||||
ALLIANCE(2, TL.CHAT_ALLIANCE),
|
||||
TRUCE(1, TL.CHAT_TRUCE),
|
||||
PUBLIC(0, TL.CHAT_PUBLIC);
|
||||
|
||||
public final int value;
|
||||
public final TL nicename;
|
||||
public final int value;
|
||||
public final TL nicename;
|
||||
|
||||
ChatMode(final int value, final TL nicename) {
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
ChatMode(final int value, final TL nicename) {
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(ChatMode role) {
|
||||
return this.value >= role.value;
|
||||
}
|
||||
public boolean isAtLeast(ChatMode role) {
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(ChatMode role) {
|
||||
return this.value <= role.value;
|
||||
}
|
||||
public boolean isAtMost(ChatMode role) {
|
||||
return this.value <= role.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename.toString();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename.toString();
|
||||
}
|
||||
|
||||
public ChatMode getNext() {
|
||||
if (this == PUBLIC) {
|
||||
return ALLIANCE;
|
||||
}
|
||||
if (this == ALLIANCE) {
|
||||
return FACTION;
|
||||
}
|
||||
return PUBLIC;
|
||||
}
|
||||
public ChatMode getNext() {
|
||||
if (this == PUBLIC) {
|
||||
return ALLIANCE;
|
||||
}
|
||||
if (this == ALLIANCE) {
|
||||
return FACTION;
|
||||
}
|
||||
return PUBLIC;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,136 +4,137 @@ import com.massivecraft.factions.P;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public enum Permission {
|
||||
MANAGE_SAFE_ZONE("managesafezone"),
|
||||
MANAGE_WAR_ZONE("managewarzone"),
|
||||
OWNERSHIP_BYPASS("ownershipbypass"),
|
||||
ADMIN("admin"),
|
||||
ALTS("alts"),
|
||||
ADMIN_ANY("admin.any"),
|
||||
AHOME("ahome"),
|
||||
ANNOUNCE("announce"),
|
||||
AUTOCLAIM("autoclaim"),
|
||||
AUTO_LEAVE_BYPASS("autoleavebypass"),
|
||||
BAN("ban"),
|
||||
BYPASS("bypass"),
|
||||
CHAT("chat"),
|
||||
CHATSPY("chatspy"),
|
||||
CLAIM("claim"),
|
||||
CLAIMAT("claimat"),
|
||||
CLAIM_LINE("claim.line"),
|
||||
CLAIM_RADIUS("claim.radius"),
|
||||
CONFIG("config"),
|
||||
CONVERT("convert"),
|
||||
CREATE("create"),
|
||||
CORNER("corner"),
|
||||
DEFAULTRANK("defaultrank"),
|
||||
DEINVITE("deinvite"),
|
||||
DELHOME("delhome"),
|
||||
DESCRIPTION("description"),
|
||||
DISBAND("disband"),
|
||||
DISBAND_ANY("disband.any"),
|
||||
FLY("fly"),
|
||||
FOCUS("focus"),
|
||||
GRACE("grace"),
|
||||
HELP("help"),
|
||||
HOME("home"),
|
||||
INVITE("invite"),
|
||||
INVSEE("invsee"),
|
||||
JOIN("join"),
|
||||
JOIN_ANY("join.any"),
|
||||
JOIN_OTHERS("join.others"),
|
||||
KICK("kick"),
|
||||
KICK_ANY("kick.any"),
|
||||
LEAVE("leave"),
|
||||
LIST("list"),
|
||||
LOCK("lock"),
|
||||
LOGOUT("logout"),
|
||||
MAP("map"),
|
||||
MAPHEIGHT("mapheight"),
|
||||
MOD("mod"),
|
||||
COLEADER("coleader"),
|
||||
MOD_ANY("mod.any"),
|
||||
COLEADER_ANY("coleader.any"),
|
||||
MISSIONS("missions"),
|
||||
MODIFY_POWER("modifypower"),
|
||||
MONEY_BALANCE("money.balance"),
|
||||
MONEY_BALANCE_ANY("money.balance.any"),
|
||||
MONEY_DEPOSIT("money.deposit"),
|
||||
MONEY_WITHDRAW("money.withdraw"),
|
||||
MONEY_WITHDRAW_ANY("money.withdraw.any"),
|
||||
MONEY_F2F("money.f2f"),
|
||||
MONEY_F2P("money.f2p"),
|
||||
MONEY_P2F("money.p2f"),
|
||||
MONITOR_LOGINS("monitorlogins"),
|
||||
NO_BOOM("noboom"),
|
||||
OPEN("open"),
|
||||
OWNER("owner"),
|
||||
OWNERLIST("ownerlist"),
|
||||
SET_PEACEFUL("setpeaceful"),
|
||||
SET_PERMANENT("setpermanent"),
|
||||
SET_PERMANENTPOWER("setpermanentpower"),
|
||||
SHOW_INVITES("showinvites"),
|
||||
PAYPAL("paypal"),
|
||||
PAYPALSET("setpaypal"),
|
||||
PERMISSIONS("permissions"),
|
||||
POWERBOOST("powerboost"),
|
||||
POWER("power"),
|
||||
POWER_ANY("power.any"),
|
||||
PROMOTE("promote"),
|
||||
RELATION("relation"),
|
||||
RELOAD("reload"),
|
||||
SAVE("save"),
|
||||
SPAM("spam"),
|
||||
SETHOME("sethome"),
|
||||
SETHOME_ANY("sethome.any"),
|
||||
SETSTRIKES("setstrikes"),
|
||||
SHOW("show"),
|
||||
STATUS("status"),
|
||||
STEALTH("stealth"),
|
||||
STUCK("stuck"),
|
||||
TAG("tag"),
|
||||
TNT("tnt"),
|
||||
TITLE("title"),
|
||||
TITLE_COLOR("title.color"),
|
||||
TOGGLE_ALLIANCE_CHAT("togglealliancechat"),
|
||||
UNCLAIM("unclaim"),
|
||||
UNCLAIM_ALL("unclaimall"),
|
||||
VERSION("version"),
|
||||
SCOREBOARD("scoreboard"),
|
||||
SEECHUNK("seechunk"),
|
||||
SETWARP("setwarp"),
|
||||
TOP("top"),
|
||||
VIEWCHEST("viewchest"),
|
||||
ADDPOINTS("addpoints"),
|
||||
REMOVEPOINTS("removepoints"),
|
||||
SETPOINTS("setpoints"),
|
||||
VAULT("vault"),
|
||||
GETVAULT("getvault"),
|
||||
SETMAXVAULTS("setmaxvaults"),
|
||||
RULES("rules"),
|
||||
CHECKPOINT("checkpoint"),
|
||||
UPGRADES("upgrades"),
|
||||
BANNER("banner"),
|
||||
TPBANNER("tpbanner"),
|
||||
KILLHOLOS("killholos"),
|
||||
INSPECT("inspect"),
|
||||
TNTFILL("tntfill"),
|
||||
COORD("coords"),
|
||||
SHOWCLAIMS("showclaims"),
|
||||
WARP("warp"),
|
||||
CHEST("chest");
|
||||
MANAGE_SAFE_ZONE("managesafezone"),
|
||||
MANAGE_WAR_ZONE("managewarzone"),
|
||||
OWNERSHIP_BYPASS("ownershipbypass"),
|
||||
ADMIN("admin"),
|
||||
ALTS("alts"),
|
||||
ADMIN_ANY("admin.any"),
|
||||
AHOME("ahome"),
|
||||
ANNOUNCE("announce"),
|
||||
AUTOCLAIM("autoclaim"),
|
||||
AUTO_LEAVE_BYPASS("autoleavebypass"),
|
||||
BAN("ban"),
|
||||
BYPASS("bypass"),
|
||||
CHAT("chat"),
|
||||
CHATSPY("chatspy"),
|
||||
CHECK("check"),
|
||||
CLAIM("claim"),
|
||||
CLAIMAT("claimat"),
|
||||
CLAIM_LINE("claim.line"),
|
||||
CLAIM_RADIUS("claim.radius"),
|
||||
CONFIG("config"),
|
||||
CONVERT("convert"),
|
||||
CREATE("create"),
|
||||
CORNER("corner"),
|
||||
DEFAULTRANK("defaultrank"),
|
||||
DEINVITE("deinvite"),
|
||||
DELHOME("delhome"),
|
||||
DESCRIPTION("description"),
|
||||
DISBAND("disband"),
|
||||
DISBAND_ANY("disband.any"),
|
||||
FLY("fly"),
|
||||
FOCUS("focus"),
|
||||
GRACE("grace"),
|
||||
HELP("help"),
|
||||
HOME("home"),
|
||||
INVITE("invite"),
|
||||
INVSEE("invsee"),
|
||||
JOIN("join"),
|
||||
JOIN_ANY("join.any"),
|
||||
JOIN_OTHERS("join.others"),
|
||||
KICK("kick"),
|
||||
KICK_ANY("kick.any"),
|
||||
LEAVE("leave"),
|
||||
LIST("list"),
|
||||
LOCK("lock"),
|
||||
LOGOUT("logout"),
|
||||
MAP("map"),
|
||||
MAPHEIGHT("mapheight"),
|
||||
MOD("mod"),
|
||||
COLEADER("coleader"),
|
||||
MOD_ANY("mod.any"),
|
||||
COLEADER_ANY("coleader.any"),
|
||||
MISSIONS("missions"),
|
||||
MODIFY_POWER("modifypower"),
|
||||
MONEY_BALANCE("money.balance"),
|
||||
MONEY_BALANCE_ANY("money.balance.any"),
|
||||
MONEY_DEPOSIT("money.deposit"),
|
||||
MONEY_WITHDRAW("money.withdraw"),
|
||||
MONEY_WITHDRAW_ANY("money.withdraw.any"),
|
||||
MONEY_F2F("money.f2f"),
|
||||
MONEY_F2P("money.f2p"),
|
||||
MONEY_P2F("money.p2f"),
|
||||
MONITOR_LOGINS("monitorlogins"),
|
||||
NO_BOOM("noboom"),
|
||||
OPEN("open"),
|
||||
OWNER("owner"),
|
||||
OWNERLIST("ownerlist"),
|
||||
SET_PEACEFUL("setpeaceful"),
|
||||
SET_PERMANENT("setpermanent"),
|
||||
SET_PERMANENTPOWER("setpermanentpower"),
|
||||
SHOW_INVITES("showinvites"),
|
||||
PAYPAL("paypal"),
|
||||
PAYPALSET("setpaypal"),
|
||||
PERMISSIONS("permissions"),
|
||||
POWERBOOST("powerboost"),
|
||||
POWER("power"),
|
||||
POWER_ANY("power.any"),
|
||||
PROMOTE("promote"),
|
||||
RELATION("relation"),
|
||||
RELOAD("reload"),
|
||||
SAVE("save"),
|
||||
SPAM("spam"),
|
||||
SETHOME("sethome"),
|
||||
SETHOME_ANY("sethome.any"),
|
||||
SETSTRIKES("setstrikes"),
|
||||
SHOW("show"),
|
||||
STATUS("status"),
|
||||
STEALTH("stealth"),
|
||||
STUCK("stuck"),
|
||||
TAG("tag"),
|
||||
TNT("tnt"),
|
||||
TITLE("title"),
|
||||
TITLE_COLOR("title.color"),
|
||||
TOGGLE_ALLIANCE_CHAT("togglealliancechat"),
|
||||
UNCLAIM("unclaim"),
|
||||
UNCLAIM_ALL("unclaimall"),
|
||||
VERSION("version"),
|
||||
SCOREBOARD("scoreboard"),
|
||||
SEECHUNK("seechunk"),
|
||||
SETWARP("setwarp"),
|
||||
TOP("top"),
|
||||
VIEWCHEST("viewchest"),
|
||||
ADDPOINTS("addpoints"),
|
||||
REMOVEPOINTS("removepoints"),
|
||||
SETPOINTS("setpoints"),
|
||||
VAULT("vault"),
|
||||
GETVAULT("getvault"),
|
||||
SETMAXVAULTS("setmaxvaults"),
|
||||
RULES("rules"),
|
||||
CHECKPOINT("checkpoint"),
|
||||
UPGRADES("upgrades"),
|
||||
BANNER("banner"),
|
||||
TPBANNER("tpbanner"),
|
||||
KILLHOLOS("killholos"),
|
||||
INSPECT("inspect"),
|
||||
TNTFILL("tntfill"),
|
||||
COORD("coords"),
|
||||
SHOWCLAIMS("showclaims"),
|
||||
WARP("warp"),
|
||||
CHEST("chest");
|
||||
|
||||
public final String node;
|
||||
public final String node;
|
||||
|
||||
Permission(final String node) {
|
||||
this.node = "factions." + node;
|
||||
}
|
||||
Permission(final String node) {
|
||||
this.node = "factions." + node;
|
||||
}
|
||||
|
||||
public boolean has(CommandSender sender, boolean informSenderIfNot) {
|
||||
return P.p.perm.has(sender, this.node, informSenderIfNot);
|
||||
}
|
||||
public boolean has(CommandSender sender, boolean informSenderIfNot) {
|
||||
return P.p.perm.has(sender, this.node, informSenderIfNot);
|
||||
}
|
||||
|
||||
public boolean has(CommandSender sender) {
|
||||
return has(sender, false);
|
||||
}
|
||||
public boolean has(CommandSender sender) {
|
||||
return has(sender, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,221 +16,221 @@ import java.util.List;
|
||||
|
||||
|
||||
public enum Relation implements Permissable {
|
||||
MEMBER(4, TL.RELATION_MEMBER_SINGULAR.toString()),
|
||||
ALLY(3, TL.RELATION_ALLY_SINGULAR.toString()),
|
||||
TRUCE(2, TL.RELATION_TRUCE_SINGULAR.toString()),
|
||||
NEUTRAL(1, TL.RELATION_NEUTRAL_SINGULAR.toString()),
|
||||
ENEMY(0, TL.RELATION_ENEMY_SINGULAR.toString());
|
||||
MEMBER(4, TL.RELATION_MEMBER_SINGULAR.toString()),
|
||||
ALLY(3, TL.RELATION_ALLY_SINGULAR.toString()),
|
||||
TRUCE(2, TL.RELATION_TRUCE_SINGULAR.toString()),
|
||||
NEUTRAL(1, TL.RELATION_NEUTRAL_SINGULAR.toString()),
|
||||
ENEMY(0, TL.RELATION_ENEMY_SINGULAR.toString());
|
||||
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
Relation(final int value, final String nicename) {
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
Relation(final int value, final String nicename) {
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public static Relation fromString(String s) {
|
||||
// Because Java 6 doesn't allow String switches :(
|
||||
if (s.equalsIgnoreCase(MEMBER.nicename)) {
|
||||
return MEMBER;
|
||||
} else if (s.equalsIgnoreCase(ALLY.nicename)) {
|
||||
return ALLY;
|
||||
} else if (s.equalsIgnoreCase(TRUCE.nicename)) {
|
||||
return TRUCE;
|
||||
} else if (s.equalsIgnoreCase(ENEMY.nicename)) {
|
||||
return ENEMY;
|
||||
} else {
|
||||
return NEUTRAL; // If they somehow mess things up, go back to default behavior.
|
||||
}
|
||||
}
|
||||
public static Relation fromString(String s) {
|
||||
// Because Java 6 doesn't allow String switches :(
|
||||
if (s.equalsIgnoreCase(MEMBER.nicename)) {
|
||||
return MEMBER;
|
||||
} else if (s.equalsIgnoreCase(ALLY.nicename)) {
|
||||
return ALLY;
|
||||
} else if (s.equalsIgnoreCase(TRUCE.nicename)) {
|
||||
return TRUCE;
|
||||
} else if (s.equalsIgnoreCase(ENEMY.nicename)) {
|
||||
return ENEMY;
|
||||
} else {
|
||||
return NEUTRAL; // If they somehow mess things up, go back to default behavior.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public String getTranslation() {
|
||||
try {
|
||||
return TL.valueOf("RELATION_" + name() + "_SINGULAR").toString();
|
||||
} catch (IllegalArgumentException e) {
|
||||
return toString();
|
||||
}
|
||||
}
|
||||
public String getTranslation() {
|
||||
try {
|
||||
return TL.valueOf("RELATION_" + name() + "_SINGULAR").toString();
|
||||
} catch (IllegalArgumentException e) {
|
||||
return toString();
|
||||
}
|
||||
}
|
||||
|
||||
public String getPluralTranslation() {
|
||||
for (TL t : TL.values()) {
|
||||
if (t.name().equalsIgnoreCase("RELATION_" + name() + "_PLURAL")) {
|
||||
return t.toString();
|
||||
}
|
||||
}
|
||||
return toString();
|
||||
}
|
||||
public String getPluralTranslation() {
|
||||
for (TL t : TL.values()) {
|
||||
if (t.name().equalsIgnoreCase("RELATION_" + name() + "_PLURAL")) {
|
||||
return t.toString();
|
||||
}
|
||||
}
|
||||
return toString();
|
||||
}
|
||||
|
||||
public boolean isMember() {
|
||||
return this == MEMBER;
|
||||
}
|
||||
public boolean isMember() {
|
||||
return this == MEMBER;
|
||||
}
|
||||
|
||||
public boolean isAlly() {
|
||||
return this == ALLY;
|
||||
}
|
||||
public boolean isAlly() {
|
||||
return this == ALLY;
|
||||
}
|
||||
|
||||
public boolean isTruce() {
|
||||
return this == TRUCE;
|
||||
}
|
||||
public boolean isTruce() {
|
||||
return this == TRUCE;
|
||||
}
|
||||
|
||||
public boolean isNeutral() {
|
||||
return this == NEUTRAL;
|
||||
}
|
||||
public boolean isNeutral() {
|
||||
return this == NEUTRAL;
|
||||
}
|
||||
|
||||
public boolean isEnemy() {
|
||||
return this == ENEMY;
|
||||
}
|
||||
public boolean isEnemy() {
|
||||
return this == ENEMY;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Relation relation) {
|
||||
return this.value >= relation.value;
|
||||
}
|
||||
public boolean isAtLeast(Relation relation) {
|
||||
return this.value >= relation.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(Relation relation) {
|
||||
return this.value <= relation.value;
|
||||
}
|
||||
public boolean isAtMost(Relation relation) {
|
||||
return this.value <= relation.value;
|
||||
}
|
||||
|
||||
public ChatColor getColor() {
|
||||
public ChatColor getColor() {
|
||||
|
||||
switch (this) {
|
||||
case MEMBER:
|
||||
return Conf.colorMember;
|
||||
case ALLY:
|
||||
return Conf.colorAlly;
|
||||
case NEUTRAL:
|
||||
return Conf.colorNeutral;
|
||||
case TRUCE:
|
||||
return Conf.colorTruce;
|
||||
default:
|
||||
return Conf.colorEnemy;
|
||||
}
|
||||
}
|
||||
switch (this) {
|
||||
case MEMBER:
|
||||
return Conf.colorMember;
|
||||
case ALLY:
|
||||
return Conf.colorAlly;
|
||||
case NEUTRAL:
|
||||
return Conf.colorNeutral;
|
||||
case TRUCE:
|
||||
return Conf.colorTruce;
|
||||
default:
|
||||
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;
|
||||
}
|
||||
// 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 if (isTruce()) {
|
||||
return Conf.territoryTruceDenyBuild;
|
||||
} else {
|
||||
return Conf.territoryDenyBuild;
|
||||
}
|
||||
} else {
|
||||
if (isEnemy()) {
|
||||
return Conf.territoryEnemyDenyBuildWhenOffline;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyDenyBuildWhenOffline;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTruceDenyBuildWhenOffline;
|
||||
} else {
|
||||
return Conf.territoryDenyBuildWhenOffline;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (online) {
|
||||
if (isEnemy()) {
|
||||
return Conf.territoryEnemyDenyBuild;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyDenyBuild;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTruceDenyBuild;
|
||||
} else {
|
||||
return Conf.territoryDenyBuild;
|
||||
}
|
||||
} else {
|
||||
if (isEnemy()) {
|
||||
return Conf.territoryEnemyDenyBuildWhenOffline;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyDenyBuildWhenOffline;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTruceDenyBuildWhenOffline;
|
||||
} 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;
|
||||
}
|
||||
// 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 if (isTruce()) {
|
||||
return Conf.territoryTrucePainBuild;
|
||||
} else {
|
||||
return Conf.territoryPainBuild;
|
||||
}
|
||||
} else {
|
||||
if (isEnemy()) {
|
||||
return Conf.territoryEnemyPainBuildWhenOffline;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyPainBuildWhenOffline;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTrucePainBuildWhenOffline;
|
||||
} else {
|
||||
return Conf.territoryPainBuildWhenOffline;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (online) {
|
||||
if (isEnemy()) {
|
||||
return Conf.territoryEnemyPainBuild;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyPainBuild;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTrucePainBuild;
|
||||
} else {
|
||||
return Conf.territoryPainBuild;
|
||||
}
|
||||
} else {
|
||||
if (isEnemy()) {
|
||||
return Conf.territoryEnemyPainBuildWhenOffline;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyPainBuildWhenOffline;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTrucePainBuildWhenOffline;
|
||||
} 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 if (isTruce()) {
|
||||
return Conf.territoryTruceDenyUseage;
|
||||
} else {
|
||||
return Conf.territoryDenyUseage;
|
||||
}
|
||||
}
|
||||
// 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 if (isTruce()) {
|
||||
return Conf.territoryTruceDenyUseage;
|
||||
} else {
|
||||
return Conf.territoryDenyUseage;
|
||||
}
|
||||
}
|
||||
|
||||
public double getRelationCost() {
|
||||
if (isEnemy()) {
|
||||
return Conf.econCostEnemy;
|
||||
} else if (isAlly()) {
|
||||
return Conf.econCostAlly;
|
||||
} else if (isTruce()) {
|
||||
return Conf.econCostTruce;
|
||||
} else {
|
||||
return Conf.econCostNeutral;
|
||||
}
|
||||
}
|
||||
public double getRelationCost() {
|
||||
if (isEnemy()) {
|
||||
return Conf.econCostEnemy;
|
||||
} else if (isAlly()) {
|
||||
return Conf.econCostAlly;
|
||||
} else if (isTruce()) {
|
||||
return Conf.econCostTruce;
|
||||
} else {
|
||||
return Conf.econCostNeutral;
|
||||
}
|
||||
}
|
||||
|
||||
// Utility method to build items for F Perm GUI
|
||||
@Override
|
||||
public ItemStack buildItem() {
|
||||
final ConfigurationSection RELATION_CONFIG = P.p.getConfig().getConfigurationSection("fperm-gui.relation");
|
||||
// Utility method to build items for F Perm GUI
|
||||
@Override
|
||||
public ItemStack buildItem() {
|
||||
final ConfigurationSection RELATION_CONFIG = P.p.getConfig().getConfigurationSection("fperm-gui.relation");
|
||||
|
||||
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
||||
List<String> lore = new ArrayList<>();
|
||||
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
||||
List<String> lore = new ArrayList<>();
|
||||
|
||||
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase())).parseMaterial();
|
||||
if (material == null) {
|
||||
return null;
|
||||
}
|
||||
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase())).parseMaterial();
|
||||
if (material == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
|
||||
for (String loreLine : RELATION_CONFIG.getStringList("placeholder-item.lore")) {
|
||||
lore.add(replacePlaceholders(loreLine));
|
||||
}
|
||||
for (String loreLine : RELATION_CONFIG.getStringList("placeholder-item.lore")) {
|
||||
lore.add(replacePlaceholders(loreLine));
|
||||
}
|
||||
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
|
||||
return item;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public String replacePlaceholders(String string) {
|
||||
string = ChatColor.translateAlternateColorCodes('&', string);
|
||||
public String replacePlaceholders(String string) {
|
||||
string = ChatColor.translateAlternateColorCodes('&', string);
|
||||
|
||||
String permissableName = nicename.substring(0, 1).toUpperCase() + nicename.substring(1);
|
||||
String permissableName = nicename.substring(0, 1).toUpperCase() + nicename.substring(1);
|
||||
|
||||
string = string.replace("{relation-color}", getColor().toString());
|
||||
string = string.replace("{relation}", permissableName);
|
||||
string = string.replace("{relation-color}", getColor().toString());
|
||||
string = string.replace("{relation}", permissableName);
|
||||
|
||||
return string;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,140 +16,140 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum Role implements Permissable {
|
||||
LEADER(4, TL.ROLE_LEADER),
|
||||
COLEADER(3, TL.ROLE_COLEADER),
|
||||
MODERATOR(2, TL.ROLE_MODERATOR),
|
||||
NORMAL(1, TL.ROLE_NORMAL),
|
||||
RECRUIT(0, TL.ROLE_RECRUIT);
|
||||
LEADER(4, TL.ROLE_LEADER),
|
||||
COLEADER(3, TL.ROLE_COLEADER),
|
||||
MODERATOR(2, TL.ROLE_MODERATOR),
|
||||
NORMAL(1, TL.ROLE_NORMAL),
|
||||
RECRUIT(0, TL.ROLE_RECRUIT);
|
||||
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
public final TL translation;
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
public final TL translation;
|
||||
|
||||
|
||||
Role(final int value, final TL translation) {
|
||||
this.value = value;
|
||||
this.nicename = translation.toString();
|
||||
this.translation = translation;
|
||||
}
|
||||
Role(final int value, final TL translation) {
|
||||
this.value = value;
|
||||
this.nicename = translation.toString();
|
||||
this.translation = translation;
|
||||
}
|
||||
|
||||
public static Role getRelative(Role role, int relative) {
|
||||
return Role.getByValue(role.value + relative);
|
||||
}
|
||||
public static Role getRelative(Role role, int relative) {
|
||||
return Role.getByValue(role.value + relative);
|
||||
}
|
||||
|
||||
public static Role getByValue(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return RECRUIT;
|
||||
case 1:
|
||||
return NORMAL;
|
||||
case 2:
|
||||
return MODERATOR;
|
||||
case 3:
|
||||
return COLEADER;
|
||||
case 4:
|
||||
return LEADER;
|
||||
}
|
||||
public static Role getByValue(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return RECRUIT;
|
||||
case 1:
|
||||
return NORMAL;
|
||||
case 2:
|
||||
return MODERATOR;
|
||||
case 3:
|
||||
return COLEADER;
|
||||
case 4:
|
||||
return LEADER;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Role fromString(String check) {
|
||||
switch (check.toLowerCase()) {
|
||||
case "leader":
|
||||
case "admin":
|
||||
return LEADER;
|
||||
case "coleader":
|
||||
return COLEADER;
|
||||
case "mod":
|
||||
case "moderator":
|
||||
return MODERATOR;
|
||||
case "normal":
|
||||
case "member":
|
||||
return NORMAL;
|
||||
case "recruit":
|
||||
case "rec":
|
||||
return RECRUIT;
|
||||
}
|
||||
public static Role fromString(String check) {
|
||||
switch (check.toLowerCase()) {
|
||||
case "leader":
|
||||
case "admin":
|
||||
return LEADER;
|
||||
case "coleader":
|
||||
return COLEADER;
|
||||
case "mod":
|
||||
case "moderator":
|
||||
return MODERATOR;
|
||||
case "normal":
|
||||
case "member":
|
||||
return NORMAL;
|
||||
case "recruit":
|
||||
case "rec":
|
||||
return RECRUIT;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Role role) {
|
||||
return this.value >= role.value;
|
||||
}
|
||||
public boolean isAtLeast(Role role) {
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(Role role) {
|
||||
return this.value <= role.value;
|
||||
}
|
||||
public boolean isAtMost(Role role) {
|
||||
return this.value <= role.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public TL getTranslation() {
|
||||
return translation;
|
||||
}
|
||||
public TL getTranslation() {
|
||||
return translation;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
public String getPrefix() {
|
||||
|
||||
switch (this) {
|
||||
case LEADER:
|
||||
return Conf.prefixLeader;
|
||||
case COLEADER:
|
||||
return Conf.prefixCoLeader;
|
||||
case MODERATOR:
|
||||
return Conf.prefixMod;
|
||||
case NORMAL:
|
||||
return Conf.prefixNormal;
|
||||
case RECRUIT:
|
||||
return Conf.prefixRecruit;
|
||||
}
|
||||
switch (this) {
|
||||
case LEADER:
|
||||
return Conf.prefixLeader;
|
||||
case COLEADER:
|
||||
return Conf.prefixCoLeader;
|
||||
case MODERATOR:
|
||||
return Conf.prefixMod;
|
||||
case NORMAL:
|
||||
return Conf.prefixNormal;
|
||||
case RECRUIT:
|
||||
return Conf.prefixRecruit;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// Utility method to build items for F Perm GUI
|
||||
@Override
|
||||
public ItemStack buildItem() {
|
||||
final ConfigurationSection RELATION_CONFIG = P.p.getConfig().getConfigurationSection("fperm-gui.relation");
|
||||
// Utility method to build items for F Perm GUI
|
||||
@Override
|
||||
public ItemStack buildItem() {
|
||||
final ConfigurationSection RELATION_CONFIG = P.p.getConfig().getConfigurationSection("fperm-gui.relation");
|
||||
|
||||
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
||||
List<String> lore = new ArrayList<>();
|
||||
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
||||
List<String> lore = new ArrayList<>();
|
||||
|
||||
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).parseMaterial();
|
||||
if (material == null) {
|
||||
return null;
|
||||
}
|
||||
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).parseMaterial();
|
||||
if (material == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
|
||||
for (String loreLine : RELATION_CONFIG.getStringList("placeholder-item.lore")) {
|
||||
lore.add(replacePlaceholders(loreLine));
|
||||
}
|
||||
for (String loreLine : RELATION_CONFIG.getStringList("placeholder-item.lore")) {
|
||||
lore.add(replacePlaceholders(loreLine));
|
||||
}
|
||||
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
if (!P.p.mc17) {
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
}
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
if (!P.p.mc17) {
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
}
|
||||
|
||||
item.setItemMeta(itemMeta);
|
||||
item.setItemMeta(itemMeta);
|
||||
|
||||
return item;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public String replacePlaceholders(String string) {
|
||||
string = ChatColor.translateAlternateColorCodes('&', string);
|
||||
public String replacePlaceholders(String string) {
|
||||
string = ChatColor.translateAlternateColorCodes('&', string);
|
||||
|
||||
String permissableName = nicename.substring(0, 1).toUpperCase() + nicename.substring(1);
|
||||
String permissableName = nicename.substring(0, 1).toUpperCase() + nicename.substring(1);
|
||||
|
||||
string = string.replace("{relation-color}", ChatColor.GREEN.toString());
|
||||
string = string.replace("{relation}", permissableName);
|
||||
string = string.replace("{relation-color}", ChatColor.GREEN.toString());
|
||||
string = string.replace("{relation}", permissableName);
|
||||
|
||||
return string;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user