當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityPlayerMP.getName方法代碼示例

本文整理匯總了Java中net.minecraft.entity.player.EntityPlayerMP.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityPlayerMP.getName方法的具體用法?Java EntityPlayerMP.getName怎麽用?Java EntityPlayerMP.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.player.EntityPlayerMP的用法示例。


在下文中一共展示了EntityPlayerMP.getName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: func_147210_a

import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
protected void func_147210_a(ICommandSender p_147210_1_, String p_147210_2_, String p_147210_3_)
{
    IPBanEntry ipbanentry = new IPBanEntry(p_147210_2_, (Date)null, p_147210_1_.getName(), (Date)null, p_147210_3_);
    MinecraftServer.getServer().getConfigurationManager().getBannedIPs().addEntry(ipbanentry);
    List<EntityPlayerMP> list = MinecraftServer.getServer().getConfigurationManager().getPlayersMatchingAddress(p_147210_2_);
    String[] astring = new String[list.size()];
    int i = 0;

    for (EntityPlayerMP entityplayermp : list)
    {
        entityplayermp.playerNetServerHandler.kickPlayerFromServer("You have been IP banned.");
        astring[i++] = entityplayermp.getName();
    }

    if (list.isEmpty())
    {
        notifyOperators(p_147210_1_, this, "commands.banip.success", new Object[] {p_147210_2_});
    }
    else
    {
        notifyOperators(p_147210_1_, this, "commands.banip.success.players", new Object[] {p_147210_2_, joinNiceString(astring)});
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:24,代碼來源:CommandBanIp.java

示例2: banIp

import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
protected void banIp(MinecraftServer server, ICommandSender sender, String ipAddress, @Nullable String banReason)
{
    UserListIPBansEntry userlistipbansentry = new UserListIPBansEntry(ipAddress, (Date)null, sender.getName(), (Date)null, banReason);
    server.getPlayerList().getBannedIPs().addEntry(userlistipbansentry);
    List<EntityPlayerMP> list = server.getPlayerList().getPlayersMatchingAddress(ipAddress);
    String[] astring = new String[list.size()];
    int i = 0;

    for (EntityPlayerMP entityplayermp : list)
    {
        entityplayermp.connection.kickPlayerFromServer("You have been IP banned.");
        astring[i++] = entityplayermp.getName();
    }

    if (list.isEmpty())
    {
        notifyCommandListener(sender, this, "commands.banip.success", new Object[] {ipAddress});
    }
    else
    {
        notifyCommandListener(sender, this, "commands.banip.success.players", new Object[] {ipAddress, joinNiceString(astring)});
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:24,代碼來源:CommandBanIp.java

示例3: processCommand

import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    EntityPlayerMP entityplayermp = args.length == 0 ? getCommandSenderAsPlayer(sender) : getPlayer(sender, args[0]);
    Item item = args.length >= 2 ? getItemByText(sender, args[1]) : null;
    int i = args.length >= 3 ? parseInt(args[2], -1) : -1;
    int j = args.length >= 4 ? parseInt(args[3], -1) : -1;
    NBTTagCompound nbttagcompound = null;

    if (args.length >= 5)
    {
        try
        {
            nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 4));
        }
        catch (NBTException nbtexception)
        {
            throw new CommandException("commands.clear.tagError", new Object[] {nbtexception.getMessage()});
        }
    }

    if (args.length >= 2 && item == null)
    {
        throw new CommandException("commands.clear.failure", new Object[] {entityplayermp.getName()});
    }
    else
    {
        int k = entityplayermp.inventory.clearMatchingItems(item, i, j, nbttagcompound);
        entityplayermp.inventoryContainer.detectAndSendChanges();

        if (!entityplayermp.capabilities.isCreativeMode)
        {
            entityplayermp.updateHeldItem();
        }

        sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, k);

        if (k == 0)
        {
            throw new CommandException("commands.clear.failure", new Object[] {entityplayermp.getName()});
        }
        else
        {
            if (j == 0)
            {
                sender.addChatMessage(new ChatComponentTranslation("commands.clear.testing", new Object[] {entityplayermp.getName(), Integer.valueOf(k)}));
            }
            else
            {
                notifyOperators(sender, this, "commands.clear.success", new Object[] {entityplayermp.getName(), Integer.valueOf(k)});
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:57,代碼來源:CommandClearInventory.java

示例4: execute

import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    EntityPlayerMP entityplayermp = args.length == 0 ? getCommandSenderAsPlayer(sender) : getPlayer(server, sender, args[0]);
    Item item = args.length >= 2 ? getItemByText(sender, args[1]) : null;
    int i = args.length >= 3 ? parseInt(args[2], -1) : -1;
    int j = args.length >= 4 ? parseInt(args[3], -1) : -1;
    NBTTagCompound nbttagcompound = null;

    if (args.length >= 5)
    {
        try
        {
            nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 4));
        }
        catch (NBTException nbtexception)
        {
            throw new CommandException("commands.clear.tagError", new Object[] {nbtexception.getMessage()});
        }
    }

    if (args.length >= 2 && item == null)
    {
        throw new CommandException("commands.clear.failure", new Object[] {entityplayermp.getName()});
    }
    else
    {
        int k = entityplayermp.inventory.clearMatchingItems(item, i, j, nbttagcompound);
        entityplayermp.inventoryContainer.detectAndSendChanges();

        if (!entityplayermp.capabilities.isCreativeMode)
        {
            entityplayermp.updateHeldItem();
        }

        sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, k);

        if (k == 0)
        {
            throw new CommandException("commands.clear.failure", new Object[] {entityplayermp.getName()});
        }
        else
        {
            if (j == 0)
            {
                sender.addChatMessage(new TextComponentTranslation("commands.clear.testing", new Object[] {entityplayermp.getName(), Integer.valueOf(k)}));
            }
            else
            {
                notifyCommandListener(sender, this, "commands.clear.success", new Object[] {entityplayermp.getName(), Integer.valueOf(k)});
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:57,代碼來源:CommandClearInventory.java


注:本文中的net.minecraft.entity.player.EntityPlayerMP.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。