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


Java Player.getScoreboard方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Player.getScoreboard方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.getScoreboard方法的具體用法?Java Player.getScoreboard怎麽用?Java Player.getScoreboard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.getScoreboard方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PlayerTab

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public PlayerTab(Player player) {
    this.player = player;

    entries = new ArrayList<>();

    clear();

    if (!player.getScoreboard().equals(Bukkit.getScoreboardManager().getMainScoreboard())) {
        scoreboard = player.getScoreboard();
        assemble();
    } else {
        new BukkitRunnable() {
            @Override
            public void run() {
                scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
                player.setScoreboard(scoreboard);
                assemble();
            }
        }.runTask(PracticePlugin.getInstance());
    }

    playerTabs.add(this);
}
 
開發者ID:ijoeleoli,項目名稱:ZorahPractice,代碼行數:24,代碼來源:PlayerTab.java

示例2: removePlayer

import org.bukkit.entity.Player; //導入方法依賴的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

示例3: PlayerScoreboard

import org.bukkit.entity.Player; //導入方法依賴的package包/類
PlayerScoreboard(Player player) {
	this.player = player;
	this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
	this.objective = scoreboard.getObjective("SidebarWrapper") == null ? scoreboard.registerNewObjective("SidebarWrapper", "dummy") : scoreboard.getObjective("SidebarWrapper");
	this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
	this.objective.setDisplayName("");
	if (player.getScoreboard() != scoreboard) {
		player.setScoreboard(scoreboard);
	}
	update();
	this.teams = new HashMap<>();
	this.red = scoreboard.registerNewTeam("Red");
	this.blue = scoreboard.registerNewTeam("Blue");
	this.green = scoreboard.registerNewTeam("Green");
	this.yellow = scoreboard.registerNewTeam("Yellow");
	Arrays.stream(TeamType.values()).filter(teamType -> teamType.isPlayerTeam()).forEach(teamType -> {
		Team team = scoreboard.getTeam(teamType.getName());
		team.setPrefix(teamType.getColor().toString());
		team.setAllowFriendlyFire(false);
		team.setCanSeeFriendlyInvisibles(true);
		this.teams.put(teamType, team);
	});
}
 
開發者ID:HuliPvP,項目名稱:Chambers,代碼行數:24,代碼來源:PlayerScoreboard.java

示例4: HUD

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public HUD(Player player, FlightHUDPlugin plugin, FHManager manager) {

        previousScoreboard = player.getScoreboard();
        this.scoreboard = plugin.getServer().getScoreboardManager().getNewScoreboard();
        this.player = player;
        this.manager = manager;

        Objective obj = scoreboard.registerNewObjective("hud", "dummy");
        obj.setDisplaySlot(DisplaySlot.SIDEBAR);
        obj.getScore(ChatColor.GREEN + "Airspeed b/s").setScore(0);
        obj.getScore(ChatColor.GREEN + "Ground speed").setScore(0);
        obj.getScore(ChatColor.GREEN + "Heading").setScore(0);
        obj.getScore(ChatColor.GREEN + "Sink rate b/s").setScore(0);

        player.setScoreboard(scoreboard);

        taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new HUDScheduler(this), 0, 2);
    }
 
開發者ID:Xorgon,項目名稱:FlightHUD,代碼行數:19,代碼來源:HUD.java

示例5: BPlayerBoard

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public BPlayerBoard(Player player, Scoreboard scoreboard, String name) {
    this.player = player;
    this.scoreboard = scoreboard;

    if(this.scoreboard == null) {
        Scoreboard sb = player.getScoreboard();

        if(sb == null || sb == Bukkit.getScoreboardManager().getMainScoreboard())
            sb = Bukkit.getScoreboardManager().getNewScoreboard();

        this.scoreboard = sb;
    }

    this.name = name;

    String subName = player.getName().length() <= 14
            ? player.getName()
            : player.getName().substring(0, 14);

    this.objective = this.scoreboard.getObjective("sb" + subName);
    this.buffer = this.scoreboard.getObjective("bf" + subName);

    if(this.objective == null)
        this.objective = this.scoreboard.registerNewObjective("sb" + subName, "dummy");
    if(this.buffer == null)
        this.buffer = this.scoreboard.registerNewObjective("bf" + subName, "dummy");

    this.objective.setDisplayName(name);
    sendObjective(this.objective, ObjectiveMode.CREATE);
    sendObjectiveDisplay(this.objective);

    this.buffer.setDisplayName(name);
    sendObjective(this.buffer, ObjectiveMode.CREATE);

    this.player.setScoreboard(this.scoreboard);
}
 
開發者ID:MinusKube,項目名稱:Netherboard,代碼行數:37,代碼來源:BPlayerBoard.java

