当前位置: 首页>>代码示例>>Java>>正文


Java WrappedGameProfile类代码示例

本文整理汇总了Java中com.comphenix.protocol.wrappers.WrappedGameProfile的典型用法代码示例。如果您正苦于以下问题:Java WrappedGameProfile类的具体用法?Java WrappedGameProfile怎么用?Java WrappedGameProfile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WrappedGameProfile类属于com.comphenix.protocol.wrappers包,在下文中一共展示了WrappedGameProfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSkullItemStack

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public static ItemStack createSkullItemStack(String uuid, String textureValue, String textureSignature) {

		WrappedGameProfile wrappedProfile = new WrappedGameProfile(UUID.fromString(uuid), null);
		wrappedProfile.getProperties().put("textures", new WrappedSignedProperty("textures", textureValue, textureSignature));

		ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
		SkullMeta sm = (SkullMeta) skull.getItemMeta();

		Field profileField = null;
		try {
			profileField = sm.getClass().getDeclaredField("profile");
			profileField.setAccessible(true);
			profileField.set(sm, wrappedProfile.getHandle());
		} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
			e1.printStackTrace();
		}

		skull.setItemMeta(sm);
		return skull;
	}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:21,代码来源:InventoryUtils.java

示例2: playNext

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public void playNext() {
    ping.setVersionName(replace(config.online.next(), ip));
    if (!config.playerList.isEmpty()) {
        List<WrappedGameProfile> profileList = new ArrayList<>();
        for (String str : config.playerList.next()) {
            str = replace(str, ip);
            profileList.add(ReflectFactory.createGameProfile(str));
        }
        ping.setPlayers(ImmutableList.copyOf(profileList));
        ping.setPlayersVisible(true);
    } else {
        ping.setPlayersVisible(false);
    }
    ping.setFavicon(anim.nextFavicon());
    ping.setMotD(replace(anim.nextMOTDLine(), ip));

    packet.getServerPings().write(0, ping);
    try {
        pm.sendServerPacket(player, packet, true);
    } catch (InvocationTargetException ex) {
        ex.printStackTrace();
        finish = true;
    }
}
 
开发者ID:andylizi,项目名称:AnimColorMOTD,代码行数:25,代码来源:MOTDPacketListener.java

示例3: setTab

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public void setTab(Plugin plugin, int x, int y, String msg, int ping, WrappedGameProfile gameProfile)
{
    int a = -1;
    while ((tabs.get(a) == null || tabs.get(a).p != plugin) && a < 3)
    {
        a++;
    }
    if (a == 3 && (tabs.get(a) == null || tabs.get(a).p != plugin))
    {
        //System.out.println("Reseting Pri");
        setPriority(plugin, 0);
        a = 0;
    }
    //System.out.println(plugin.getName()+": "+a);
    TabHolder47 t = tabs.get(a);
    t.tabs[y][x] = msg;
    t.tabPings[y][x] = ping;
    t.tabGameProfiles[y][x] = gameProfile;
    t.maxh = TabAPI.getHorizSize(47);
    t.maxv = Math.max(x + 1, t.maxv);
}
 
开发者ID:grzegorz2047,项目名称:SurvivalCG,代码行数:22,代码来源:TabObject47.java

示例4: TabHolder47

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public TabHolder47(Plugin p)
{
    this.p = p;
    this.tabs = new String[TabAPI.getHorizSize(47)][TabAPI.getVertSize(47)];
    this.tabPings = new int[TabAPI.getHorizSize(47)][TabAPI.getVertSize(47)];
    this.tabGameProfiles = new WrappedGameProfile[TabAPI.getHorizSize(47)][TabAPI.getVertSize(47)];
    this.maxh = TabAPI.getHorizSize(47);
    this.maxv = TabAPI.getVertSize(47);
    for (int b = 0; b < this.maxv; b++)
    {
        for (int a = 0; a < this.maxh; a++)
        {
            this.tabs[a][b] = " ";
            this.tabPings[a][b] = 9999;
            this.tabGameProfiles[a][b] = null;
        }
    }
}
 
开发者ID:grzegorz2047,项目名称:SurvivalCG,代码行数:19,代码来源:TabHolder47.java

示例5: sendPlayerInfoChangeGameModePacket

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
private void sendPlayerInfoChangeGameModePacket(Player p, Player change, boolean spectator) {
    PacketContainer packet = new PacketContainer(PLAYER_INFO);
    packet.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.UPDATE_GAME_MODE);
    List<PlayerInfoData> data = new ArrayList<>();
    int ping = ThreadLocalRandom.current().nextInt(20) + 15;
    data.add(new PlayerInfoData(WrappedGameProfile.fromPlayer(change), ping,
            spectator ? EnumWrappers.NativeGameMode.SPECTATOR
                    : EnumWrappers.NativeGameMode.fromBukkit(change.getGameMode()),
            WrappedChatComponent.fromText(change.getPlayerListName())));
    packet.getPlayerInfoDataLists().write(0, data);
    try {
        ProtocolLibrary.getProtocolManager().sendServerPacket(p, packet);
    } catch (InvocationTargetException e) {
        throw new RuntimeException("Cannot send packet", e);
    }
}
 
开发者ID:MyzelYam,项目名称:SuperVanish,代码行数:17,代码来源:VanishIndication.java

示例6: updateSkin

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
private void updateSkin(WrappedGameProfile profile, String skinOwner) {
    try {
        JSONObject json = (JSONObject) new JSONParser().parse(profileCache.get(skinOwner));
        JSONArray properties = (JSONArray) json.get("properties");

        for (int i = 0; i < properties.size(); i++) {
            JSONObject property = (JSONObject) properties.get(i);
            String name = (String) property.get("name");
            String value = (String) property.get("value");
            String signature = (String) property.get("signature"); // May be NULL

            // Uncomment for ProtocolLib 3.4.0
            //profile.getProperties().put(name, new WrappedSignedProperty(name, value, signature));
            ((GameProfile) profile.getHandle()).getProperties().put(name, new Property(name, value, signature));
        }
    } catch (Exception e) {
        // ProtocolLib will throttle the number of exceptions printed to the console log
    }
}
 
开发者ID:KingFaris10,项目名称:SkinChanger,代码行数:20,代码来源:PlayerDisplayModifier.java

示例7: run

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
@Override
public void run() {
	while (!this.isInterrupted()) {
		this.blockThread();
		while (!this.queue.isEmpty()) {
			SkinEntry entry = this.queue.poll();
			if (FakeMobsPlugin.getPlugin().getMob(entry.getMob().getId()) != entry.getMob()) continue;

			Object nmsProfile = ReflectionUtils.searchUUID(entry.getSkinName());
			WrappedGameProfile profile = nmsProfile == null ? new WrappedGameProfile((UUID) null, entry.getSkinName()) : WrappedGameProfile.fromHandle(nmsProfile);

			if (profile.getProperties().isEmpty() && profile.isComplete())
				profile = WrappedGameProfile.fromHandle(ReflectionUtils.fillProfileProperties(profile.getHandle()));
			if (profile == null) continue;

			entry.getMob().setPlayerSkin(profile.getProperties());
			entry.getMob().updateCustomName();
			FakeMobsPlugin.getPlugin().saveMobsFile();
		}
	}
}
 
开发者ID:Howaner,项目名称:FakeMobs,代码行数:22,代码来源:SkinQueue.java

