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


Java Scoreboard.createTeam方法代码示例

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


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

示例1: addTeam

import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void addTeam(ICommandSender sender, String[] args, int index) throws CommandException
{
    String s = args[index++];
    Scoreboard scoreboard = this.getScoreboard();

    if (scoreboard.getTeam(s) != null)
    {
        throw new CommandException("commands.scoreboard.teams.add.alreadyExists", new Object[] {s});
    }
    else if (s.length() > 16)
    {
        throw new SyntaxErrorException("commands.scoreboard.teams.add.tooLong", new Object[] {s, Integer.valueOf(16)});
    }
    else if (s.length() == 0)
    {
        throw new WrongUsageException("commands.scoreboard.teams.add.usage", new Object[0]);
    }
    else
    {
        if (args.length > index)
        {
            String s1 = getChatComponentFromNthArg(sender, args, index).getUnformattedText();

            if (s1.length() > 32)
            {
                throw new SyntaxErrorException("commands.scoreboard.teams.add.displayTooLong", new Object[] {s1, Integer.valueOf(32)});
            }

            if (s1.length() > 0)
            {
                scoreboard.createTeam(s).setTeamName(s1);
            }
            else
            {
                scoreboard.createTeam(s);
            }
        }
        else
        {
            scoreboard.createTeam(s);
        }

        notifyOperators(sender, this, "commands.scoreboard.teams.add.success", new Object[] {s});
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:46,代码来源:CommandScoreboard.java

示例2: handleTeams

import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
 * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team-
 * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled
 */
public void handleTeams(S3EPacketTeams packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();
    ScorePlayerTeam scoreplayerteam;

    if (packetIn.func_149307_h() == 0)
    {
        scoreplayerteam = scoreboard.createTeam(packetIn.func_149312_c());
    }
    else
    {
        scoreplayerteam = scoreboard.getTeam(packetIn.func_149312_c());
    }

    if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 2)
    {
        scoreplayerteam.setTeamName(packetIn.func_149306_d());
        scoreplayerteam.setNamePrefix(packetIn.func_149311_e());
        scoreplayerteam.setNameSuffix(packetIn.func_149309_f());
        scoreplayerteam.setChatFormat(EnumChatFormatting.func_175744_a(packetIn.func_179813_h()));
        scoreplayerteam.func_98298_a(packetIn.func_149308_i());
        Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(packetIn.func_179814_i());

        if (team$enumvisible != null)
        {
            scoreplayerteam.setNameTagVisibility(team$enumvisible);
        }
    }

    if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 3)
    {
        for (String s : packetIn.func_149310_g())
        {
            scoreboard.addPlayerToTeam(s, packetIn.func_149312_c());
        }
    }

    if (packetIn.func_149307_h() == 4)
    {
        for (String s1 : packetIn.func_149310_g())
        {
            scoreboard.removePlayerFromTeam(s1, scoreplayerteam);
        }
    }

    if (packetIn.func_149307_h() == 1)
    {
        scoreboard.removeTeam(scoreplayerteam);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:56,代码来源:NetHandlerPlayClient.java

示例3: handleTeams

import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
 * Updates a team managed by the scoreboard: Create/Remove the team
 * registration, Register/Remove the player-team- memberships, Set team
 * displayname/prefix/suffix and/or whether friendly fire is enabled
 */
public void handleTeams(S3EPacketTeams packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	Scoreboard scoreboard = this.clientWorldController.getScoreboard();
	ScorePlayerTeam scoreplayerteam;

	if (packetIn.func_149307_h() == 0) {
		scoreplayerteam = scoreboard.createTeam(packetIn.func_149312_c());
	} else {
		scoreplayerteam = scoreboard.getTeam(packetIn.func_149312_c());
	}

	if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 2) {
		scoreplayerteam.setTeamName(packetIn.func_149306_d());
		scoreplayerteam.setNamePrefix(packetIn.func_149311_e());
		scoreplayerteam.setNameSuffix(packetIn.func_149309_f());
		scoreplayerteam.setChatFormat(EnumChatFormatting.func_175744_a(packetIn.func_179813_h()));
		scoreplayerteam.func_98298_a(packetIn.func_149308_i());
		Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(packetIn.func_179814_i());

		if (team$enumvisible != null) {
			scoreplayerteam.setNameTagVisibility(team$enumvisible);
		}
	}

	if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 3) {
		for (String s : packetIn.func_149310_g()) {
			scoreboard.addPlayerToTeam(s, packetIn.func_149312_c());
		}
	}

	if (packetIn.func_149307_h() == 4) {
		for (String s1 : packetIn.func_149310_g()) {
			scoreboard.removePlayerFromTeam(s1, scoreplayerteam);
		}
	}

	if (packetIn.func_149307_h() == 1) {
		scoreboard.removeTeam(scoreplayerteam);
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:46,代码来源:NetHandlerPlayClient.java

示例4: handleTeams

import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
 * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team-
 * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled
 */
public void handleTeams(SPacketTeams packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Scoreboard scoreboard = this.clientWorldController.getScoreboard();
    ScorePlayerTeam scoreplayerteam;

    if (packetIn.getAction() == 0)
    {
        scoreplayerteam = scoreboard.createTeam(packetIn.getName());
    }
    else
    {
        scoreplayerteam = scoreboard.getTeam(packetIn.getName());
    }

    if (packetIn.getAction() == 0 || packetIn.getAction() == 2)
    {
        scoreplayerteam.setTeamName(packetIn.getDisplayName());
        scoreplayerteam.setNamePrefix(packetIn.getPrefix());
        scoreplayerteam.setNameSuffix(packetIn.getSuffix());
        scoreplayerteam.setChatFormat(TextFormatting.fromColorIndex(packetIn.getColor()));
        scoreplayerteam.setFriendlyFlags(packetIn.getFriendlyFlags());
        Team.EnumVisible team$enumvisible = Team.EnumVisible.getByName(packetIn.getNameTagVisibility());

        if (team$enumvisible != null)
        {
            scoreplayerteam.setNameTagVisibility(team$enumvisible);
        }

        Team.CollisionRule team$collisionrule = Team.CollisionRule.getByName(packetIn.getCollisionRule());

        if (team$collisionrule != null)
        {
            scoreplayerteam.setCollisionRule(team$collisionrule);
        }
    }

    if (packetIn.getAction() == 0 || packetIn.getAction() == 3)
    {
        for (String s : packetIn.getPlayers())
        {
            scoreboard.addPlayerToTeam(s, packetIn.getName());
        }
    }

    if (packetIn.getAction() == 4)
    {
        for (String s1 : packetIn.getPlayers())
        {
            scoreboard.removePlayerFromTeam(s1, scoreplayerteam);
        }
    }

    if (packetIn.getAction() == 1)
    {
        scoreboard.removeTeam(scoreplayerteam);
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:63,代码来源:NetHandlerPlayClient.java

示例5: addTeam

import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void addTeam(ICommandSender sender, String[] p_184910_2_, int p_184910_3_, MinecraftServer server) throws CommandException
{
    String s = p_184910_2_[p_184910_3_++];
    Scoreboard scoreboard = this.getScoreboard(server);

    if (scoreboard.getTeam(s) != null)
    {
        throw new CommandException("commands.scoreboard.teams.add.alreadyExists", new Object[] {s});
    }
    else if (s.length() > 16)
    {
        throw new SyntaxErrorException("commands.scoreboard.teams.add.tooLong", new Object[] {s, Integer.valueOf(16)});
    }
    else if (s.isEmpty())
    {
        throw new WrongUsageException("commands.scoreboard.teams.add.usage", new Object[0]);
    }
    else
    {
        if (p_184910_2_.length > p_184910_3_)
        {
            String s1 = getChatComponentFromNthArg(sender, p_184910_2_, p_184910_3_).getUnformattedText();

            if (s1.length() > 32)
            {
                throw new SyntaxErrorException("commands.scoreboard.teams.add.displayTooLong", new Object[] {s1, Integer.valueOf(32)});
            }

            if (s1.isEmpty())
            {
                scoreboard.createTeam(s);
            }
            else
            {
                scoreboard.createTeam(s).setTeamName(s1);
            }
        }
        else
        {
            scoreboard.createTeam(s);
        }

        notifyCommandListener(sender, this, "commands.scoreboard.teams.add.success", new Object[] {s});
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:46,代码来源:CommandScoreboard.java


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