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


Java Team.setSuffix方法代码示例

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


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

示例1: setSlot

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void setSlot(int slot, String text) {
	Team team = scoreboard.getTeam("SLOT_" + slot);
	String entry = genEntry(slot);
	if(!scoreboard.getEntries().contains(entry)) {
		sidebar.getScore(entry).setScore(slot);
	}

	text = PlaceholderAPI.setPlaceholders(player, text);
	String pre = getFirstSplit(text);
	String suf = getFirstSplit(ChatColor.getLastColors(pre) + getSecondSplit(text));

	if(!team.getPrefix().equals(pre))
		team.setPrefix(pre);
	if(!team.getSuffix().equals(suf))
		team.setSuffix(suf);
}
 
开发者ID:crisdev333,项目名称:ProScoreboard,代码行数:17,代码来源:ScoreHelper.java

示例2: refreshTeam

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void refreshTeam(VPPlayer player){
	Team t2 = Bukkit.getScoreboardManager().getMainScoreboard().getPlayerTeam(player.getPlayer());
	if(t2 != null && !t2.getName().startsWith("_VP_"))
		return;
	if(player.isNick()){
		nick.addPlayer(player.getPlayer());
	}else{
		String name = intFormat.format(1000-player.getGroupLevel());
		Team t = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(name);
		if(t == null)
			t = Bukkit.getScoreboardManager().getMainScoreboard().registerNewTeam(name);
		if(player.getPrefix().length()>16)
			t.setPrefix(player.getPrefix().substring(0, 16));
		else
			t.setPrefix(player.getPrefix());
		if(player.getSuffix().length()>16)
			t.setSuffix(player.getSuffix().substring(0, 16));
		else
			t.setSuffix(player.getSuffix());
		t.addPlayer(player.getPlayer());
	}
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:23,代码来源:PlayerManager.java

示例3: refreshScoreboard

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void refreshScoreboard() {
	Team team = getScoreboardTeam();

	for (String entry : team.getEntries()) {
		team.removeEntry(entry);
	}
	team.addEntry(getBukkitEntity().getName());

	team.setPrefix(Strings.nullToEmpty(scoreboardPrefix));
	team.setSuffix(Strings.nullToEmpty(scoreboardSuffix));

	if (nameHidden) {
		//			team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
		team.setNameTagVisibility(NameTagVisibility.NEVER);
	} else {
		//			team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
		team.setNameTagVisibility(NameTagVisibility.ALWAYS);
	}
}
 
开发者ID:InventivetalentDev,项目名称:CompactNPCLib,代码行数:20,代码来源:NPCPlayer.java

示例4: addTeamEntry

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void addTeamEntry(Player target, Player all, PermissionGroup permissionGroup)
{
    Team team = all.getScoreboard().getTeam(permissionGroup.getTagId() + permissionGroup.getName());
    if (team == null)
        team = all.getScoreboard().registerNewTeam(permissionGroup.getTagId() + permissionGroup.getName());

    team.setPrefix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getPrefix()));
    team.setSuffix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getSuffix()));

    team.addEntry(target.getName());

    target.setDisplayName(ChatColor.translateAlternateColorCodes('&', permissionGroup.getDisplay() + target.getName()));
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:14,代码来源:CloudServer.java

