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 | 035182fcda8acf77d3727ce21993e9bb57c90077 (patch) | |
tree | ec572bba04047317cadbf153848c2c08c42d2bca /EssentialsXMPP | |
parent | 310e41396b8122bb4889a6c757597b5ac2db5b78 (diff) | |
download | Essentials-035182fcda8acf77d3727ce21993e9bb57c90077.tar Essentials-035182fcda8acf77d3727ce21993e9bb57c90077.tar.gz Essentials-035182fcda8acf77d3727ce21993e9bb57c90077.tar.lz Essentials-035182fcda8acf77d3727ce21993e9bb57c90077.tar.xz Essentials-035182fcda8acf77d3727ce21993e9bb57c90077.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')
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) { |