Java Code Examples for org.bukkit.SkullType#PLAYER

The following examples show how to use org.bukkit.SkullType#PLAYER . 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: CraftSkull.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
static SkullType getSkullType(int id) {
    switch (id) {
        default:
        case 0:
            return SkullType.SKELETON;
        case 1:
            return SkullType.WITHER;
        case 2:
            return SkullType.ZOMBIE;
        case 3:
            return SkullType.PLAYER;
        case 4:
            return SkullType.CREEPER;
        case 5:
            return SkullType.DRAGON;
    }
}
 
Example 2
Source File: CraftSkull.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean setOwner(String name) {
    if (name == null || name.length() > MAX_OWNER_LENGTH) {
        return false;
    }

    GameProfile profile = MinecraftServer.getServerCB().getPlayerProfileCache().getGameProfileForUsername(name);
    if (profile == null) {
        return false;
    }

    if (skullType != SkullType.PLAYER) {
        skullType = SkullType.PLAYER;
    }

    this.profile = profile;
    return true;
}
 
Example 3
Source File: CraftSkull.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
static SkullType getSkullType(int id) {
    switch (id) {
        case 0:
            return SkullType.SKELETON;
        case 1:
            return SkullType.WITHER;
        case 2:
            return SkullType.ZOMBIE;
        case 3:
            return SkullType.PLAYER;
        case 4:
            return SkullType.CREEPER;
        default:
            throw new AssertionError(id);
    }
}
 
Example 4
Source File: CraftSkull.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
public boolean setOwner(String name) {
    if (name == null || name.length() > MAX_OWNER_LENGTH) {
        return false;
    }

    GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152655_a (name);
    if (profile == null) {
        return false;
    }

    if (skullType != SkullType.PLAYER) {
        skullType = SkullType.PLAYER;
    }

    this.profile = profile;
    return true;
}
 
Example 5
Source File: CraftSkull.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean update(boolean force, boolean applyPhysics) {
    boolean result = super.update(force, applyPhysics);

    if (result) {
        if (skullType == SkullType.PLAYER) {
            skull.func_152106_a(profile);
        } else {
            skull.func_152107_a(getSkullType(skullType));
        }

        skull.func_145903_a(rotation);
        skull.markDirty();
    }

    return result;
}
 
Example 6
Source File: CraftSkull.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setOwningPlayer(OfflinePlayer player) {
    Preconditions.checkNotNull(player, "player");

    if (skullType != SkullType.PLAYER) {
        skullType = SkullType.PLAYER;
    }

    this.profile = new GameProfile(player.getUniqueId(), player.getName());
}
 
Example 7
Source File: CraftSkull.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setSkullType(SkullType skullType) {
    this.skullType = skullType;

    if (skullType != SkullType.PLAYER) {
        profile = null;
    }
}
 
Example 8
Source File: CraftSkull.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void applyTo(TileEntitySkull skull) {
    super.applyTo(skull);

    if (skullType == SkullType.PLAYER) {
        skull.setPlayerProfile(profile);
    } else {
        skull.setType(getSkullType(skullType));
    }

    skull.setSkullRotation(rotation);
}
 
Example 9
Source File: CraftSkull.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public void setSkullType(SkullType skullType) {
    this.skullType = skullType;

    if (skullType != SkullType.PLAYER) {
        profile = null;
    }
}