Java Code Examples for org.spongepowered.api.profile.GameProfileManager

The following examples show how to use org.spongepowered.api.profile.GameProfileManager. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public UUID getUUID(String name) {
    try {
        GameProfileManager pm = Sponge.getServer().getGameProfileManager();
        GameProfile profile = pm.get(name).get();
        return profile != null ? profile.getUniqueId() : null;
    } catch (Exception e) {
        return null;
    }
}
 
Example 2
@Override
public String getName(UUID uuid) {
    try {
        GameProfileManager pm = Sponge.getServer().getGameProfileManager();
        GameProfile profile = pm.get(uuid).get();
        return profile != null ? profile.getName().orElse(null) : null;
    } catch (Exception e) {
        return null;
    }
}
 
Example 3
@Override
public UUID getUUID(String name) {
    try {
        GameProfileManager pm = Sponge.getServer().getGameProfileManager();
        GameProfile profile = pm.get(name).get();
        return profile != null ? profile.getUniqueId() : null;
    } catch (Exception e) {
        return null;
    }
}
 
Example 4
@Override
public String getName(UUID uuid) {
    try {
        GameProfileManager pm = Sponge.getServer().getGameProfileManager();
        GameProfile profile = pm.get(uuid).get();
        return profile != null ? profile.getName().orElse(null) : null;
    } catch (Exception e) {
        return null;
    }
}
 
Example 5
Source Project: ChangeSkin   Source File: SpongeSkinAPI.java    License: MIT License 5 votes vote down vote up
@Override
public void applyProperties(GameProfile profile, SkinModel targetSkin) {
    //remove existing skins
    profile.getPropertyMap().clear();

    if (targetSkin != null) {
        GameProfileManager profileManager = Sponge.getServer().getGameProfileManager();
        ProfileProperty profileProperty = profileManager.createProfileProperty(SkinProperty.SKIN_KEY
                , targetSkin.getEncodedValue(), targetSkin.getSignature());
        profile.getPropertyMap().put(SkinProperty.SKIN_KEY, profileProperty);
    }
}
 
Example 6
public GameProfileManager getResolver() {
    if (this.resolver == null) {
        this.resolver = this.game.getServer().getGameProfileManager();
    }
    return this.resolver;
}
 
Example 7
public GameProfileManager getResolver() {
    if (this.resolver == null) {
        this.resolver = this.game.getServer().getGameProfileManager();
    }
    return this.resolver;
}