示例5: updatePartyScoreboardTeam

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
protected void updatePartyScoreboardTeam(Party party, Team team, boolean forObservers) {
    logger.fine("Updating scoreboard team " + toString(team) + " for party " + party);

    team.setDisplayName(party.getName());
    team.setPrefix(party.getColor().toString());
    team.setSuffix(ChatColor.WHITE.toString());

    team.setCanSeeFriendlyInvisibles(true);
    team.setAllowFriendlyFire(getMatch().getMapInfo().friendlyFire);
    team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);

    if(!forObservers && party instanceof Competitor) {
        Team.OptionStatus nameTags = ((Competitor) party).getNameTagVisibility();

        // #HACK until this is fixed https://bugs.mojang.com/browse/MC-48730 we need to
        // ensure enemy name tags are always hidden for GS.
        if(getMatch().getMatchModule(GhostSquadronMatchModule.class) != null) {
            switch(nameTags) {
                case ALWAYS: nameTags = Team.OptionStatus.FOR_OWN_TEAM; break;
                case FOR_OTHER_TEAMS: nameTags = Team.OptionStatus.NEVER; break;
            }
        }

        team.setOption(Team.Option.NAME_TAG_VISIBILITY, nameTags);
    } else {
        team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:29,代码来源:ScoreboardMatchModule.java

示例6: applyTeam

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
void applyTeam(String code, String left, String right) {
	Team team = scoreboard.getTeam(code);
	if (team == null) {
		team = scoreboard.registerNewTeam(code);
	}
	if (!team.hasEntry(code)) {
		team.addEntry(code);
	}
	team.setPrefix(left);
	team.setSuffix(right);
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:12,代码来源:PlayerScoreboard.java

示例7: loadTeam

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void loadTeam(ConfigurationSection config, Team team) {
	team.setDisplayName(config.getString("display_name", ""));
	team.setPrefix(config.getString("prefix", ""));
	team.setSuffix(config.getString("suffix", ""));
	team.setOption(Option.COLLISION_RULE, toOptionStatus(config.getString("collisions", "")));
	team.setOption(Option.DEATH_MESSAGE_VISIBILITY, toOptionStatus(config.getString("death_messages", "")));
	team.setOption(Option.NAME_TAG_VISIBILITY, toOptionStatus(config.getString("name_tags", "")));
	team.setAllowFriendlyFire(config.getBoolean("friendly_fire"));
	team.setColor(toChatColor(config.getString("color", "")));

	List<String> members = config.getStringList("members");
	if (members != null) {
		members.forEach(team::addEntry);
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:16,代码来源:ScoreboardPersister.java

示例8: createScore

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public static void createScore(String ID, String board, String value, int slot) {
	if (styleBoards.containsKey(board)) {
		String prefix = null, name = null, suffix = null;
		if (value.length() > 48) {
			value = value.substring(0, 47);
		}
		if (value.length() <= 16) {
			name = value;
		} else if (value.length() <= 32) {
			name = value.substring(0, 16);
			suffix = value.substring(16, value.length());
		} else {
			prefix = value.substring(0, 16);
			name = value.substring(16, 32);
			suffix = value.substring(32, value.length());
		}
		if (memoryData.containsKey(ID)) {
			deleteScore(ID, board);
		}
		Team team = styleBoards.get(board).getEntryTeam(name);
		if (team == null) {
			team = styleBoards.get(board).registerNewTeam(name);
		}
		team.addEntry(name);
		if ((prefix != null) || (suffix != null)) {
			if (prefix != null) {
				team.setPrefix(prefix);
			}
			team.setSuffix(suffix);
		}
		Score score = styleBoards.get(board).getObjective("StylishBoards").getScore(name);
		score.setScore(slot);
		memoryData.put(ID, new StyleBoard(score, styleBoards.get(board), slot, team));
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:36,代码来源:StyleManager.java

示例9: setNametagSuffix

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public static void setNametagSuffix(String nametag, String tag) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	Team team = board.getTeam(nametag);
	if (team == null) {
		Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cNo nametag under the name " + nametag + " &cwas found!"));
		return;
	}
	String s = Skellett.cc(tag);
	if(s.length() > 16) {
           s = s.substring(0, 16);
       }
	team.setSuffix(tag);
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:14,代码来源:NametagManager.java

示例10: resetNametag

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public static void resetNametag(String nametag) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	Team team = board.getTeam(nametag);
	if (team != null) {
		team.setPrefix("");
		team.setSuffix("");
	} else {
		Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cNo nametag under the name " + nametag + " &cwas found!"));
		return;
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:12,代码来源:NametagManager.java

示例11: resetNametagSuffix

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public static void resetNametagSuffix(String nametag) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	Team team = board.getTeam(nametag);
	if (team != null) {
		team.setSuffix("");
	} else {
		Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cNo nametag under the name " + nametag + " &cwas found!"));
		return;
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:11,代码来源:NametagManager.java

示例12: flip

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void flip() {
    if (!requiresUpdate) {
        return;
    }
    requiresUpdate = false;

    Objective buffer = scoreboard.registerNewObjective(getNextObjectiveName(), "dummy");
    buffer.setDisplayName(title);

    List<Team> bufferTeams = new ArrayList<>();

    for (Map.Entry<Integer, String> entry : contents.entrySet()) {
        if (entry.getValue().length() > 16) {
            Team team = scoreboard.registerNewTeam(getNextTeamName());
            bufferTeams.add(team);

            Iterator<String> split = Splitter.fixedLength(16).split(entry.getValue()).iterator();

            team.setPrefix(split.next());
            String name = split.next();
            if (split.hasNext()) { // We only guarantee two splits
                team.setSuffix(split.next());
            }

            team.addEntry(name);
            buffer.getScore(name).setScore(entry.getKey());

        } else {
            buffer.getScore(entry.getValue()).setScore(entry.getKey());
        }
    }

    if (displaySlot != null) {
        buffer.setDisplaySlot(displaySlot);
    }

    // Unregister _ALL_ the old things
    current.unregister();

    Iterator<Team> it = currentTeams.iterator();
    while (it.hasNext()) {
        it.next().unregister();
        it.remove();
    }

    current = buffer;
    currentTeams = bufferTeams;
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:49,代码来源:BufferedObjective.java

示例13: getFakePlayer

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private FakeEntry getFakePlayer(String text, int offset) {
    Team team = null;
    String name;
    // If the text has a length less than 16, teams need not to be be created
    if (text.length() <= 16) {
        name = text + Util.repeat(" ", offset);
    } else {
        String prefix;
        String suffix = "";
        offset++;
        // Otherwise, iterate through the string and cut off prefix and suffix
        prefix = text.substring(0, 16 - offset);
        name = text.substring(16 - offset);
        if (name.length() > 16) name = name.substring(0, 16);
        if (text.length() > 32) suffix = text.substring(32 - offset);

        // If teams already exist, use them
        for (Team other : scoreboard.getTeams()) {
            if (other.getPrefix().equals(prefix) && other.getSuffix().equals(suffix)) {
                team = other;
            }
        }

        // Otherwise create them
        if (team == null) {
            team = scoreboard.registerNewTeam(TEAM_PREFIX + teamCounter++);
            team.setPrefix(prefix);
            team.setSuffix(suffix);
            teamCache.put(team, prefix, suffix);
        }
    }
    FakeEntry faker;

    if (!playerCache.contains(name, offset)) {
        faker = new FakeEntry(name, team, offset);
        playerCache.put(name, offset, faker);
        if (faker.getTeam() != null)
            faker.getTeam().addEntry(faker.name);
    } else {
        faker = playerCache.get(name, offset);
        if (team != null && faker.getTeam() != null)
            if (scoreboard.getTeams().contains(faker.getTeam()))
                faker.getTeam().removeEntry(faker.name);
        faker.setTeam(team);
        if (faker.getTeam() != null) {
            faker.getTeam().addEntry(faker.name);
        }
    }
    return faker;
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:52,代码来源:SimpleScoreboard.java

示例14: getTeam

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private Team getTeam(int id, ScoreboardIndexableObject object)
{
    Team team;
    if (scoreboard.getScoreboard().getTeam(String.valueOf(id)) == null)
    {
        team = scoreboard.getScoreboard().registerNewTeam(String.valueOf(id));
    }
    else
    {
        team = scoreboard.getScoreboard().getTeam(String.valueOf(id));
    }

    String value = object.getValue();

    if (object.getWatcher() != null)
    {
        value = value.replaceAll("%v%", object.getWatcher().get(scoreboard).toString());
    }

    String prefix = "", entry = "", suffix = "";

    if (value.length() >= 31)
    {
        value = value.substring(0, 30);
    }

    ChatColor color = nextColor();

    if (value.length() <= 16)
    {
        prefix = value;
        suffix = "";
        entry = color.toString();
    }
    else
    {
        if (value.charAt(15) == '&' || value.charAt(15) == '§')
        {
            prefix = value.substring(0, 15);
            suffix = value.substring(15, value.length() >= 29 ? 29 : value.length());
        }
        else
        {
            prefix = value.substring(0, 16);
            suffix = value.substring(16, value.length());
        }

        entry = color.toString();
    }

    while (suffix.length() != (16 - ChatColor.getLastColors(prefix).length()))
    {
        suffix += " ";
    }

    team.setPrefix(prefix);
    team.setDisplayName(entry);
    team.setSuffix(ChatColor.getLastColors(prefix) + suffix);

    return team;
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:62,代码来源:UserScoreboardRunnable.java

示例15: tag_refresh

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void tag_refresh(Party party) {
	if (party != null) {
		// ProtocolLib
		if (Variables.tablist_enable && ProtocolHandler.isActive()) {
			ProtocolHandler.handleHF();
			for (Player pl : party.getOnlinePlayers())
				ProtocolHandler.send(pl.getUniqueId());
		}
		// Scoreboard
		Team t = scoreboard.getTeam(plugin.getScoreboardPrefix() + party.getName().toLowerCase());
		if (t != null)
			t.unregister();
		if (Variables.tag_enable || Variables.invisibleallies) {
			if (party.getOnlinePlayers().size() > 0) {
				String str = plugin.getScoreboardPrefix()+party.getName().toLowerCase();
				if (str.length() > 10)
					str = str.substring(0, 10);
				Team team = scoreboard.getTeam(str);
				if (team == null) {
					team = scoreboard.registerNewTeam(str);
					if (Variables.tag_enable && Variables.tag_system) {
						team.setPrefix(ChatColor.translateAlternateColorCodes('&', Variables.tag_base_formatprefix).replace("%party%", party.getName()));
						team.setSuffix(ChatColor.translateAlternateColorCodes('&', Variables.tag_base_formatsuffix).replace("%party%", party.getName()));
					} else if (Variables.tag_enable && !Variables.tag_system) {
						if (Variables.tag_custom_prefix)
							if (!party.getPrefix().isEmpty())
								team.setPrefix(ChatColor.translateAlternateColorCodes('&', Variables.tag_custom_formatprefix).replace("%prefix%", party.getPrefix()));
							else
								team.setPrefix("");
						if (Variables.tag_custom_suffix)
							if (!party.getSuffix().isEmpty())
								team.setSuffix(ChatColor.translateAlternateColorCodes('&', Variables.tag_custom_formatsuffix).replace("%suffix%", party.getSuffix()));
							else
								team.setSuffix("");
					} else {
						team.setPrefix("");
						team.setSuffix("");
					}
					if (Variables.invisibleallies)
						team.setCanSeeFriendlyInvisibles(true);
					else
						team.setCanSeeFriendlyInvisibles(false);
				}
				for (Player player : party.getOnlinePlayers()) {
					team.addEntry(player.getName());
				}
			}
		}
	}
}
 
开发者ID:AlessioDP,项目名称:Parties,代码行数:51,代码来源:PartyHandler.java


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