Fix for faction chat referring to all speakers as "you"

Fix for faction account being null from Register and triggering NPE with some economy plugins
Updated Register lib
This commit is contained in:
Brettflan 2011-10-27 08:48:14 -05:00
parent 7ab784f02e
commit d614dec781
3 changed files with 10 additions and 3 deletions

Binary file not shown.

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import java.util.*; import java.util.*;
import java.util.logging.Level;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -88,6 +89,11 @@ public class Faction extends Entity implements EconomyParticipator
// We need to override the default money given to players. // We need to override the default money given to players.
if ( ! Econ.getMethod().hasAccount(aid)) 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); MethodAccount acc = Econ.getMethod().getAccount(aid);
acc.set(0); acc.set(0);
} }

View File

@ -45,9 +45,10 @@ public class FactionsChatEarlyListener extends PlayerListener
// Is it a faction chat message? // Is it a faction chat message?
if (me.getChatMode() == ChatMode.FACTION) 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)); P.p.log(Level.INFO, ChatColor.stripColor("FactionChat "+me.getFaction().getTag()+": "+message));