Set player scoreboards to main server scoreboard upon entering a blacklisted world

This commit is contained in:
nossr50 2019-08-26 14:15:42 -06:00
parent 8a4410cde8
commit bba35f8a4e
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Version 2.1.105
mcMMO will reset players scoreboard to the main scoreboard if they move into a blacklisted world
NOTES:
The scoreboard change should result in mcMMO removing scoreboards from players properly when they enter a black listed world. This is a hacky band aid fix as our scoreboard code is archaic and needs to be rewritten in 2.2 and not 2.1. Expect a scoreboard overhaul sometime in the future.
Version 2.1.104
Fixed a bug resulting in many errors when using Rupture
Large update to the Japanese locale (thanks ethernetcat)

View File

@ -13,6 +13,7 @@ import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot;
@ -173,8 +174,13 @@ public class ScoreboardManager {
dirtyPowerLevels.add(player.getName());
}
// Called by PlayerQuitEvent listener
// Called by PlayerQuitEvent listener and OnPlayerTeleport under certain circumstances
public static void teardownPlayer(Player player) {
//Hacky world blacklist fix
if(player.isOnline() && player.isValid())
if(Bukkit.getServer().getScoreboardManager() != null)
player.setScoreboard(Bukkit.getServer().getScoreboardManager().getMainScoreboard());
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.remove(player.getName());
if (wrapper != null && wrapper.revertTask != null) {