本文整理汇总了Java中net.minecraft.scoreboard.Scoreboard.addPlayerToTeam方法的典型用法代码示例。如果您正苦于以下问题:Java Scoreboard.addPlayerToTeam方法的具体用法?Java Scoreboard.addPlayerToTeam怎么用?Java Scoreboard.addPlayerToTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.scoreboard.Scoreboard
的用法示例。
在下文中一共展示了Scoreboard.addPlayerToTeam方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: joinTeam
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void joinTeam(ICommandSender p_147190_1_, String[] p_147190_2_, int p_147190_3_) throws CommandException
{
Scoreboard scoreboard = this.getScoreboard();
String s = p_147190_2_[p_147190_3_++];
Set<String> set = Sets.<String>newHashSet();
Set<String> set1 = Sets.<String>newHashSet();
if (p_147190_1_ instanceof EntityPlayer && p_147190_3_ == p_147190_2_.length)
{
String s4 = getCommandSenderAsPlayer(p_147190_1_).getName();
if (scoreboard.addPlayerToTeam(s4, s))
{
set.add(s4);
}
else
{
set1.add(s4);
}
}
else
{
while (p_147190_3_ < p_147190_2_.length)
{
String s1 = p_147190_2_[p_147190_3_++];
if (s1.startsWith("@"))
{
for (Entity entity : func_175763_c(p_147190_1_, s1))
{
String s3 = getEntityName(p_147190_1_, entity.getUniqueID().toString());
if (scoreboard.addPlayerToTeam(s3, s))
{
set.add(s3);
}
else
{
set1.add(s3);
}
}
}
else
{
String s2 = getEntityName(p_147190_1_, s1);
if (scoreboard.addPlayerToTeam(s2, s))
{
set.add(s2);
}
else
{
set1.add(s2);
}
}
}
}
if (!set.isEmpty())
{
p_147190_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
notifyOperators(p_147190_1_, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))});
}
if (!set1.isEmpty())
{
throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))});
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例5: joinTeam
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void joinTeam(ICommandSender sender, String[] p_184916_2_, int p_184916_3_, MinecraftServer server) throws CommandException
{
Scoreboard scoreboard = this.getScoreboard(server);
String s = p_184916_2_[p_184916_3_++];
Set<String> set = Sets.<String>newHashSet();
Set<String> set1 = Sets.<String>newHashSet();
if (sender instanceof EntityPlayer && p_184916_3_ == p_184916_2_.length)
{
String s4 = getCommandSenderAsPlayer(sender).getName();
if (scoreboard.addPlayerToTeam(s4, s))
{
set.add(s4);
}
else
{
set1.add(s4);
}
}
else
{
while (p_184916_3_ < p_184916_2_.length)
{
String s1 = p_184916_2_[p_184916_3_++];
if (EntitySelector.hasArguments(s1))
{
for (Entity entity : getEntityList(server, sender, s1))
{
String s3 = getEntityName(server, sender, entity.getCachedUniqueIdString());
if (scoreboard.addPlayerToTeam(s3, s))
{
set.add(s3);
}
else
{
set1.add(s3);
}
}
}
else
{
String s2 = getEntityName(server, sender, s1);
if (scoreboard.addPlayerToTeam(s2, s))
{
set.add(s2);
}
else
{
set1.add(s2);
}
}
}
}
if (!set.isEmpty())
{
sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
notifyCommandListener(sender, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))});
}
if (!set1.isEmpty())
{
throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))});
}
}
示例6: joinTeam
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected void joinTeam(ICommandSender sender, String[] p_184916_2_, int p_184916_3_, MinecraftServer server) throws CommandException
{
Scoreboard scoreboard = this.getScoreboard(server);
String s = p_184916_2_[p_184916_3_++];
Set<String> set = Sets.<String>newHashSet();
Set<String> set1 = Sets.<String>newHashSet();
if (sender instanceof EntityPlayer && p_184916_3_ == p_184916_2_.length)
{
String s4 = getCommandSenderAsPlayer(sender).getName();
if (scoreboard.addPlayerToTeam(s4, s))
{
set.add(s4);
}
else
{
set1.add(s4);
}
}
else
{
while (p_184916_3_ < p_184916_2_.length)
{
String s1 = p_184916_2_[p_184916_3_++];
if (s1.startsWith("@"))
{
for (Entity entity : getEntityList(server, sender, s1))
{
String s3 = getEntityName(server, sender, entity.getCachedUniqueIdString());
if (scoreboard.addPlayerToTeam(s3, s))
{
set.add(s3);
}
else
{
set1.add(s3);
}
}
}
else
{
String s2 = getEntityName(server, sender, s1);
if (scoreboard.addPlayerToTeam(s2, s))
{
set.add(s2);
}
else
{
set1.add(s2);
}
}
}
}
if (!set.isEmpty())
{
sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
notifyCommandListener(sender, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))});
}
if (!set1.isEmpty())
{
throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))});
}
}