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


Java DisplaySlot類代碼示例

本文整理匯總了Java中org.bukkit.scoreboard.DisplaySlot的典型用法代碼示例。如果您正苦於以下問題:Java DisplaySlot類的具體用法?Java DisplaySlot怎麽用?Java DisplaySlot使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: enableScoreboard

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
@Override
public void enableScoreboard() {
       final Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
       final Objective obj = board.registerNewObjective("Spigotboard", "dummy");
       
       obj.setDisplaySlot(DisplaySlot.SIDEBAR);
       obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', Main.instance.getConfig().getString("title")));

       new BukkitRunnable() {
           @Override
           public void run() {
               for(Player p : Bukkit.getOnlinePlayers()) {
               	int count = Main.instance.getConfig().getList("text").size();
               	
               	PlaceholderUtils placeholders = new PlaceholderUtils(p);
                   for(Object text : Main.instance.getConfig().getList("text")){
                   	obj.getScore(ChatColor.translateAlternateColorCodes('&', placeholders.replace(text.toString()))).setScore(count);
                   	count--;
                   }
                   p.setScoreboard(board);
               }
           }
       }.runTaskTimer(Main.instance, 0, 20);
}
 
開發者ID:TheIndra55,項目名稱:SpigotBoard,代碼行數:25,代碼來源:SBScoreboard.java

示例2: createscrollsb

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
public static void createscrollsb(Player p, String title) {
	Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
	playerScoreboard = scoreboard.registerNewObjective("sklib", "dummy"); //The name of the scoreboard is the name of the player, not that it really needs to be
	playerScoreboard.setDisplayName("Placeholder"); //Will not show to the user, we just need to set this to make bukkit happy
	playerScoreboard.setDisplaySlot(DisplaySlot.SIDEBAR);
	p.setScoreboard(scoreboard);
	new BukkitRunnable()
   	{
   		Scroller scroller = new Scroller(p, title, 16, 4, '&');
   	
   		public void run()
   		{
   			playerScoreboard.setDisplayName(scroller.next(p));
   		}
   		
   	}.runTaskTimer(Main.getInstance(), 0L, 3L); // runs every 3 ticks
	
}
 
開發者ID:WheezyGold7931,項目名稱:skLib,代碼行數:19,代碼來源:SbManager.java

示例3: refreshScoreboard

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
private void refreshScoreboard(Player player)
{
    if (getThirstString(player).length() > 40)
    {
        Thirst.getInstance().printPluginError("Error occurred while displaying scoreboard.", "The string "+getThirstString(player)+" is longer than 40 characters." +
                                                                                                     "\nYou must have a thirst message under 40 characters to use the SCOREBOARD displaytype." +
                                                                                                     "\n " +
                                                                                                     "\nNOTE: This message will be displayed every time Thirst tries to update someones thirst (A lot!)");
        return;
    }

    Scoreboard board = manager.getNewScoreboard();
    Objective obj = board.registerNewObjective(player.getName().toUpperCase(), "dummy");

    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', Thirst.getInstance().getYAMLConfig().scoreboardName.replace("%player%", player.getName())));
    obj.getScore(getThirstString(player)).setScore(-1);

    player.setScoreboard(board);
}
 
開發者ID:GamerKing195,項目名稱:Thirst,代碼行數:21,代碼來源:ThirstManager.java

示例4: createPlayerHealthObjective

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
/**
 * Show the player's health under their nameplate
 */
private void createPlayerHealthObjective(Match match) {

    Scoreboard board = boards.get(match);
    Objective objective = board.registerNewObjective("playerhealth", "health");
    objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
    objective.setDisplayName(ChatColor.RED + "❤");

    //Force health objective to update health readout
    for (Team team : match.getTeams().values()) {
        for (Player player : team.getPlayers()) {
            player.setHealth(player.getHealth());
        }
    }

}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:19,代碼來源:ScoreboardModule.java

示例5: createSidebarTeamScoreObjective

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
/**
 * Set up the sidebar score box
 */
