Update getOnlinePlayers() to recent bukkit changes, fixes IntelliJ errors

This commit is contained in:
Shaun Bennett 2014-08-19 16:54:28 -05:00
parent b99e9d3f70
commit e1a57a673e
20 changed files with 28 additions and 20 deletions

Binary file not shown.

View File

@ -8,6 +8,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -9,7 +9,7 @@ public class UtilServer
{
public static Player[] getPlayers()
{
return getServer().getOnlinePlayers();
return getServer().getOnlinePlayers().toArray(new Player[0]);
}
public static Server getServer()

View File

@ -10,12 +10,13 @@
<orderEntry type="library" name="httpclient" level="project" />
<orderEntry type="library" name="httpcore" level="project" />
<orderEntry type="library" name="commons-codec" level="project" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="craftbukkit" level="project" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
<orderEntry type="library" name="jedis" level="project" />
<orderEntry type="library" name="commons-pool2" level="project" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -217,7 +217,7 @@ public class CoreClientManager extends MiniPlugin
client.SetPlayer(event.getPlayer());
// Reserved Slot Check
if (Bukkit.getOnlinePlayers().length >= Bukkit.getServer().getMaxPlayers())
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
{
if (client.GetRank().Has(event.getPlayer(), Rank.ULTRA, false))
{

View File

@ -357,7 +357,7 @@ public class AntiHack extends MiniPlugin
UtilServer.broadcast(F.main("MAC", player.getName() + " was kicked for suspicious movement."));
ServerListPingEvent event = new ServerListPingEvent(null, Bukkit.getServer().getMotd(), Bukkit.getServer().getOnlinePlayers().length, Bukkit.getServer().getMaxPlayers());
ServerListPingEvent event = new ServerListPingEvent(null, Bukkit.getServer().getMotd(), Bukkit.getServer().getOnlinePlayers().size(), Bukkit.getServer().getMaxPlayers());
GetPluginManager().callEvent(event);
String motd = event.getMotd();

View File

@ -15,6 +15,7 @@ import mineplex.core.MiniClientPlugin;
import mineplex.core.account.event.RetrieveClientInformationEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilServer;
import mineplex.core.friend.command.AddFriend;
import mineplex.core.friend.command.DeleteFriend;
import mineplex.core.friend.data.FriendData;
@ -93,14 +94,14 @@ public class FriendManager extends MiniClientPlugin<FriendData> implements IPack
@EventHandler
public void updateFriends(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW || Bukkit.getOnlinePlayers().length == 0)
if (event.getType() != UpdateType.SLOW || Bukkit.getOnlinePlayers().size() == 0)
return;
Bukkit.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable()
{
public void run()
{
final NautHashMap<String, FriendData> newData = _repository.getFriendsForAll(Bukkit.getOnlinePlayers());
final NautHashMap<String, FriendData> newData = _repository.getFriendsForAll(UtilServer.getPlayers());
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{

View File

@ -153,7 +153,7 @@ public class Portal extends MiniPlugin
@EventHandler
public void checkForServerTransfers(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().length == 0)
if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().size() == 0)
return;
_retrieve = !_retrieve;

View File

@ -131,11 +131,11 @@ public class ServerStatusManager extends MiniPlugin
*/
private MinecraftServer generateServerSnapshot()
{
ServerListPingEvent event = new ServerListPingEvent(null, GetPlugin().getServer().getMotd(), GetPlugin().getServer().getOnlinePlayers().length, GetPlugin().getServer().getMaxPlayers());
ServerListPingEvent event = new ServerListPingEvent(null, GetPlugin().getServer().getMotd(), GetPlugin().getServer().getOnlinePlayers().size(), GetPlugin().getServer().getMaxPlayers());
GetPluginManager().callEvent(event);
String motd = event.getMotd();
int playerCount = Bukkit.getOnlinePlayers().length;
int playerCount = Bukkit.getOnlinePlayers().size();
int maxPlayerCount = event.getMaxPlayers();
int tps = (int) _lagMeter.getTicksPerSecond();
String address = Bukkit.getServer().getIp().isEmpty() ? "localhost" : Bukkit.getServer().getIp();

View File

@ -14,6 +14,7 @@
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.ClassCombat" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
</component>

View File

@ -447,7 +447,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
CoreClient client = _clientManager.Get(event.getPlayer().getName());
// Reserved Slot Check
if (Bukkit.getOnlinePlayers().length - Bukkit.getServer().getMaxPlayers() >= 20)
if (Bukkit.getOnlinePlayers().size() - Bukkit.getServer().getMaxPlayers() >= 20)
{
if (!client.GetRank().Has(Rank.ULTRA))
{

View File

@ -8,6 +8,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -190,7 +190,7 @@ public class BungeeSigns extends JavaPlugin implements Listener, PluginMessageLi
public void run()
{
if (getServer().getOnlinePlayers().length > 0)
if (getServer().getOnlinePlayers().size() > 0)
{
for (String serverName : _signs.keySet())
{
@ -211,7 +211,7 @@ public class BungeeSigns extends JavaPlugin implements Listener, PluginMessageLi
e.printStackTrace();
}
getServer().getOnlinePlayers()[0].sendPluginMessage(this, "BungeeSigns", b.toByteArray());
getServer().getOnlinePlayers().iterator().next().sendPluginMessage(this, "BungeeSigns", b.toByteArray());
if (_signUpdate.get(serverName) != -1L && System.currentTimeMillis() - _signUpdate.get(serverName) > 5000)
{

View File

@ -11,6 +11,7 @@
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -10,6 +10,7 @@
<orderEntry type="module" module-name="Mineplex.Core" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -12,6 +12,7 @@
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.ClassCombat" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -565,7 +565,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
}
// Reserved Slot Check
if (Bukkit.getOnlinePlayers().length >= Bukkit.getServer().getMaxPlayers())
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
{
if (_serverStatusManager.getCurrentServerName().contains("BETA"))
{

View File

@ -226,7 +226,7 @@ public class PowerUpManager implements Listener
if (getGame().GetState() != GameState.Live)
return;
Player[] players = Bukkit.getOnlinePlayers();
Collection<? extends Player> players = Bukkit.getOnlinePlayers();
for (Player player : players)
{