mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
parent
385fe1bb05
commit
38bd37e4fa
@ -370,25 +370,34 @@ public class ScoreboardManager {
|
||||
*/
|
||||
public static Objective getPowerLevelObjective() {
|
||||
if (!Config.getInstance().getPowerLevelTagsEnabled()) {
|
||||
try {
|
||||
Objective objective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
|
||||
|
||||
if (objective != null) {
|
||||
objective.unregister();
|
||||
mcMMO.p.debug("Removed leftover scoreboard objects from Power Level Tags.");
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
//It's already null
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
Objective powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
|
||||
|
||||
if (powerObjective == null) {
|
||||
powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
|
||||
powerObjective.setDisplayName(TAG_POWER_LEVEL);
|
||||
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
return powerObjective;
|
||||
} catch (NullPointerException e) {
|
||||
Objective powerObjective;
|
||||
powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
|
||||
powerObjective.setDisplayName(TAG_POWER_LEVEL);
|
||||
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
return powerObjective;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) {
|
||||
|
Loading…
Reference in New Issue
Block a user