org.bukkit.block.Skull#setOwner ( )源码实例Demo

下面列出了org.bukkit.block.Skull#setOwner ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: askyblock   文件: SkullBlock.java
@SuppressWarnings("deprecation")
public boolean set(Block block) {
    Skull skull = (Skull) block.getState();
    if(skullOwnerName != null){
        skull.setOwner(skullOwnerName);
    }
    skull.setSkullType(skullType);
    skull.setRotation(skullRotation);
    skull.setRawData((byte) skullStanding);
    // Texture update
    if(skullTextureValue != null){
        setSkullWithNonPlayerProfile(skullTextureValue, skullTextureSignature, skullOwnerUUID, skullOwnerName, skull);
    }
    skull.update(true, false);
    return true;
}
 
源代码2 项目: UHC   文件: PlayerHeadProvider.java
public void setBlockAsHead(String name, Block headBlock, BlockFaceXZ direction) {
    // set the type to skull
    headBlock.setType(Material.SKULL);
    headBlock.setData((byte) 1);

    final Skull state = (Skull) headBlock.getState();

    state.setSkullType(SkullType.PLAYER);
    state.setOwner(name);
    state.setRotation(direction.getBlockFace());
    state.update();
}
 
源代码3 项目: UhcCore   文件: VersionUtils_1_8.java
@Override
public void setSkullOwner(Skull skull, UhcPlayer player) {
    skull.setOwner(player.getName());
}
 
源代码4 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void updateSkull(Skull skull, UUID uuid) {
	skull.setSkullType(SkullType.PLAYER);
	skull.setOwner(Bukkit.getOfflinePlayer(uuid).getName());
}
 
源代码5 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override 
public void updateSkull(Skull skull, UUID uuid) {
	skull.setSkullType(SkullType.PLAYER);
	skull.setOwner(Bukkit.getOfflinePlayer(uuid).getName());
}
 
源代码6 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void updateSkull(Skull skull, UUID uuid) {
	skull.setSkullType(SkullType.PLAYER);
	skull.setOwner(Bukkit.getOfflinePlayer(uuid).getName());
}
 
源代码7 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void updateSkull(Skull skull, UUID uuid) {
	skull.setSkullType(SkullType.PLAYER);
	skull.setOwner(Bukkit.getOfflinePlayer(uuid).getName());
}
 
源代码8 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void updateSkull(Skull skull, UUID uuid) {
	skull.setSkullType(SkullType.PLAYER);
	skull.setOwner(Bukkit.getOfflinePlayer(uuid).getName());
}
 
源代码9 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void updateSkull(Skull skull, UUID uuid) {
	skull.setSkullType(SkullType.PLAYER);
	skull.setOwner(Bukkit.getOfflinePlayer(uuid).getName());
}
 
源代码10 项目: HeavySpleef   文件: ExtensionLeaderboardPodium.java
@SuppressWarnings("deprecation")
public void update(Map<String, Statistic> statistics, boolean forceBlocks, boolean delete) {
	BlockFace2D rightDir = direction.right();
	BlockFace2D leftDir = direction.left();
	
	BlockFace rightFace = rightDir.getBlockFace3D();
	BlockFace leftFace = leftDir.getBlockFace3D();
	
	Block baseBlock = baseLocation.getBlock();
	if (delete) {
		baseBlock.setType(Material.AIR);
	}
	
	SignLayout layout = layoutConfig.getLayout();
	
	Iterator<Entry<String, Statistic>> iterator = statistics != null ? statistics.entrySet().iterator() : null;
	for (int i = 0; i < size.getStatisticAmount(); i++) {
		Entry<String, Statistic> entry = iterator != null && iterator.hasNext() ? iterator.next() : null;
		
		Block position = null;
		Material type = null;
		
		switch (i) {
		case 0:
			//Top
			position = baseBlock.getRelative(BlockFace.UP);
			type = Material.DIAMOND_BLOCK;
			break;
		case 1:
			//First left
			position = baseBlock.getRelative(leftFace);
			type = Material.GOLD_BLOCK;
			break;
		case 2:
			//First right
			position = baseBlock.getRelative(rightFace);
			type = Material.IRON_BLOCK;
			break;
		case 3:
			//Second left
			position = baseBlock.getRelative(leftFace, 2);
			type = Material.DOUBLE_STEP;
			break;
		case 4:
			//Second right
			position = baseBlock.getRelative(rightFace, 2);
			type = Material.DOUBLE_STEP;
			break;
		}
		
		if (position == null) {
			continue;
		}
		
		Block signBlock = position.getRelative(direction.getBlockFace3D());
		Block skullBlock = position.getRelative(BlockFace.UP);
		
		if (delete) {
			signBlock.setType(Material.AIR);
			skullBlock.setType(Material.AIR);
			position.setType(Material.AIR);
			continue;
		}
		
		if (baseBlock.getType() == Material.AIR || forceBlocks) {
			baseBlock.setType(Material.DOUBLE_STEP);
		}
		
		if (position.getType() == Material.AIR || forceBlocks) {
			position.setType(type);
		}
		
		if (entry == null) {
			continue;
		}
		
		/* For legacy reasons and compatibility */
		signBlock.setTypeId(Material.WALL_SIGN.getId(), false);
		skullBlock.setTypeId(Material.SKULL.getId(), false);
		
		Skull skull = (Skull) skullBlock.getState();
		skull.setRotation(direction.getBlockFace3D());
		skull.setSkullType(SkullType.PLAYER);
		skull.setOwner(entry.getKey());
		skull.setRawData(SKULL_ON_FLOOR);
		skull.update(true, false);
		
		Sign sign = (Sign) signBlock.getState();
		
		Set<Variable> variables = Sets.newHashSet();
		entry.getValue().supply(variables, null);
		variables.add(new Variable("player", entry.getKey()));
		variables.add(new Variable("rank", i + 1));
		
		layout.inflate(sign, variables);
		org.bukkit.material.Sign data = new org.bukkit.material.Sign(Material.WALL_SIGN);
		data.setFacingDirection(direction.getBlockFace3D());
		sign.setData(data);
		sign.update();
	}
}