From e0aaa395a76a3dd7111dce6c5cc16df0d534bf57 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Fri, 16 Dec 2011 00:19:41 -0600 Subject: [PATCH] 1.6.1 stuff --- src/com/massivecraft/factions/Faction.java | 6 ++++++ src/com/massivecraft/factions/integration/Econ.java | 6 ++++++ .../factions/listeners/FactionsChatEarlyListener.java | 5 +++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index 32546978..3b9c1bd5 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -17,6 +17,7 @@ import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.*; import com.massivecraft.factions.zcore.persist.Entity; import com.nijikokun.register.payment.Method.MethodAccount; +import java.util.logging.Level; public class Faction extends Entity implements EconomyParticipator @@ -122,6 +123,11 @@ public class Faction extends Entity implements EconomyParticipator // We need to override the default money given to players. if ( ! Econ.getMethod().hasAccount(aid)) { + if ( ! Econ.getMethod().createAccount(aid)) + { + P.p.log(Level.SEVERE, "Error creating faction bank account through Register: "+aid); + return null; + } MethodAccount acc = Econ.getMethod().getAccount(aid); acc.set(0); } diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 342bb2a3..c5cbf81b 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -19,6 +19,7 @@ import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.RelationUtil; +import java.util.logging.Level; public class Econ { @@ -81,6 +82,11 @@ public class Econ public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) { + if (!shouldBeUsed()) + { + P.p.log(Level.WARNING, "Register does not appear to be hooked into an economy plugin."); + return; + } to.msg("%s's balance is %s.", about.describeTo(to, true), Econ.moneyString(about.getAccount().balance())); } diff --git a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java index 848c13bd..bd49cc75 100644 --- a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java @@ -45,9 +45,10 @@ public class FactionsChatEarlyListener extends PlayerListener // Is it a faction chat message? if (me.getChatMode() == ChatMode.FACTION) { + Faction myFaction = me.getFaction(); - String message = String.format(Conf.factionChatFormat, me.describeTo(me), msg); - me.getFaction().sendMessage(message); + String message = String.format(Conf.factionChatFormat, me.describeTo(myFaction), msg); + myFaction.sendMessage(message); P.p.log(Level.INFO, ChatColor.stripColor("FactionChat "+me.getFaction().getTag()+": "+message));