當前位置: 首頁>>代碼示例>>Java>>正文


Java Scoreboard.getTeam方法代碼示例

本文整理匯總了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;
    }
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:27,代碼來源:GameTeam.java

示例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);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:17,代碼來源:PlayerAppearanceChanger.java

示例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());
}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:10,代碼來源:ScoreboardModule.java

示例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);
}
 
開發者ID:Tom7653,項目名稱:Aero,代碼行數:12,代碼來源:Colliding.java

示例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;
}
 
開發者ID:InventivetalentDev,項目名稱:CompactNPCLib,代碼行數:10,代碼來源:NPCPlayer.java

示例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;
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:13,代碼來源:ExprGetTeam.java

示例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));
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:12,代碼來源:EffRegisterTeam.java

示例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);
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:15,代碼來源:NametagManager.java

示例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);
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:14,代碼來源:NametagManager.java

示例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);
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:11,代碼來源:NametagManager.java

示例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);
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:14,代碼來源:NametagManager.java

示例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);
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:14,代碼來源:NametagManager.java

示例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;
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:12,代碼來源:NametagManager.java

示例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;
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:11,代碼來源:NametagManager.java

示例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;
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:11,代碼來源:NametagManager.java


注:本文中的org.bukkit.scoreboard.Scoreboard.getTeam方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。