diff options
Diffstat (limited to 'EssentialsXMPP/src/com/earth2me')
4 files changed, 13 insertions, 9 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java index 8ab62cd4d..34f862627 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.xmpp; import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IUser; import com.earth2me.essentials.Util; import java.util.List; import java.util.logging.Level; @@ -83,9 +84,10 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP } @Override - public String getUserByAddress(final String address) + public IUser getUserByAddress(final String address) { - return instance.users.getUserByAddress(address); + String username = instance.users.getUserByAddress(address); + return username == null ? null : ess.getUser(username); } @Override @@ -122,9 +124,9 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP } @Override - public void broadcastMessage(final String name, final String message) + public void broadcastMessage(final IUser sender, final String message) { - ess.broadcastMessage(name, message); + ess.broadcastMessage(sender, message); try { for (String address : getSpyUsers()) diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java index d90bff803..1ed9fa732 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.xmpp; +import com.earth2me.essentials.IUser; import java.util.List; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -13,7 +14,7 @@ public interface IEssentialsXMPP extends Plugin List<String> getSpyUsers(); - String getUserByAddress(final String address); + IUser getUserByAddress(final String address); boolean sendMessage(final Player user, final String message); @@ -23,5 +24,5 @@ public interface IEssentialsXMPP extends Plugin boolean toggleSpy(final Player user); - void broadcastMessage(final String name, final String message); + void broadcastMessage(final IUser sender, final String message); } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java index 6a2a6e80a..9734444ad 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java @@ -47,7 +47,7 @@ public class UserManager implements IConf return username; } } - return search; + return null; } public void setAddress(final String username, final String address) diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index e43844c5b..d7aedb9f4 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.xmpp; import com.earth2me.essentials.Console; import com.earth2me.essentials.EssentialsConf; import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IUser; import java.io.File; import java.util.ArrayList; import java.util.Collections; @@ -101,8 +102,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager sendCommand(chat, message); break; default: - final String name = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant())); - parent.broadcastMessage(name, "="+name+": "+ message); + final IUser sender = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant())); + parent.broadcastMessage(sender, "="+sender.getDisplayName()+": "+ message); } } } |