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