From 2612615d52099411e89d2ea2ebdebce3cff0d261 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 16 Oct 2014 18:03:58 +0200 Subject: [PATCH] Increase the map width by another character, better ARRel, tweaked default permissions. --- .../java/com/massivecraft/factions/Const.java | 2 +- src/main/java/com/massivecraft/factions/Rel.java | 16 ++++++---------- .../factions/cmd/FactionsCommand.java | 2 +- .../com/massivecraft/factions/entity/MPerm.java | 6 +++--- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Const.java b/src/main/java/com/massivecraft/factions/Const.java index c21413bf..628d3b60 100644 --- a/src/main/java/com/massivecraft/factions/Const.java +++ b/src/main/java/com/massivecraft/factions/Const.java @@ -16,7 +16,7 @@ public class Const public static final String ASPECT = BASENAME; // ASCII Map - public static final int MAP_WIDTH = 47; + public static final int MAP_WIDTH = 48; public static final int MAP_HEIGHT = 8; public static final int MAP_HEIGHT_FULL = 17; diff --git a/src/main/java/com/massivecraft/factions/Rel.java b/src/main/java/com/massivecraft/factions/Rel.java index debacb90..241fcc22 100644 --- a/src/main/java/com/massivecraft/factions/Rel.java +++ b/src/main/java/com/massivecraft/factions/Rel.java @@ -87,16 +87,12 @@ public enum Rel return MEMBER; } - // This is how we check: Based on first char. - char c = str.charAt(0); - if (c == 'l') return LEADER; - if (c == 'o') return OFFICER; - if (c == 'm') return MEMBER; - if (c == 'r') return RECRUIT; - if (c == 'a') return ALLY; - if (c == 't') return TRUCE; - if (c == 'n') return NEUTRAL; - if (c == 'e') return ENEMY; + // NOTE: This assumes the first char is different for all. + for (Rel rel : values()) + { + String relStr = rel.toString().toLowerCase(); + if (relStr.startsWith(str)) return rel; + } return null; } diff --git a/src/main/java/com/massivecraft/factions/cmd/FactionsCommand.java b/src/main/java/com/massivecraft/factions/cmd/FactionsCommand.java index 8091be6b..2adcce69 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FactionsCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FactionsCommand.java @@ -6,7 +6,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.massivecore.cmd.MassiveCommand; import com.massivecraft.massivecore.util.Txt; -public abstract class FactionsCommand extends MassiveCommand +public class FactionsCommand extends MassiveCommand { // -------------------------------------------- // // FIELDS diff --git a/src/main/java/com/massivecraft/factions/entity/MPerm.java b/src/main/java/com/massivecraft/factions/entity/MPerm.java index 9660cdc2..aca20d7c 100644 --- a/src/main/java/com/massivecraft/factions/entity/MPerm.java +++ b/src/main/java/com/massivecraft/factions/entity/MPerm.java @@ -116,7 +116,7 @@ public class MPerm extends Entity implements Prioritized, Registerable getPermPerms(); } - public static MPerm getPermBuild() { return getCreative(PRIORITY_BUILD, ID_BUILD, ID_BUILD, "edit the terrain", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY), true, true, true); } + public static MPerm getPermBuild() { return getCreative(PRIORITY_BUILD, ID_BUILD, ID_BUILD, "edit the terrain", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER), true, true, true); } public static MPerm getPermPainbuild() { return getCreative(PRIORITY_PAINBUILD, ID_PAINBUILD, ID_PAINBUILD, "edit, take damage", new LinkedHashSet(), true, true, true); } public static MPerm getPermDoor() { return getCreative(PRIORITY_DOOR, ID_DOOR, ID_DOOR, "use doors", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); } public static MPerm getPermButton() { return getCreative(PRIORITY_BUTTON, ID_BUTTON, ID_BUTTON, "use stone buttons", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true); } @@ -131,8 +131,8 @@ public class MPerm extends Entity implements Prioritized, Registerable public static MPerm getPermTitle() { return getCreative(PRIORITY_TITLE, ID_TITLE, ID_TITLE, "set titles", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); } public static MPerm getPermHome() { return getCreative(PRIORITY_HOME, ID_HOME, ID_HOME, "teleport home", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), false, true, true); } public static MPerm getPermSethome() { return getCreative(PRIORITY_SETHOME, ID_SETHOME, ID_SETHOME, "set the home", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); } - public static MPerm getPermDeposit() { return getCreative(PRIORITY_DEPOSIT, ID_DEPOSIT, ID_DEPOSIT, "deposit money", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), false, false, false); } // non editable, non visible. - public static MPerm getPermWithdraw() { return getCreative(PRIORITY_WITHDRAW, ID_WITHDRAW, ID_WITHDRAW, "withdraw money", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); } + public static MPerm getPermDeposit() { return getCreative(PRIORITY_DEPOSIT, ID_DEPOSIT, ID_DEPOSIT, "deposit money", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY), false, false, false); } // non editable, non visible. + public static MPerm getPermWithdraw() { return getCreative(PRIORITY_WITHDRAW, ID_WITHDRAW, ID_WITHDRAW, "withdraw money", MUtil.set(Rel.LEADER), false, true, true); } public static MPerm getPermTerritory() { return getCreative(PRIORITY_TERRITORY, ID_TERRITORY, ID_TERRITORY, "claim or unclaim", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); } public static MPerm getPermAccess() { return getCreative(PRIORITY_ACCESS, ID_ACCESS, ID_ACCESS, "grant territory", MUtil.set(Rel.LEADER, Rel.OFFICER), false, true, true); } public static MPerm getPermClaimnear() { return getCreative(PRIORITY_CLAIMNEAR, ID_CLAIMNEAR, ID_CLAIMNEAR, "claim nearby", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), false, false, false); } // non editable, non visible.