Aggressively remove player scoreboards

This commit is contained in:
fullwall 2016-06-15 00:29:39 +08:00
parent 3dc814ef8c
commit f942b1eded
2 changed files with 13 additions and 10 deletions

View File

@ -291,18 +291,23 @@ public class CitizensNPC extends AbstractNPC {
if (getEntity() instanceof Player if (getEntity() instanceof Player
&& Bukkit.getScoreboardManager().getMainScoreboard().getTeam(teamName) != null) { && Bukkit.getScoreboardManager().getMainScoreboard().getTeam(teamName) != null) {
Team team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(teamName); Team team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(teamName);
if (!Setting.USE_SCOREBOARD_TEAMS.asBoolean()) {
team.unregister();
data().remove(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA);
} else {
team.setOption(Option.NAME_TAG_VISIBILITY, nameVisibility); team.setOption(Option.NAME_TAG_VISIBILITY, nameVisibility);
if (data().has(NPC.GLOWING_COLOR_METADATA)) { if (data().has(NPC.GLOWING_COLOR_METADATA)) {
if (team.getPrefix() == null || team.getPrefix().length() == 0 if (team.getPrefix() == null || team.getPrefix().length() == 0
|| (data().has("previous-glowing-color") || (data().has("previous-glowing-color")
&& !team.getPrefix().equals(data().get("previous-glowing-color")))) { && !team.getPrefix().equals(data().get("previous-glowing-color")))) {
team.setPrefix( team.setPrefix(ChatColor.valueOf(data().<String> get(NPC.GLOWING_COLOR_METADATA))
ChatColor.valueOf(data().<String> get(NPC.GLOWING_COLOR_METADATA)).toString()); .toString());
data().set("previous-glowing-color", team.getPrefix()); data().set("previous-glowing-color", team.getPrefix());
} }
} }
} }
} }
}
Player player = getEntity() instanceof Player ? (Player) getEntity() : null; Player player = getEntity() instanceof Player ? (Player) getEntity() : null;
NMS.sendPacketNearby(player, getStoredLocation(), NMS.sendPacketNearby(player, getStoredLocation(),
new PacketPlayOutEntityTeleport(NMS.getHandle(getEntity()))); new PacketPlayOutEntityTeleport(NMS.getHandle(getEntity())));

View File

@ -86,8 +86,6 @@ public class HumanController extends AbstractEntityController {
skin.apply(handle); skin.apply(handle);
} }
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch());
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override @Override
public void run() { public void run() {