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


Java PlayerList.getPlayerByUsername方法代码示例

本文整理汇总了Java中net.minecraft.server.management.PlayerList.getPlayerByUsername方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerList.getPlayerByUsername方法的具体用法?Java PlayerList.getPlayerByUsername怎么用?Java PlayerList.getPlayerByUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.server.management.PlayerList的用法示例。


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

示例1: unloadRecord

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
/**
 * Unload given record. It will send to all players a packet to unload a
 * record.
 */
public static void unloadRecord(Record record)
{
    PlayerList players = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList();
    String filename = record.filename;

    for (String username : players.getAllUsernames())
    {
        EntityPlayerMP player = players.getPlayerByUsername(username);

        if (player != null)
        {
            IRecording recording = Recording.get(player);

            if (recording.hasRecording(filename))
            {
                recording.removeRecording(filename);

                Dispatcher.sendTo(new PacketUnloadFrames(filename), player);
            }
        }
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:27,代码来源:Utils.java

示例2: broadcastPacket

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
/**
 * Broadcast a packet to all players 
 */
private void broadcastPacket(IMessage packet)
{
    PlayerList players = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList();

    for (String username : players.getAllUsernames())
    {
        EntityPlayerMP player = players.getPlayerByUsername(username);

        if (player != null)
        {
            Dispatcher.sendTo(packet, player);
        }
    }
}
 
开发者ID:mchorse,项目名称:metamorph,代码行数:18,代码来源:CommandMetamorph.java

示例3: broadcastMessage

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
/**
 * Send given message to everyone on the server, to everyone.
 *
 * Invoke this method only on the server side.
 */
public static void broadcastMessage(ITextComponent message)
{
    PlayerList players = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList();

    for (String username : players.getAllUsernames())
    {
        EntityPlayerMP player = players.getPlayerByUsername(username);

        if (player != null)
        {
            player.addChatMessage(message);
        }
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:20,代码来源:Utils.java

示例4: broadcastError

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
/**
 * Send given error to everyone on the server, to everyone.
 *
 * Invoke this method only on the server side.
 */
public static void broadcastError(String string, Object... objects)
{
    PlayerList players = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList();

    for (String username : players.getAllUsernames())
    {
        EntityPlayerMP player = players.getPlayerByUsername(username);

        if (player != null)
        {
            L10n.error(player, string, objects);
        }
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:20,代码来源:Utils.java

示例5: broadcastInfo

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
/**
 * Send given error to everyone on the server, to everyone.
 *
 * Invoke this method only on the server side.
 */
public static void broadcastInfo(String string, Object... objects)
{
    PlayerList players = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList();

    for (String username : players.getAllUsernames())
    {
        EntityPlayerMP player = players.getPlayerByUsername(username);

        if (player != null)
        {
            L10n.info(player, string, objects);
        }
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:20,代码来源:Utils.java

示例6: sendMessageToSecurePlayers

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
/** Sends a chat message to a list of secure players from another player */
public static void sendMessageToSecurePlayers(String chat, String chatSender, Iterable<SecurePlayer> list, EntityPlayerMP from) {
	PlayerList pl = from.getServer().getPlayerList();
	for (SecurePlayer p : list) {
		EntityPlayerMP match = pl.getPlayerByUsername(p.name);
		if (match != null)
			match.addChatMessage(new TextComponentString(chat));
	}
	from.addChatMessage(new TextComponentString(chatSender));
}
 
开发者ID:zerofall,项目名称:EZStorage2,代码行数:11,代码来源:SecurityOverrideHelper.java

示例7: getPlayerFromUsername

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
private EntityPlayerMP getPlayerFromUsername(String username)
{
    PlayerList scoman = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList();
    EntityPlayerMP player = scoman.getPlayerByUsername(username);
    return player;
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:7,代码来源:ServerStateMachine.java

示例8: execute

import net.minecraft.server.management.PlayerList; //导入方法依赖的package包/类
@Override
protected void execute()
{
    // Set up some initial conditions:
    ServerSection ss = currentMissionInit().getMission().getServerSection();
    ServerInitialConditions sic = (ss != null) ? ss.getServerInitialConditions() : null;
    if (sic != null && sic.getTime() != null)
    {
        boolean allowTimeToPass = (sic.getTime().isAllowPassageOfTime() != Boolean.FALSE);  // Defaults to true if unspecified.
        MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
        if (server.worlds != null && server.worlds.length != 0)
        {
            for (int i = 0; i < server.worlds.length; ++i)
            {
                World world = server.worlds[i];
                world.getGameRules().setOrCreateGameRule("doDaylightCycle", allowTimeToPass ? "true" : "false");
                if (sic.getTime().getStartTime() != null)
                    world.setWorldTime(sic.getTime().getStartTime());
            }
        }
    }
    ModSettings modsettings = currentMissionInit().getMission().getModSettings();
    if (modsettings != null && modsettings.getMsPerTick() != null)
        TimeHelper.serverTickLength = (long)(modsettings.getMsPerTick());
        
    if (getHandlers().quitProducer != null)
        getHandlers().quitProducer.prepare(currentMissionInit());

    if (getHandlers().worldDecorator != null)
        getHandlers().worldDecorator.prepare(currentMissionInit());

    // Fire the starting pistol:
    MalmoMod.safeSendToAll(MalmoMessageType.SERVER_GO);
    // And start the turn schedule turning, if there is one:
    if (!ServerStateMachine.this.userTurnSchedule.isEmpty())
    {
        String agentName = ServerStateMachine.this.userTurnSchedule.get(0);
        PlayerList scoman = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList();
        EntityPlayerMP player = scoman.getPlayerByUsername(agentName);
        if (player != null)
        {
            MalmoMod.network.sendTo(new MalmoMod.MalmoMessage(MalmoMessageType.SERVER_YOUR_TURN, ""), player);
        }
        else if (getHandlers().worldDecorator != null)
        {
            // Not a player - is it a world decorator?
            getHandlers().worldDecorator.targetedUpdate(agentName);
        }
    }
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:51,代码来源:ServerStateMachine.java


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