private void createSidebarTeamScoreObjective(Match match) {

    Scoreboard board = boards.get(match);
    Objective objective = board.registerNewObjective("matchscore", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(String.format("Match %s(00:00)", ChatColor.AQUA));

    // Create score lines for each team
    for (Team team : match.getTeams().values()) {
        if (!team.isSpectator()) {
            Score score = objective.getScore(team.getChatColor() + team.getName());
            score.setScore(0);
        }
    }

}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:20,代碼來源:ScoreboardModule.java

示例6: execute

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
@Override
protected void execute(Event e) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	if (scoreboard != null) {
		board = scoreboard.getSingle(e);
	}
	if (obj.getSingle(e).equals("BELOW_NAME")||obj.getSingle(e).equals("PLAYER_LIST")||obj.getSingle(e).equals("SIDEBAR")) {
		DisplaySlot slot = DisplaySlot.valueOf(obj.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
		try {
			slot = DisplaySlot.valueOf(slot.toString().replace("\"", "").trim().replace(" ", "_").toUpperCase());
		} catch (IllegalArgumentException t) {
			return;
		}
		board.clearSlot(slot);
	} else {
		return;
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:19,代碼來源:EffScoreboardClearSlot.java

示例7: get

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
@Override
@Nullable
protected Objective[] get(Event e) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	if (scoreboard != null) {
		board = scoreboard.getSingle(e);
	}
	if (obj.getSingle(e).equals("BELOW_NAME")||obj.getSingle(e).equals("PLAYER_LIST")||obj.getSingle(e).equals("SIDEBAR")) {
		DisplaySlot slot = DisplaySlot.valueOf(obj.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
		try {
			slot = DisplaySlot.valueOf(slot.toString().replace("\"", "").trim().replace(" ", "_").toUpperCase());
		} catch (IllegalArgumentException t) {
			return null;
		}
		return new Objective[]{board.getObjective(slot)};
	} else {
		return new Objective[]{board.getObjective(obj.getSingle(e))};
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:20,代碼來源:ExprGetObjective.java

示例8: Sidebar

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
private Sidebar(Party party) {
    this.scoreboard = getMatch().needMatchModule(ScoreboardMatchModule.class).getScoreboard(party);
    this.objective = this.scoreboard.registerNewObjective(IDENTIFIER, "dummy");
    this.objective.setDisplayName(legacyTitle);
    this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);

    for(int i = 0; i < MAX_ROWS; ++i) {
        this.rows[i] = null;
        this.scores[i] = -1;

        this.players[i] = String.valueOf(ChatColor.COLOR_CHAR) + (char) i;

        this.teams[i] = this.scoreboard.registerNewTeam(IDENTIFIER + "-row-" + i);
        this.teams[i].setPrefix("");
        this.teams[i].setSuffix("");
        this.teams[i].addEntry(this.players[i]);
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:19,代碼來源:SidebarMatchModule.java

示例9: ScoreHelper

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
private ScoreHelper(Player player, boolean healthName, boolean healthTab) {
	this.player = player;
	scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
	sidebar = scoreboard.registerNewObjective("sidebar", "dummy");
	sidebar.setDisplaySlot(DisplaySlot.SIDEBAR);
	player.setScoreboard(scoreboard);
	// Create Teams
	for(int i=1; i<=15; i++) {
		Team team = scoreboard.registerNewTeam("SLOT_" + i);
		team.addEntry(genEntry(i));
	}

	if(healthName) {
		Objective hName = scoreboard.registerNewObjective("hname", "health");
		hName.setDisplaySlot(DisplaySlot.BELOW_NAME);
		hName.setDisplayName(ChatColor.RED + "❤");
	}

	if(healthTab) {
		Objective hTab = scoreboard.registerNewObjective("htab", "health");
		hTab.setDisplaySlot(DisplaySlot.PLAYER_LIST);
	}

	players.put(player.getUniqueId(), this);
}
 
開發者ID:crisdev333,項目名稱:ProScoreboard,代碼行數:26,代碼來源:ScoreHelper.java

示例10: SimpleScoreboard

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
public SimpleScoreboard(String id, Player holder) {
    this.holder = holder;
    // Initiate the Bukkit scoreboard
    scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
    scoreboard.registerNewObjective(id, "dummy").setDisplaySlot(DisplaySlot.SIDEBAR);
    objective = scoreboard.getObjective(DisplaySlot.SIDEBAR);
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:8,代碼來源:SimpleScoreboard.java

示例11: activate

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
@Override
public org.bukkit.scoreboard.Scoreboard activate() {
    if (activated) return scoreboard;
    if (handler == null) throw new IllegalArgumentException("Scoreboard handler not set");
    activated = true;
    // Set to the custom scoreboard
    holder.setScoreboard(scoreboard);
    objective = scoreboard.getObjective(DisplaySlot.SIDEBAR);
    // And start updating on a desired interval
    updateTask = new BukkitRunnable() {
        @Override
        public void run() {
            update();
        }
    };
    updateTask.runTaskTimer(AlphaLibary.getInstance(), 0, updateInterval);
    return scoreboard;
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:19,代碼來源:SimpleScoreboard.java

示例12: registerTeams

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
private void registerTeams() {
	this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
	red = scoreboard.registerNewTeam("red");
	blue = scoreboard.registerNewTeam("blue");

	// Apparently, opacity doesn't work with friendly fire >:(
	red.setDisplayName("Red");
	//red.setAllowFriendlyFire(false);
	red.setCanSeeFriendlyInvisibles(true);
	red.setPrefix(ChatColor.RED + "");

	blue.setDisplayName("Blue");
	//blue.setAllowFriendlyFire(false);
	blue.setCanSeeFriendlyInvisibles(true);
	blue.setPrefix(ChatColor.BLUE + "");

	sidebar = scoreboard.registerNewObjective("test", "dummy");
	sidebar.setDisplaySlot(DisplaySlot.SIDEBAR);
	sidebar.setDisplayName("Teams (0 means dead)");
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:21,代碼來源:Arena.java

示例13: setDefaultSidebar

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的package包/類
public void setDefaultSidebar(final SidebarProvider provider, final long updateInterval) {
    if (provider != this.defaultProvider) {
        this.defaultProvider = provider;
        if (this.runnable != null) {
            this.runnable.cancel();
        }
        if (provider == null) {
            this.scoreboard.clearSlot(DisplaySlot.SIDEBAR);
            return;
        }
        (this.runnable = new BukkitRunnable() {
            public void run() {
                if (PlayerBoard.this.removed.get()) {
                    this.cancel();
                    return;
                }
                if (provider == PlayerBoard.this.defaultProvider) {
                    PlayerBoard.this.updateObjective();
                }
            }
        }).runTaskTimerAsynchronously((Plugin)this.plugin, updateInterval, updateInterval);
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:24,代碼來源:PlayerBoard.java

示例14: PlayerScoreboard

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的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

示例15: HUD

import org.bukkit.scoreboard.DisplaySlot; //導入依賴的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


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