Add the jail name to the scoreboard's title.
This commit is contained in:
parent
fe7cb9f5a5
commit
126c1576c4
@ -163,7 +163,7 @@ public class JailMain extends JavaPlugin {
|
||||
for(Jail j : jm.getJails()) {
|
||||
for(Prisoner p : j.getAllPrisoners()) {
|
||||
if(getServer().getPlayerExact(p.getName()) != null) {
|
||||
this.sbm.addScoreBoard(getServer().getPlayerExact(p.getName()), p);
|
||||
this.sbm.addScoreBoard(getServer().getPlayerExact(p.getName()), j, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class PrisonerManager {
|
||||
|
||||
//Add the scoreboard to them if it is enabled
|
||||
if(pl.getConfig().getBoolean(Settings.SCOREBOARDENABLED.getPath())) {
|
||||
pl.getScoreBoardManager().addScoreBoard(player, prisoner);
|
||||
pl.getScoreBoardManager().addScoreBoard(player, jail, prisoner);
|
||||
}
|
||||
|
||||
//Call our custom event for when a prisoner is actually jailed.
|
||||
|
@ -2,6 +2,7 @@ package com.graywolf336.jail;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
@ -41,12 +42,12 @@ public class ScoreBoardManager {
|
||||
* @param player of whom to add the scoreboard to.
|
||||
* @param pris data for the provided prisoner
|
||||
*/
|
||||
public void addScoreBoard(Player player, Prisoner pris) {
|
||||
public void addScoreBoard(Player player, Jail j, Prisoner pris) {
|
||||
if(!boards.containsKey(player.getName())) {
|
||||
boards.put(player.getName(), man.getNewScoreboard());
|
||||
Objective o = boards.get(player.getName()).registerNewObjective("test", "dummy");
|
||||
o.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
o.setDisplayName(Util.getColorfulMessage(pl.getConfig().getString(Settings.SCOREBOARDTITLE.getPath())));
|
||||
o.setDisplayName(Util.getColorfulMessage(pl.getConfig().getString(Settings.SCOREBOARDTITLE.getPath()) + ChatColor.WHITE + "" + ChatColor.ITALIC + " (" + j.getName() + ")"));
|
||||
o.getScore(time).setScore(pris.getRemainingTimeInMinutesInt());
|
||||
player.setScoreboard(boards.get(player.getName()));
|
||||
}else {
|
||||
@ -85,7 +86,7 @@ public class ScoreBoardManager {
|
||||
for(Jail j : pl.getJailManager().getJails()) {
|
||||
for(Prisoner p : j.getAllPrisoners()) {
|
||||
if(pl.getServer().getPlayerExact(p.getName()) != null) {
|
||||
addScoreBoard(pl.getServer().getPlayerExact(p.getName()), p);
|
||||
addScoreBoard(pl.getServer().getPlayerExact(p.getName()), j, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
//Add the scoreboard to them if it is enabled
|
||||
if(pl.getConfig().getBoolean(Settings.SCOREBOARDENABLED.getPath())) {
|
||||
pl.getScoreBoardManager().addScoreBoard(event.getPlayer(), p);
|
||||
pl.getScoreBoardManager().addScoreBoard(event.getPlayer(), j, p);
|
||||
}
|
||||
|
||||
//if we are ignoring a prisoner's sleeping state, then let's set that
|
||||
|
Loading…
Reference in New Issue
Block a user