All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.craftbukkit.util.LazyPlayerSet Maven / Gradle / Ivy

package org.bukkit.craftbukkit.util;

import net.minecraft.server.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import org.bukkit.entity.Player;

import java.util.HashSet;
import java.util.List;

public class LazyPlayerSet extends LazyHashSet {

  @Override
  HashSet makeReference() {
    if (reference != null) {
      throw new IllegalStateException("Reference already created!");
    }
    List players = MinecraftServer.getServer().getPlayerList().players;
    HashSet reference = new HashSet(players.size());
    for (EntityPlayer player : players) {
      reference.add(player.getBukkitEntity());
    }
    return reference;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy