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


Java S38PacketPlayerListItem类代码示例

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


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

示例1: hidePlayer

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
public void hidePlayer(Player player) {
    Validate.notNull(player, "hidden player cannot be null");
    if (getHandle().playerNetServerHandler == null) return;
    if (equals(player)) return;
    if (hiddenPlayers.contains(player.getUniqueId())) return;
    hiddenPlayers.add(player.getUniqueId());

    //remove this player from the hidden player's EntityTrackerEntry
    net.minecraft.entity.EntityTracker tracker = ((net.minecraft.world.WorldServer) entity.worldObj).theEntityTracker;
    net.minecraft.entity.player.EntityPlayerMP other = ((CraftPlayer) player).getHandle();
    net.minecraft.entity.EntityTrackerEntry entry = (net.minecraft.entity.EntityTrackerEntry) tracker.trackedEntityIDs.lookup(other.getEntityId());
    if (entry != null) {
        entry.removePlayerFromTracker(getHandle());
    }

    //remove the hidden player from this player user list
    getHandle().playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S38PacketPlayerListItem(player.getPlayerListName(), false, 9999));
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:19,代码来源:CraftPlayer.java

示例2: showPlayer

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
public void showPlayer(Player player) {
    Validate.notNull(player, "shown player cannot be null");
    if (getHandle().playerNetServerHandler == null) return;
    if (equals(player)) return;
    if (!hiddenPlayers.contains(player.getUniqueId())) return;
    hiddenPlayers.remove(player.getUniqueId());

    EntityTracker tracker = ((WorldServer) entity.worldObj).theEntityTracker;
    EntityPlayerMP other = ((CraftPlayer) player).getHandle();
    EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntityIDs.lookup(other.getEntityId());
    if (entry != null) {
        entry.removePlayerFromTracker(getHandle());
    }

    getHandle().playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(player.getPlayerListName(), false, 9999));
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CraftPlayer.java

示例3: playerLoggedIn

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
/**
 * Called when a player successfully logs in. Reads player data from disk and inserts the player into the world.
 */
public void playerLoggedIn(EntityPlayerMP playerIn)
{
    this.playerEntityList.add(playerIn);
    this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn);
    this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn}));
    WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension);
    worldserver.spawnEntityInWorld(playerIn);
    this.preparePlayer(playerIn, (WorldServer)null);

    for (int i = 0; i < this.playerEntityList.size(); ++i)
    {
        EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);
        playerIn.playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {entityplayermp}));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:ServerConfigurationManager.java

示例4: playerLoggedOut

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
/**
 * Called when a player disconnects from the game. Writes player data to disk and removes them from the world.
 */
public void playerLoggedOut(EntityPlayerMP par1EntityPlayerMP)
{
    par1EntityPlayerMP.triggerAchievement(StatList.leaveGameStat);
    this.writePlayerData(par1EntityPlayerMP);
    WorldServer var2 = par1EntityPlayerMP.getServerForPlayer();

    if (par1EntityPlayerMP.ridingEntity != null)
    {
        var2.removePlayerEntityDangerously(par1EntityPlayerMP.ridingEntity);
        logger.debug("removing player mount");
    }

    var2.removeEntity(par1EntityPlayerMP);
    var2.getPlayerManager().removePlayer(par1EntityPlayerMP);
    this.playerEntityList.remove(par1EntityPlayerMP);
    this.field_148547_k.remove(par1EntityPlayerMP.getCommandSenderName());
    this.func_148540_a(new S38PacketPlayerListItem(par1EntityPlayerMP.getCommandSenderName(), false, 9999));
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:22,代码来源:ServerConfigurationManager.java

示例5: firePlayerListData

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
@Redirect(method = "playerLoggedOut",
        at = @At(value = "INVOKE", target = "Lnet/minecraft/server/management/ServerConfigurationManager;"
                + "sendPacketToAllPlayers(Lnet/minecraft/network/Packet;)V"))
public void firePlayerListData(ServerConfigurationManager manager, net.minecraft.network.Packet packetIn, EntityPlayerMP playerIn) {
    PlayerListData playerListData = ((Player) playerIn).getPlayerListData(PlayerListAction.REMOVE_PLAYER);
    for (EntityPlayerMP playerMP : manager.playerEntityList) {
        PlayerListHook playerListHook = new PlayerListHook(playerListData.copy(), (Player) playerMP);
        if (!playerListHook.call().isCanceled()) {
            S38PacketPlayerListItem packet = new S38PacketPlayerListItem();
            packet.action = S38PacketPlayerListItem.Action.valueOf(PlayerListAction.REMOVE_PLAYER.name());
            WorldSettings.GameType gameType =
                    WorldSettings.GameType.getByID(playerListHook.getData().getMode().getId());
            IChatComponent iChatComponent = playerListHook.getData().displayNameSet() ?
                    (IChatComponent) playerListHook.getData().getDisplayName() : null;
            packet.players.add(packet.new AddPlayerData(playerListHook.getData()
                    .getProfile(), playerListHook.getData().getPing(), gameType, iChatComponent));
            playerMP.playerNetServerHandler.sendPacket(packet);
        }
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:21,代码来源:MixinServerConfigurationManager.java

示例6: playerLoggedOut

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
public void playerLoggedOut(EntityPlayerMP p_72367_1_)
{
    FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_);
    p_72367_1_.triggerAchievement(StatList.leaveGameStat);
    this.writePlayerData(p_72367_1_);
    WorldServer worldserver = p_72367_1_.getServerForPlayer();

    if (p_72367_1_.ridingEntity != null)
    {
        worldserver.removePlayerEntityDangerously(p_72367_1_.ridingEntity);
        logger.debug("removing player mount");
    }

    worldserver.removeEntity(p_72367_1_);
    worldserver.getPlayerManager().removePlayer(p_72367_1_);
    this.playerEntityList.remove(p_72367_1_);
    this.field_148547_k.remove(p_72367_1_.getUniqueID());
    net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount());
    this.sendPacketToAllPlayers(new S38PacketPlayerListItem(p_72367_1_.getCommandSenderName(), false, 9999));
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:21,代码来源:ServerConfigurationManager.java

示例7: setPlayerListName

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
@Override
public void setPlayerListName(String name) {
    String oldName = getHandle().listName;

    if (name == null) {
        name = getName();
    }

    if (oldName.equals(name)) {
        return;
    }

    if (name.length() > 16) {
        throw new IllegalArgumentException("Player list names can only be a maximum of 16 characters long");
    }

    // Collisions will make for invisible people
    for (int i = 0; i < server.getHandle().playerEntityList.size(); ++i) {
        if (((net.minecraft.entity.player.EntityPlayerMP) server.getHandle().playerEntityList.get(i)).listName.equals(name)) {
            throw new IllegalArgumentException(name + " is already assigned as a player list name for someone");
        }
    }

    getHandle().listName = name;

    // Change the name on the client side
    net.minecraft.network.play.server.S38PacketPlayerListItem oldpacket = new net.minecraft.network.play.server.S38PacketPlayerListItem(oldName, false, 9999);
    net.minecraft.network.play.server.S38PacketPlayerListItem packet = new net.minecraft.network.play.server.S38PacketPlayerListItem(name, true, getHandle().ping);
    for (int i = 0; i < server.getHandle().playerEntityList.size(); ++i) {
        net.minecraft.entity.player.EntityPlayerMP entityplayer = (net.minecraft.entity.player.EntityPlayerMP) server.getHandle().playerEntityList.get(i);
        if (entityplayer.playerNetServerHandler == null) continue;

        if (entityplayer.getBukkitEntity().canSee(this)) {
            entityplayer.playerNetServerHandler.sendPacket(oldpacket);
            entityplayer.playerNetServerHandler.sendPacket(packet);
        }
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:39,代码来源:CraftPlayer.java

示例8: setGameType

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
public void setGameType(WorldSettings.GameType type)
{
    this.gameType = type;
    type.configurePlayerCapabilities(this.thisPlayerMP.capabilities);
    this.thisPlayerMP.sendPlayerAbilities();
    this.thisPlayerMP.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.UPDATE_GAME_MODE, new EntityPlayerMP[] {this.thisPlayerMP}));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:ItemInWorldManager.java

示例9: playerLoggedOut

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
/**
 * Called when a player disconnects from the game. Writes player data to disk and removes them from the world.
 */
public void playerLoggedOut(EntityPlayerMP playerIn)
{
    playerIn.triggerAchievement(StatList.leaveGameStat);
    this.writePlayerData(playerIn);
    WorldServer worldserver = playerIn.getServerForPlayer();

    if (playerIn.ridingEntity != null)
    {
        worldserver.removePlayerEntityDangerously(playerIn.ridingEntity);
        logger.debug("removing player mount");
    }

    worldserver.removeEntity(playerIn);
    worldserver.getPlayerManager().removePlayer(playerIn);
    this.playerEntityList.remove(playerIn);
    UUID uuid = playerIn.getUniqueID();
    EntityPlayerMP entityplayermp = (EntityPlayerMP)this.uuidToPlayerMap.get(uuid);

    if (entityplayermp == playerIn)
    {
        this.uuidToPlayerMap.remove(uuid);
        this.playerStatFiles.remove(uuid);
    }

    this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:30,代码来源:ServerConfigurationManager.java

示例10: onTick

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
/**
 * self explanitory
 */
public void onTick()
{
    if (++this.playerPingIndex > 600)
    {
        this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.UPDATE_LATENCY, this.playerEntityList));
        this.playerPingIndex = 0;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:ServerConfigurationManager.java

示例11: NetworkPlayerInfo

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
public NetworkPlayerInfo(S38PacketPlayerListItem.AddPlayerData p_i46295_1_)
{
    this.gameProfile = p_i46295_1_.getProfile();
    this.gameType = p_i46295_1_.getGameMode();
    this.responseTime = p_i46295_1_.getPing();
    this.displayName = p_i46295_1_.getDisplayName();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:NetworkPlayerInfo.java

示例12: handlePlayerListItem

import net.minecraft.network.play.server.S38PacketPlayerListItem; //导入依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void handlePlayerListItem(S38PacketPlayerListItem packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

	for (S38PacketPlayerListItem.AddPlayerData s38packetplayerlistitem$addplayerdata : packetIn.func_179767_a()) {
		if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.REMOVE_PLAYER) {
			this.playerInfoMap.remove(s38packetplayerlistitem$addplayerdata.getProfile().getId());
		} else {
			NetworkPlayerInfo networkplayerinfo = (NetworkPlayerInfo) this.playerInfoMap
					.get(s38packetplayerlistitem$addplayerdata.getProfile().getId());

			if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) {
				networkplayerinfo = new NetworkPlayerInfo(s38packetplayerlistitem$addplayerdata);
				this.playerInfoMap.put(networkplayerinfo.getGameProfile().getId(), networkplayerinfo);
			}

			if (networkplayerinfo != null) {
				switch (packetIn.func_179768_b()) {
				case ADD_PLAYER:
					networkplayerinfo.setGameType(s38packetplayerlistitem$addplayerdata.getGameMode());
					networkplayerinfo.setResponseTime(s38packetplayerlistitem$addplayerdata.getPing());
					break;

				case UPDATE_GAME_MODE:
					networkplayerinfo.setGameType(s38packetplayerlistitem$addplayerdata.getGameMode());
					break;

				case UPDATE_LATENCY:
					networkplayerinfo.setResponseTime(s38packetplayerlistitem$addplayerdata.getPing());
					break;

				case UPDATE_DISPLAY_NAME:
					networkplayerinfo.setDisplayName(s38packetplayerlistitem$addplayerdata.getDisplayName());
				}
			}
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:39,代码来源:NetHandlerPlayClient.java


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