示例8: playerInfoPacket

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public static PacketContainer playerInfoPacket(
        String displayName,
        Integer latency,
        GameMode gameMode,
        String name,
        UUID uuid,
        Skin skin,
        EnumWrappers.PlayerInfoAction action
) {
    PacketContainer result = new PacketContainer(PLAYER_INFO);
    WrappedGameProfile profile = new WrappedGameProfile(uuid, name);
    if (action == EnumWrappers.PlayerInfoAction.ADD_PLAYER) {
        if (skin == null) {
            skin = Tablist.DEFAULT_SKIN_TEXTURE;
        }
        profile.getProperties().put(Skin.MULTIMAP_KEY, skin.toWrappedSignedProperty());
    }
    PlayerInfoData playerInfoData = new PlayerInfoData(
            profile,
            Optional.ofNullable(latency).map(PacketUtil::getPossibleLatency).orElse(0),
            Optional.ofNullable(gameMode).map(EnumWrappers.NativeGameMode::fromBukkit).orElse(EnumWrappers.NativeGameMode.NOT_SET),
            WrappedChatComponent.fromText(Optional.ofNullable(displayName).orElse(""))
    );
    result.getPlayerInfoDataLists().writeSafely(0, Collections.singletonList(playerInfoData));
    result.getPlayerInfoAction().writeSafely(0, action);
    return result;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:28,代码来源:PacketUtil.java

示例9: fromGameProfile

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public static Skin fromGameProfile(WrappedGameProfile gameProfile) {
    WrappedSignedProperty[] wrappedSignedProperties = gameProfile.getProperties().get(MULTIMAP_KEY).toArray(new WrappedSignedProperty[0]);
    if (wrappedSignedProperties.length == 0) {
        return Skin.EMPTY;
    } else {
        return fromWrappedSignedProperty(wrappedSignedProperties[0]);
    }
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:9,代码来源:Skin.java

示例10: getActualSkin

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public static Skin getActualSkin(Player player) {
    Skin skin = actualSkins.get(player);
    if (skin == null) {
        skin = Skin.fromGameProfile(WrappedGameProfile.fromPlayer(player));
        Logging.debug(SkinManager.class, "SKINTEXTURE GIVEN BY PROTOCOLLIB FOR PLAYER " + player.getName() + " = " + skin);
        if (!skin.toString().equals("[]")) {
            actualSkins.put(player, skin);
            if (!displayedSkins.containsKey(player)) {
                displayedSkins.put(player, skin);
            }
        }
    }
    Logging.debug(SkinManager.class, "ACTUALSKIN OF PLAYER " + player.getName() + " = " + skin);
    return skin;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:16,代码来源:SkinManager.java

示例11: createGameProfile

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public static WrappedGameProfile createGameProfile(String name) {
    try {
        //use ProtocolLib
        return new WrappedGameProfile(UUID.nameUUIDFromBytes(name.getBytes("UTF-8")), name);
    } catch (UnsupportedEncodingException ex) {
        assert false;
        return null;
    }
}
 
开发者ID:andylizi,项目名称:AnimColorMOTD,代码行数:10,代码来源:ReflectFactory.java

示例12: getInfoWrapper

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
public static WrapperPlayServerPlayerInfo getInfoWrapper(UUID playeruuid, PlayerInfoAction action) {
    WrapperPlayServerPlayerInfo wrapper = new WrapperPlayServerPlayerInfo();
    wrapper.setAction(action);
    WrappedGameProfile profile = new WrappedGameProfile(playeruuid, NameGenerator.newName());
    PlayerInfoData data = new PlayerInfoData(profile, 1, NativeGameMode.SURVIVAL, WrappedChatComponent.fromText(NameGenerator.newName()));
    List<PlayerInfoData> listdata = new ArrayList<>();
    listdata.add(data);
    wrapper.setData(listdata);
    return wrapper;
}
 
开发者ID:TechzoneMC,项目名称:SimpleAntiAura,代码行数:11,代码来源:AuraCheck.java

示例13: handlePing

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void handlePing(WrappedServerPing ping) {
	ping.setVersionName("iZenith 1.7.x, 1.8.x, 1.9.x");
	List<String> playerNames = new ArrayList<String>();
	for (Player player : Bukkit.getOnlinePlayers()) {
		playerNames.add(IPlayerHandler.getPlayer(player).getColoredName(false));
	}
	String players = Util.parseColors(Util.buildString(playerNames, "&7, ", 0, 40));
	ping.setPlayers(Arrays.asList(new WrappedGameProfile("id1", Util.parseColors(Util.getConfig().getString("player_list_message"))), new WrappedGameProfile("id2", Util.parseColors("&7") + players)));
}
 
开发者ID:bobmandude9889,项目名称:iZenith-PVP,代码行数:11,代码来源:ServerListHandler.java

示例14: getPlayerInfoData

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
private PlayerInfoData getPlayerInfoData(WrappedGameProfile profile, int ping, String displayName) {
    if (displayName != null) {
        // min width
        while (displayName.length() < this.minColumnWidth)
            displayName += " ";

        // max width
        if (this.maxColumnWidth > 0)
            while (displayName.length() > this.maxColumnWidth)
                displayName = displayName.substring(0, displayName.length() - 1);
    }

    return new PlayerInfoData(profile, ping, NativeGameMode.SURVIVAL, displayName == null ? null : WrappedChatComponent.fromText(displayName));
}
 
开发者ID:thekeenant,项目名称:tabbed,代码行数:15,代码来源:SimpleTabList.java

示例15: getGameProfile

import com.comphenix.protocol.wrappers.WrappedGameProfile; //导入依赖的package包/类
private WrappedGameProfile getGameProfile(int index, TabItem item) {
    String name = getStringIndex(index);
    UUID uuid = UUID.nameUUIDFromBytes(name.getBytes());

    WrappedGameProfile profile = new WrappedGameProfile(uuid, name + "|UpdateMC");
    profile.getProperties().put("textures", item.getSkin().getProperty());
    return profile;
}
 
开发者ID:thekeenant,项目名称:tabbed,代码行数:9,代码来源:SimpleTabList.java


注:本文中的com.comphenix.protocol.wrappers.WrappedGameProfile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。