当前位置: 首页>>代码示例>>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;未经允许,请勿转载。