diff --git a/pom.xml b/pom.xml
index 9b92f543..e3859dfc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -318,7 +318,7 @@
me.clip
placeholderapi
- 2.8.4
+ 2.8.5
provided
diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java
index 766672a3..ae5f7d92 100644
--- a/src/main/java/com/massivecraft/factions/P.java
+++ b/src/main/java/com/massivecraft/factions/P.java
@@ -194,7 +194,9 @@ public class P extends MPlugin {
}
}
- UtilFly.run();
+ if (getConfig().getBoolean("enable-faction-flight", true)) {
+ UtilFly.run();
+ }
Board.getInstance().load();
Board.getInstance().clean();
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java
index 34479693..055119f8 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java
@@ -141,8 +141,7 @@ public class CmdJoin extends FCommand {
}
faction.deinvite(fplayer);
- fme.setRole(faction.getDefaultRole());
-
+ fplayer.setRole(faction.getDefaultRole());
if (Conf.logFactionJoin) {
if (samePlayer) {
P.p.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java
index 11461956..925055c7 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java
@@ -34,6 +34,7 @@ public class CmdTitle extends FCommand {
args.remove(0);
String title = TextUtil.implode(args, " ");
+ title = title.replaceAll(",", "");
if (!canIAdministerYou(fme, you)) {
return;
diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyBalance.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyBalance.java
index 875625d4..5c5914d0 100644
--- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyBalance.java
+++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyBalance.java
@@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.FCommand;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
+import org.bukkit.command.CommandSender;
public class CmdMoneyBalance extends FCommand {
@@ -42,7 +43,9 @@ public class CmdMoneyBalance extends FCommand {
}
if (fme != null) {
- Econ.sendBalanceInfo(fme, faction);
+ Econ.sendBalanceInfo((CommandSender) fme, faction);
+ } else {
+ Econ.sendBalanceInfo(sender, faction);
}
}
diff --git a/src/main/java/com/massivecraft/factions/integration/Econ.java b/src/main/java/com/massivecraft/factions/integration/Econ.java
index dc40aba4..fe736b86 100644
--- a/src/main/java/com/massivecraft/factions/integration/Econ.java
+++ b/src/main/java/com/massivecraft/factions/integration/Econ.java
@@ -13,6 +13,7 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
+import org.bukkit.command.CommandSender;
import org.bukkit.plugin.RegisteredServiceProvider;
import java.text.DecimalFormat;
@@ -80,12 +81,12 @@ public class Econ {
modifyBalance(Conf.econUniverseAccount, delta);
}
- public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) {
+ public static void sendBalanceInfo(CommandSender to, Faction about) {
if (!shouldBeUsed()) {
P.p.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
return;
}
- to.msg("%s's balance is %s.", about.describeTo(to, true), Econ.moneyString(econ.getBalance(about.getAccountId())));
+ to.sendMessage(String.format("%s's balance is %s.", about.getTag(), Econ.moneyString(econ.getBalance(about.getAccountId()))));
}
public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you) {
@@ -135,6 +136,7 @@ public class Econ {
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
if (!shouldBeUsed()) {
+ invoker.msg(TL.ECON_OFF);
return false;
}
@@ -183,6 +185,12 @@ public class Econ {
return false;
}
+ // Check if the new balance is over Essential's money cap.
+ if (Essentials.isOverBalCap(to, econ.getBalance(toAcc) + amount)) {
+ invoker.msg(TL.ECON_OVER_BAL_CAP, amount);
+ return false;
+ }
+
// Transfer money
EconomyResponse erw = econ.withdrawPlayer(fromAcc, amount);
diff --git a/src/main/java/com/massivecraft/factions/integration/Essentials.java b/src/main/java/com/massivecraft/factions/integration/Essentials.java
index 7f552456..835d8562 100644
--- a/src/main/java/com/massivecraft/factions/integration/Essentials.java
+++ b/src/main/java/com/massivecraft/factions/integration/Essentials.java
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Teleport;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.massivecraft.factions.Conf;
+import com.massivecraft.factions.iface.EconomyParticipator;
import net.ess3.api.IEssentials;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -25,6 +26,13 @@ public class Essentials {
}
}
+ public static boolean isOverBalCap(EconomyParticipator participator, double amount) {
+ if (essentials == null) {
+ return false;
+ }
+ return amount > essentials.getSettings().getMaxMoney().doubleValue();
+ }
+
// return false if feature is disabled or Essentials isn't available
public static boolean handleTeleport(Player player, Location loc) {
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) {
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java
index cb9dab02..c12e3de5 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java
@@ -495,7 +495,7 @@ public class FactionsEntityListener implements Listener {
}
// You can never hurt faction members or allies
- if (relation.isMember() || relation.isAlly()) {
+ if (relation.isMember() || relation.isAlly() || relation.isTruce()) {
if (notify) {
attacker.msg(TL.PLAYER_PVP_CANTHURT, defender.describeTo(attacker));
}
diff --git a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java
index 4cd94c9b..26f9e272 100644
--- a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java
+++ b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java
@@ -38,6 +38,10 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return P.p.getDescription().getVersion();
}
+ @Override
+ public boolean persist() {
+ return true;
+ }
// Relational placeholders
@Override
@@ -95,9 +99,11 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return String.valueOf(fPlayer.getRolePrefix());
case "player_role":
return fPlayer.hasFaction() ? fPlayer.getRole().getPrefix() : "";
+ case "player_role_name":
+ return fPlayer.hasFaction() ? fPlayer.getRole().getTranslation().toString() : TL.PLACEHOLDER_ROLE_NAME.toString();
// Then Faction stuff
case "faction_name":
- return fPlayer.hasFaction() ? faction.getTag() : "";
+ return fPlayer.hasFaction() ? faction.getTag() : TL.NOFACTION_PREFIX.toString();
case "faction_power":
return String.valueOf(faction.getPowerRounded());
case "faction_powermax":
@@ -116,7 +122,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return String.valueOf(faction.getTnt());
case "faction_powerboost":
double powerBoost = faction.getPowerBoost();
- return (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_SHOW_BONUS.toString() : TL.COMMAND_SHOW_PENALTY.toString() + powerBoost + ")");
+ return (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_SHOW_BONUS.toString() : TL.COMMAND_SHOW_PENALTY.toString()) + powerBoost + ")";
case "faction_leader":
FPlayer fAdmin = faction.getFPlayerAdmin();
return fAdmin == null ? "Server" : fAdmin.getName().substring(0, fAdmin.getName().length() > 14 ? 13 : fAdmin.getName().length());
diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java
index 55741351..5af9881f 100644
--- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java
+++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java
@@ -767,6 +767,7 @@ public abstract class MemoryFPlayer implements FPlayer {
}
this.resetFactionData();
+ setFlying(false);
if (myFaction.isNormal() && !perm && myFaction.getFPlayers().isEmpty()) {
// Remove this faction
diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java
index 9ec3832c..1e18a0ec 100644
--- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java
+++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java
@@ -948,6 +948,8 @@ public enum TL {
PLAYER_NOT_FOUND("&c&l[!] &b%1$s &7is either not online or not in your faction!"),
+ PLACEHOLDER_ROLE_NAME("None"),
+
WARBANNER_NOFACTION("&cYou need a faction to use a warbanner!"),
WARBANNER_COOLDOWN("&cThe warbanner is on cooldown for your faction!"),
@@ -976,6 +978,8 @@ public enum TL {
ECON_OFF("no %s"), // no balance, no value, no refund, etc
ECON_FORMAT("###,###.###"),
+ ECON_DISABLED("Factions econ is disabled."),
+ ECON_OVER_BAL_CAP("&4The amount &e%s &4is over Essentials' balance cap."),
/**
* Relations
diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java
index e2952e4f..e91b129e 100644
--- a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java
+++ b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java
@@ -274,7 +274,8 @@ public enum TagReplacer {
* @return the string with the new value
*/
public String replace(String original, String value) {
- return original.replace(tag, value);
+ return (original != null && value != null) ? original.replace(tag, value) : original;
+
}
/**