本文整理汇总了Java中org.bukkit.scoreboard.NameTagVisibility类的典型用法代码示例。如果您正苦于以下问题:Java NameTagVisibility类的具体用法?Java NameTagVisibility怎么用?Java NameTagVisibility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameTagVisibility类属于org.bukkit.scoreboard包,在下文中一共展示了NameTagVisibility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshScoreboard
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的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);
}
}
示例2: initScoreboard
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public static void initScoreboard() {
try {
Vars.scoreboard.registerNewTeam("Member").setPrefix(parseColors("&7"));
Vars.scoreboard.registerNewTeam("Iron").setPrefix(parseColors("&f"));
Vars.scoreboard.registerNewTeam("Gold").setPrefix(parseColors("&6"));
Vars.scoreboard.registerNewTeam("Emerald").setPrefix(parseColors("&a"));
Vars.scoreboard.registerNewTeam("Diamond").setPrefix(parseColors("&b"));
Vars.scoreboard.registerNewTeam("Admin").setPrefix(parseColors("&c"));
Vars.scoreboard.registerNewTeam("Owner").setPrefix(parseColors("&4"));
Team ghost = Vars.scoreboard.registerNewTeam("Ghost");
ghost.setNameTagVisibility(NameTagVisibility.NEVER);
ghost.setCanSeeFriendlyInvisibles(false);
} catch (Exception e) {
}
for (Team t : Vars.scoreboard.getTeams()) {
Vars.teams.add(t);
}
}
示例3: create
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public void create(){
ScoreboardManager manager = Bukkit.getScoreboardManager();
board = manager.getNewScoreboard();
teamRed = board.registerNewTeam("Red");
teamRed.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
teamRed.setAllowFriendlyFire(false);
teamGreen = board.registerNewTeam("Green");
teamGreen.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
teamGreen.setAllowFriendlyFire(false);
objective = board.registerNewObjective("time", "dummy");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName("Time");
Score scoreRed = objective.getScore(ChatColor.RED + "Red:");
scoreRed.setScore(Game.getGame().getCurrentArena().maxPoints);
Score scoreGreen = objective.getScore(ChatColor.GREEN + "Green:");
scoreGreen.setScore(Game.getGame().getCurrentArena().maxPoints);
teamRed.setPrefix(ChatColor.RED.toString());
teamGreen.setPrefix(ChatColor.GREEN.toString());
teamRed.setSuffix(ChatColor.WHITE.toString());
teamGreen.setSuffix(ChatColor.WHITE.toString());
}
示例4: getNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
@Override
public NameTagVisibility getNameTagVisibility() throws IllegalArgumentException {
OptionStatus visibility = getOption(Option.NAME_TAG_VISIBILITY);
switch (visibility) {
case ALWAYS:
return NameTagVisibility.ALWAYS;
case FOR_OTHER_TEAMS:
return NameTagVisibility.HIDE_FOR_OTHER_TEAMS;
case FOR_OWN_TEAM:
return NameTagVisibility.HIDE_FOR_OWN_TEAM;
case NEVER:
return NameTagVisibility.NEVER;
default:
throw new RuntimeException("Unknown visibility: " + visibility);
}
}
示例5: setNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
@Override
public void setNameTagVisibility(NameTagVisibility visibility) throws IllegalArgumentException {
Validate.notNull(visibility, "visibility");
checkScoreboard();
switch (visibility) {
case ALWAYS:
this.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.ALWAYS);
break;
case HIDE_FOR_OTHER_TEAMS:
this.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OTHER_TEAMS);
break;
case HIDE_FOR_OWN_TEAM:
this.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OWN_TEAM);
break;
case NEVER:
this.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
break;
default:
throw new RuntimeException("Unknown name tag visibility: " + visibility);
}
}
示例6: bukkitToNotch
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public static EnumNameTagVisibility bukkitToNotch(NameTagVisibility visibility) {
switch (visibility) {
case ALWAYS:
return EnumNameTagVisibility.ALWAYS;
case NEVER:
return EnumNameTagVisibility.NEVER;
case HIDE_FOR_OTHER_TEAMS:
return EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS;
case HIDE_FOR_OWN_TEAM:
return EnumNameTagVisibility.HIDE_FOR_OWN_TEAM;
default:
throw new IllegalArgumentException("Unknown visibility level " + visibility);
}
}
示例7: notchToBukkit
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public static NameTagVisibility notchToBukkit(EnumNameTagVisibility visibility) {
switch (visibility) {
case ALWAYS:
return NameTagVisibility.ALWAYS;
case NEVER:
return NameTagVisibility.NEVER;
case HIDE_FOR_OTHER_TEAMS:
return NameTagVisibility.HIDE_FOR_OTHER_TEAMS;
case HIDE_FOR_OWN_TEAM:
return NameTagVisibility.HIDE_FOR_OWN_TEAM;
default:
throw new IllegalArgumentException("Unknown visibility level " + visibility);
}
}
示例8: setTeamNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
/**
* Set the team name tag visibility of a team by team name.
*
* @param team The reference name of the team.
* @param vis The NameTagVisibility object to be set.
*/
public void setTeamNameTagVisibility(String team, NameTagVisibility vis) {
if (teamMap.containsKey(team)) {
teamMap.get(team).setNameTagVisibility(vis);
for (Object p : Bukkit.getServer().getOnlinePlayers().toArray()) {
// Debug
Bukkit.broadcastMessage("Friendly Invisibles set!");
((Player) p).getScoreboard().getTeam(team).setNameTagVisibility(vis);
}
}
}
示例9: getNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
@Override
public NameTagVisibility getNameTagVisibility() throws IllegalArgumentException {
return null;
}
示例10: getNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public NameTagVisibility getNameTagVisibility() throws IllegalArgumentException {
throw new NotImplementedException("getNameTagVisibility()");
}
示例11: setNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public void setNameTagVisibility(NameTagVisibility nameTagVisibility) throws IllegalArgumentException {
throw new NotImplementedException("setNameTagVisibility(NameTagVisibility)");
}
示例12: getNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public NameTagVisibility getNameTagVisibility() throws IllegalArgumentException {
CraftScoreboard scoreboard = checkState();
return notchToBukkit(team.getNameTagVisibility());
}
示例13: setNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public void setNameTagVisibility(NameTagVisibility visibility) throws IllegalArgumentException {
CraftScoreboard scoreboard = checkState();
team.setNameTagVisibility(bukkitToNotch(visibility));
}
示例14: of
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
public static Visibility of(NameTagVisibility slot) {
return CONVERTER.convert(slot);
}
示例15: getNameTagVisibility
import org.bukkit.scoreboard.NameTagVisibility; //导入依赖的package包/类
@Override
public NameTagVisibility getNameTagVisibility() throws IllegalArgumentException {
checkState(); // this is technically against documentation but the documentation is stupid for this method
return NameTagVisibilityConverter.of(getHandle().getNameTagVisibility());
}