org.spongepowered.api.profile.GameProfileManager Java Examples

The following examples show how to use org.spongepowered.api.profile.GameProfileManager. 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
Source File: FaweSponge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@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
Source File: FaweSponge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@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
Source File: FaweSponge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@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
Source File: FaweSponge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@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 File: SpongeSkinAPI.java    From ChangeSkin with 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
Source File: SpongeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public GameProfileManager getResolver() {
    if (this.resolver == null) {
        this.resolver = this.game.getServer().getGameProfileManager();
    }
    return this.resolver;
}
 
Example #7
Source File: SpongeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public GameProfileManager getResolver() {
    if (this.resolver == null) {
        this.resolver = this.game.getServer().getGameProfileManager();
    }
    return this.resolver;
}