Example usage for net.minecraftforge.common UsernameCache getMap

List of usage examples for net.minecraftforge.common UsernameCache getMap

Introduction

In this page you can find the example usage for net.minecraftforge.common UsernameCache getMap.

Prototype

public static Map<UUID, String> getMap() 

Source Link

Document

Get an immutable copy of the cache's underlying map

Usage

From source file:buildcraftAdditions.utils.PlayerUtils.java

License:GNU General Public License

public static UUID getPlayerUUID(String name) {
    if (name != null && !name.isEmpty()) {
        for (Map.Entry<UUID, String> entry : UsernameCache.getMap().entrySet())
            if (entry != null && entry.getValue() != null && entry.getValue().equalsIgnoreCase(name))
                return entry.getKey();
    }//from   w  w  w  . ja va 2  s  .co m
    return null;
}