本文整理汇总了Java中org.bukkit.scoreboard.Scoreboard.getTeam方法的典型用法代码示例。如果您正苦于以下问题:Java Scoreboard.getTeam方法的具体用法?Java Scoreboard.getTeam怎么用?Java Scoreboard.getTeam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.scoreboard.Scoreboard
的用法示例。
在下文中一共展示了Scoreboard.getTeam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removePlayer
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
public GameTeam removePlayer(Player p, boolean updateTab) {
TeamLeaveEvent event = new TeamLeaveEvent(p, this);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) return this;
if (members.contains(p.getName())) {
if (updateTab) {
if (p.getScoreboard() != null) {
Scoreboard s = p.getScoreboard();
if (s.getTeam(this.getTeamName()) != null) {
Team team = s.getTeam(this.getRawTeamName());
team.removeEntry(p.getName());
}
}
}
members.remove(p.getName());
}
return this;
}
示例2: setOverheadNamePrefix
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
* Sets a prefix for a player's overhead name by adding them to a scoreboard team.
* Don't use this if scoreboard teams are being used for any other purpose.
*/
private static void setOverheadNamePrefix(Player player, String prefix) {
final Scoreboard scoreboard = player.getServer().getScoreboardManager().getMainScoreboard();
prefix = prefix.substring(0, Math.min(prefix.length(), 14));
Team team = scoreboard.getTeam(prefix);
if(team == null) {
team = scoreboard.registerNewTeam(prefix);
team.setPrefix(prefix);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
}
team.addPlayer(player);
}
示例3: onPlayerChangedTeam
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
/**
* When a player changes team, make sure the scoreboard reflects it
*/
@EventHandler
public void onPlayerChangedTeam(PlayerChangedTeamEvent event) {
Scoreboard board = boards.get(event.getTeam().getMatch());
org.bukkit.scoreboard.Team sbTeam = board.getTeam(event.getTeam().getId());
sbTeam.addPlayer(event.getPlayer());
}
示例4: addToTeam
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
private void addToTeam(Player p) {
Scoreboard s = p.getScoreboard() != null ? p.getScoreboard() : Bukkit.getScoreboardManager().getMainScoreboard();
Team t = s.getTeam("AeroCollide");
if(t == null) {
s.registerNewTeam("AeroCollide");
t = s.getTeam("AeroCollide");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard teams options AeroCollide collisionRule never");
}
t.addEntry(p.getName());
p.setScoreboard(s);
}
示例5: getScoreboardTeam
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
protected Team getScoreboardTeam() {
String name = getBukkitEntity().getUniqueId().toString().replace("-", "").substring(0, 16);
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = scoreboard.getTeam(name);
if (team == null) {
team = scoreboard.registerNewTeam(name);
}
return team;
}
示例6: get
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
@Override
@Nullable
protected Team[] get(Event e) {
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
if (scoreboard != null) {
board = scoreboard.getSingle(e);
}
if (board.getTeam(team.getSingle(e)) != null) {
return new Team[]{board.getTeam(team.getSingle(e))};
}
return null;
}
示例7: execute
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
@Override
protected void execute(Event e) {
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
if (scoreboard != null) {
board = scoreboard.getSingle(e);
}
if (board.getTeam(team.getSingle(e)) != null) {
return;
}
board.registerNewTeam(team.getSingle(e));
}
示例8: createNametag
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
public static void createNametag(String nametag, Scoreboard scoreboard) {
if(nametag.length() > 16) {
Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cA nametag ID name can't have more than 16 characters!"));
return;
}
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
if (scoreboard != null) {
board = scoreboard;
}
Team team = board.getTeam(nametag);
if (team == null) {
team = board.registerNewTeam(nametag);
}
}
示例9: addPlayer
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
public static void addPlayer(Player player, String nametag, Scoreboard scoreboard) {
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
if (scoreboard != null) {
board = scoreboard;
}
Team team = board.getTeam(nametag);
if (team == null) {
Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cNo nametag under the name " + nametag + " &cwas found!"));
return;
}
team.addEntry(player.getName());
player.setScoreboard(board);
}
示例10: removePlayerNametag
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void removePlayerNametag(Player player, String nametag) {
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;
}
team.removePlayer((OfflinePlayer)player);
}
示例11: setNametagPrefix
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
public static void setNametagPrefix(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.setPrefix(tag);
}
示例12: setNametagSuffix
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的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);
}
示例13: resetNametag
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的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;
}
}
示例14: resetNametagPrefix
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
public static void resetNametagPrefix(String nametag) {
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = board.getTeam(nametag);
if (team != null) {
team.setPrefix("");
} else {
Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cNo nametag under the name " + nametag + " &cwas found!"));
return;
}
}
示例15: resetNametagSuffix
import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的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;
}
}