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


Java ICommandSender.getName方法代码示例

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


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

示例1: func_147210_a

import net.minecraft.command.ICommandSender; //导入方法依赖的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.command.ICommandSender; //导入方法依赖的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: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	if (args.length < 1) throw new WrongUsageException("commands.incantation.usage");
	if (sender.getCommandSenderEntity() == null) return;
	final String command = args[0];
	if (ModCommands.commands.containsKey(command)) {
		ModCommands.commands.get(command).cast(server, sender, args);
	} else {
		throw new CommandException("commands.incantation.notFound", sender.getName());
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:12,代码来源:CommandIncantation.java

示例4: processCommand

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args[0].length() > 0)
    {
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.ban.failed", new Object[] {args[0]});
        }
        else
        {
            String s = null;

            if (args.length >= 2)
            {
                s = getChatComponentFromNthArg(sender, args, 1).getUnformattedText();
            }

            UserListBansEntry userlistbansentry = new UserListBansEntry(gameprofile, (Date)null, sender.getName(), (Date)null, s);
            minecraftserver.getConfigurationManager().getBannedPlayers().addEntry(userlistbansentry);
            EntityPlayerMP entityplayermp = minecraftserver.getConfigurationManager().getPlayerByUsername(args[0]);

            if (entityplayermp != null)
            {
                entityplayermp.playerNetServerHandler.kickPlayerFromServer("You are banned from this server.");
            }

            notifyOperators(sender, this, "commands.ban.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.ban.usage", new Object[0]);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:41,代码来源:CommandBanPlayer.java

示例5: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length != 3 && args.length != 2)
    {
        throw new WrongUsageException(getUsage(sender));
    }
    String act = args[0];
    String res = args[1];
    String player = args.length > 2 ? args[2] : sender.getName();
    if (!Arrays.asList(server.getPlayerList().getOnlinePlayerNames()).contains(player))
    {
        throw new CommandException("command.pm_if.playerNotFound");
    }
    if (!(PurMag.INSTANCE.getIfRegistry().containsEntry(res) || res.equals("all")))
    {
        throw new CommandException("command.pm_if.entryNotFound");
    }

    EntityPlayerMP p = server.getPlayerList().getPlayerByUsername(player);
    IIfEntryStore store = p.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null);
    if(res.equals("all"))
    {
        for(IfEntry entr : PurMag.INSTANCE.getIfRegistry().entries)
        {
            setSteps(store, sender, act, entr.getId());
        }
    }
    else
    {
        setSteps(store, sender, act, res);
    }
    store.sync(p);
    sender.sendMessage(new TextComponentTranslation("command.pm_if.success." + act, "§5" + res, "§5" + player));
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:36,代码来源:CommandIf.java

示例6: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args[0].length() > 0)
    {
        GameProfile gameprofile = server.getPlayerProfileCache().getGameProfileForUsername(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.ban.failed", new Object[] {args[0]});
        }
        else
        {
            String s = null;

            if (args.length >= 2)
            {
                s = getChatComponentFromNthArg(sender, args, 1).getUnformattedText();
            }

            UserListBansEntry userlistbansentry = new UserListBansEntry(gameprofile, (Date)null, sender.getName(), (Date)null, s);
            server.getPlayerList().getBannedPlayers().addEntry(userlistbansentry);
            EntityPlayerMP entityplayermp = server.getPlayerList().getPlayerByUsername(args[0]);

            if (entityplayermp != null)
            {
                entityplayermp.connection.kickPlayerFromServer("You are banned from this server.");
            }

            notifyCommandListener(sender, this, "commands.ban.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.ban.usage", new Object[0]);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:CommandBanPlayer.java


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