diff options
author | md_5 <git@md-5.net> | 2014-07-12 16:03:36 +1000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-07-19 20:07:50 +0100 |
commit | 465041b98b5283cfff231473d457b11f13766a76 (patch) | |
tree | deee438a807191ab4cd4795dab7326c53623d71c /EssentialsXMPP/src | |
parent | ed56afda26107837ce63dac63554ad8dc0e7bbcc (diff) | |
download | Essentials-465041b98b5283cfff231473d457b11f13766a76.tar Essentials-465041b98b5283cfff231473d457b11f13766a76.tar.gz Essentials-465041b98b5283cfff231473d457b11f13766a76.tar.lz Essentials-465041b98b5283cfff231473d457b11f13766a76.tar.xz Essentials-465041b98b5283cfff231473d457b11f13766a76.zip |
Optimize player / user iteration.
* Add a method for backwards compatability with unmapped code.
* Convert all getOnlinePlayers() calls to use this method, part of the IEssentials interface
* Add a new method getOnlineUsers() Ljava/lang/Iterable;
* Convert appropriate calls to use this method
* Update Bukkit to #1945
* Update CraftBukkit to #3103
Diffstat (limited to 'EssentialsXMPP/src')
3 files changed, 10 insertions, 1 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java index ab7cf986c..f1a2cd21d 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java @@ -149,4 +149,10 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP // Ignore exceptions } } + + @Override + public IEssentials getEss() + { + return ess; + } } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java index df329156d..cdc964cb1 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.IEssentials; import net.ess3.api.IUser; import java.util.List; import org.bukkit.entity.Player; @@ -25,4 +26,6 @@ public interface IEssentialsXMPP extends Plugin boolean toggleSpy(final Player user); void broadcastMessage(final IUser sender, final String message, final String xmppAddress); + + IEssentials getEss(); } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index 3d82670d1..a0ffd72e1 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -163,7 +163,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager final int usercount; final StringBuilder stringBuilder = new StringBuilder(); - usercount = parent.getServer().getOnlinePlayers().length; + usercount = parent.getEss().getOnlinePlayers().size(); if (usercount == 0) { |