本文整理汇总了Java中org.bukkit.entity.Player.setScoreboard方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setScoreboard方法的具体用法?Java Player.setScoreboard怎么用?Java Player.setScoreboard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.setScoreboard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
});
}
示例2: addPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void addPlayer(Player p) {
if (isFull()) {
p.sendMessage(ChatColor.RED + "You can't join the party because it's full!");
sendMessage(p.getName() + " tried to join the party, but the party is full.");
return;
}
lastPlayerUpdate = 0;
p.setScoreboard(board);
uuids.add(p.getUniqueId());
PlayerDataRPG pd = PartyManager.plugin.getPD(p);
if (pd != null) {
pd.party = this;
}
sendMessage(p.getName() + " has joined " + this.leaderName + "'s party!");
if (this.lootshare) {
sendMessage(ChatColor.RED + ChatColor.BOLD.toString() + "Warning: " + ChatColor.GREEN + ChatColor.BOLD + "Lootshare is ACTIVE.");
sendMessage(ChatColor.GRAY + "- Others in your party can pick up your loot without delay.");
} else {
sendMessage(ChatColor.GRAY + "Lootshare is OFF.");
}
}
示例3: PlayerBoard
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public PlayerBoard(Player player) {
this.player = player;
this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
this.bufferedObjective = new BufferedObjective(scoreboard);
this.members = scoreboard.registerNewTeam("members");
this.members.setPrefix(ChatColor.GREEN.toString());
this.members.setCanSeeFriendlyInvisibles(true);
this.enemies = scoreboard.registerNewTeam("enemies");
this.enemies.setPrefix(ChatColor.RED.toString());
this.neutrals = scoreboard.registerNewTeam("neutrals");
this.neutrals.setPrefix(ChatColor.WHITE.toString());
player.setScoreboard(scoreboard);
}
示例4: disableScoreboard
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void disableScoreboard() {
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
board.registerNewObjective("Spigotboard", "dummy");
for(Player p : Bukkit.getOnlinePlayers()) {
p.setScoreboard(board);
}
}
示例5: ScoreHelper
import org.bukkit.entity.Player; //导入方法依赖的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);
}
示例6: join
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public TeamColor join(Player p, String team) {
if (team.equals("spec")) {
// something special?
}
if (team.equals("red"))
red.addPlayer(p);
else if (team.equals("blue"))
blue.addPlayer(p);
Gamer g = Gamer.get(p);
g.setVariable("arena", this);
g.setVariable("team", team);
p.setFlySpeed(0.1F);
p.setAllowFlight(true);
p.setFlying(true);
p.setScoreboard(scoreboard);
p.teleport(getSpawn());
return TeamColor.valueOf(team.toUpperCase());
}
示例7: 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);
}
示例8: removePlayerItems
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void removePlayerItems(Player player) {
if (!SkyWarsReloaded.getPC().getPlayer(player.getUniqueId()).inGame()) {
player.getInventory().remove(SkyWarsReloaded.getCfg().getSpectateItem());
player.getInventory().remove(SkyWarsReloaded.getCfg().getJoinItem());
player.getInventory().remove(SkyWarsReloaded.getCfg().getLobbyMenuItem());
if (!SkyWarsReloaded.getPC().getPlayer(player.getUniqueId()).isSpectating()) {
player.setScoreboard(SkyWarsReloaded.get().getServer().getScoreboardManager().getNewScoreboard());
}
}
}
示例9: displayYourGameBoardWithoutScoreboardUtil
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void displayYourGameBoardWithoutScoreboardUtil(Player p)
{
Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
p.setScoreboard(scoreboard);
Objective randomObjective = scoreboard.registerNewObjective("example", "dummy");
randomObjective.setDisplayName("§c§lMy stats");
randomObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
randomObjective.getScore(" ").setScore(15);
randomObjective.getScore("Your kills: " + 30).setScore(14);
randomObjective.getScore("Your deaths: " + 20).setScore(13);
randomObjective.getScore("Your ration: " + (30d / 20d)).setScore(12);
randomObjective.getScore(" ").setScore(11);
}
示例10: join
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public TeamColor join(Player p, String team) {
Gamer g = Gamer.get(p);
if (team.equals("spec")) {
specPlayers.addPlayer(p);
p.setScoreboard(specScoreboard);
g.setInvisible(true);
}
else if (team.equals("red")) {
specPlayers.addPlayer(p);
red.addPlayer(p);
p.setScoreboard(scoreboard);
g.setNameTag(ChatColor.RED + p.getName());
}
else if (team.equals("blue")) {
specPlayers.addPlayer(p);
blue.addPlayer(p);
p.setScoreboard(scoreboard);
g.setNameTag(ChatColor.BLUE + p.getName());
}
g.setVariable("arena", this);
g.setVariable("team", team);
p.setFlySpeed(0.1F);
p.setAllowFlight(true);
p.setFlying(true);
p.teleport(getSpawn());
return TeamColor.valueOf(team.toUpperCase());
}
示例11: addPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Adds players to the scoreboard
*
* @param players players
*/
public void addPlayer(Player... players) {
for (final Player player : players) {
if (!player.getScoreboard().equals(this.scoreboard)) {
player.setScoreboard(this.scoreboard);
}
}
}
示例12: play
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void play(Integer timeleft, Integer redgoals, Integer bluegoals, Player... players) {
try {
if (!this.isEnabled()) {
this.remove();
return;
}
if (this.scoreboard == null || this.objective == null) {
this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
this.objective = this.scoreboard.registerNewObjective("bb_scoreboard", "dummy");
this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
this.objective.setDisplayName(this.title);
}
for (final Player player : players) {
if (!player.getScoreboard().equals(this.scoreboard)) {
player.setScoreboard(this.scoreboard);
}
}
if (timeleft != null && timeleft >= 0)
this.objective.getScore(this.timeLeft).setScore(timeleft);
if (redgoals != null)
this.objective.getScore(this.redTeam).setScore(redgoals);
if (bluegoals != null)
this.objective.getScore(this.blueTeam).setScore(bluegoals);
} catch (final Exception ex) {
Bukkit.getServer().getConsoleSender().sendMessage(BlockBallPlugin.PREFIX_CONSOLE + ChatColor.RED + "Scoreboard crashed. Check if the text is short enough for the scoreboard!");
Bukkit.getLogger().log(Level.WARNING, "Cannot set scoreboard.", ex);
this.scoreboard = null;
this.objective = null;
}
}
示例13: stopDisplay
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void stopDisplay(Player p)
{
p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
}
示例14: build
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void build(Player player) {
player.setScoreboard(scoreboard);
}
示例15: startBattles
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void startBattles() {
if(started) {
throw new IllegalStateException();
}
started = true;
world = plugin.getServer().getWorld(plugin.getConfig().getString("battles.world"));
// prepare everyone
plugin.getServer().getOnlinePlayers().forEach(c -> {
InventoryUtils.clearInventory(c.getInventory());
c.playSound(c.getLocation(), "psbg.battle-begin", 1f, 1f);
c.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,
20*2,
1,
true,
false), true);
Lang.sendMessage(c, "messages.start.begin");
});
// prepare scoreboard
scoreboardLabelRank = Lang.build("scoreboard.game.rank");
scoreboardLabelKills = Lang.build("scoreboard.game.kills");
Scoreboard sb = plugin.getServer().getScoreboardManager().getNewScoreboard();
{
Objective title_objective = sb.registerNewObjective(Lang.build("scoreboard.game.title"), "B");
title_objective.setDisplaySlot(DisplaySlot.SIDEBAR);
title_objective.setDisplayName("C");
Team team = sb.registerNewTeam("T");
team.addEntry(scoreboardLabelRank);
team.addEntry(scoreboardLabelKills);
title_objective.getScore("ENT-TEST").setScore(0);
title_objective.getScore("ENT-TEST-2").setScore(123456);
}
plugin.getServer().getPluginManager().registerEvents(this, plugin);
// spawn everyone
double spawnCenterX = plugin.getConfig().getDouble("battles.spawn.center-x");
double spawnCenterZ = plugin.getConfig().getDouble("battles.spawn.center-x");
double spawnRadius = plugin.getConfig().getDouble("battles.spawn.radius");
Random r = new Random();
for(Player p : plugin.getServer().getOnlinePlayers()) {
double x = spawnCenterX + (r.nextDouble() * spawnRadius * (r.nextBoolean() ? 1d : -1d));
double z = spawnCenterZ + (r.nextDouble() * spawnRadius * (r.nextBoolean() ? 1d : -1d));
double y = 192d + (r.nextDouble() * 32d);
Location location = new Location(world, x, y, z);
p.teleport(location);
p.setScoreboard(sb);
plugin.getServer().getScheduler().runTask(plugin, () ->
plugin.getServer().getPluginManager().callEvent(new PlayerInteractEvent(
p,
Action.RIGHT_CLICK_AIR,
ParachuteManager.getParachuteItem(plugin.getConfig().getString("battles.parachute-type")),
null,
null
))
);
}
// set world border
WorldBorder border = world.getWorldBorder();
border.setCenter(
plugin.getConfig().getInt("battle-world.center-x"),
plugin.getConfig().getInt("battle-world.center-z")
);
border.setDamageAmount(10000d);
border.setSize(plugin.getConfig().getDouble("battles.safe-zone.initial-size"));
border.setSize(100, 200);
taskTimer = new BattlesTimerTask(plugin, this);
taskShrinkBorder = new ShrinkBorderTask(plugin, this);
taskTimer.start();
taskShrinkBorder.start();
}