示例6: storeTemporaryInventory

import org.bukkit.entity.Player; //導入方法依賴的package包/類
void storeTemporaryInventory(Player player) {
    final TemporaryPlayerStorage storage = new TemporaryPlayerStorage();
    storage.armorContent = player.getInventory().getArmorContents().clone();
    storage.isFlying = player.getAllowFlight();
    storage.inventory = player.getInventory().getContents().clone();
    storage.gameMode = player.getGameMode();
    storage.level = player.getLevel();
    storage.exp = player.getExp();
    storage.health = player.getHealth();
    storage.foodLevel = player.getFoodLevel();
    storage.scoreboard = player.getScoreboard();
    this.temporaryStorage.put(player, storage);
}
 
開發者ID:Shynixn,項目名稱:BlockBall,代碼行數:14,代碼來源:HelperGameEntity.java

示例7: storeTemporaryInventory

import org.bukkit.entity.Player; //導入方法依賴的package包/類
private void storeTemporaryInventory(Player player) {
    final TemporaryPlayerStorage storage = new TemporaryPlayerStorage();
    storage.armorContent = player.getInventory().getArmorContents().clone();
    storage.isFlying = player.getAllowFlight();
    storage.inventory = player.getInventory().getContents().clone();
    storage.gameMode = player.getGameMode();
    storage.level = player.getLevel();
    storage.exp = player.getExp();
    storage.scoreboard = player.getScoreboard();
    this.temporaryStorage.put(player, storage);
}
 
開發者ID:Shynixn,項目名稱:BlockBall,代碼行數:12,代碼來源:EventGameEntity.java

示例8: initScoreboard

import org.bukkit.entity.Player; //導入方法依賴的package包/類
private void initScoreboard(Player all)
{
    if (all.getScoreboard() == null) all.setScoreboard(all.getServer().getScoreboardManager().getNewScoreboard());
}
 
開發者ID:Dytanic,項目名稱:CloudNet,代碼行數:5,代碼來源:CloudServer.java

示例9: setscoresb

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void setscoresb(Player p, int slot, String value) {
	Scoreboard sb = p.getScoreboard();
	Objective ob = sb.getObjective(DisplaySlot.SIDEBAR);
	Score score = ob.getScore(value);
	score.setScore(slot);
}
 
開發者ID:WheezyGold7931,項目名稱:skLib,代碼行數:7,代碼來源:SbManager.java

示例10: remove

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@Override
public void remove(Player player) {
    if (this.scoreboard != null && player.getScoreboard() != null && player.getScoreboard().equals(this.scoreboard)) {
        player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
    }
}
 
開發者ID:Shynixn,項目名稱:BlockBall,代碼行數:7,代碼來源:FastScoreboard.java

示例11: unrankedSidebarDisplay

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static boolean unrankedSidebarDisplay(Player p, String[] elements)
{
	elements = cutUnranked(elements);

	try
	{
		if(p.getScoreboard() == null || p.getScoreboard() == Bukkit.getScoreboardManager().getMainScoreboard() || p.getScoreboard().getObjectives().size() != 1)
		{
			p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
		}

		if(p.getScoreboard().getObjective(p.getUniqueId().toString().substring(0, 16)) == null)
		{
			p.getScoreboard().registerNewObjective(p.getUniqueId().toString().substring(0, 16), "dummy");
			p.getScoreboard().getObjective(p.getUniqueId().toString().substring(0, 16)).setDisplaySlot(DisplaySlot.SIDEBAR);
		}



		p.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(elements[0]);

		for(int i = 1; i < elements.length; i++)
			if(elements[i] != null)
				if(p.getScoreboard().getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).getScore() != 16 - i)
				{
					p.getScoreboard().getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).setScore(16 - i);
					for(String string : p.getScoreboard().getEntries())
						if(p.getScoreboard().getObjective(p.getUniqueId().toString().substring(0, 16)).getScore(string).getScore() == 16 - i)
							if(!string.equals(elements[i]))
								p.getScoreboard().resetScores(string);

				}

		for(String entry : p.getScoreboard().getEntries())
		{
			boolean toErase = true;
			for(String element : elements)
			{
				if(element != null && element.equals(entry) && p.getScoreboard().getObjective(p.getUniqueId().toString().substring(0, 16)).getScore(entry).getScore() == 16 - Arrays.asList(elements).indexOf(element))
				{
					toErase = false;
					break;
				}
			}

			if(toErase)
				p.getScoreboard().resetScores(entry);

		}

		return true;
	}
	catch(Exception e)
	{
		e.printStackTrace();
		return false;
	}
}
 
開發者ID:kncxstudio,項目名稱:BasicSurvivalPlus,代碼行數:59,代碼來源:ScoreboardUtil.java


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