diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HumanController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HumanController.java index 480fd83dd..0acc4576d 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HumanController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HumanController.java @@ -33,10 +33,6 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version @@ -46,6 +42,11 @@ public class HumanController extends AbstractEntityController { uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +68,14 @@ public class HumanController extends AbstractEntityController { if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity()); diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HumanController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HumanController.java index 141837c37..2a18a9260 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HumanController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HumanController.java @@ -33,10 +33,6 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version @@ -46,6 +42,11 @@ public class HumanController extends AbstractEntityController { uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +68,14 @@ public class HumanController extends AbstractEntityController { if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity()); diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HumanController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HumanController.java index d2fe88a4a..fbd1dc7dc 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HumanController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HumanController.java @@ -33,10 +33,6 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version @@ -46,6 +42,11 @@ public class HumanController extends AbstractEntityController { uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +68,14 @@ public class HumanController extends AbstractEntityController { if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity()); diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HumanController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HumanController.java index 0d1a4a8db..f5817bb1f 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HumanController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HumanController.java @@ -33,10 +33,6 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version @@ -46,6 +42,11 @@ public class HumanController extends AbstractEntityController { uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +68,14 @@ public class HumanController extends AbstractEntityController { if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity()); diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HumanController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HumanController.java index 35ad9784e..4f61a5a98 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HumanController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HumanController.java @@ -33,10 +33,6 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version @@ -46,6 +42,11 @@ public class HumanController extends AbstractEntityController { uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +68,14 @@ public class HumanController extends AbstractEntityController { if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity()); diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HumanController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HumanController.java index aca5ba912..fba8718ea 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HumanController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HumanController.java @@ -33,10 +33,6 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version @@ -46,6 +42,11 @@ public class HumanController extends AbstractEntityController { uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +68,14 @@ public class HumanController extends AbstractEntityController { if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity()); diff --git a/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/entity/HumanController.java b/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/entity/HumanController.java index 4717bfc98..36e284eba 100644 --- a/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/entity/HumanController.java +++ b/v1_16_R2/src/main/java/net/citizensnpcs/nms/v1_16_R2/entity/HumanController.java @@ -33,10 +33,6 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version @@ -45,6 +41,12 @@ public class HumanController extends AbstractEntityController { msb |= 0x0000000000002000L; uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + + String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +69,14 @@ public class HumanController extends AbstractEntityController { if (!Setting.USE_SCOREBOARD_TEAMS.asBoolean()) return; Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity()); diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HumanController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HumanController.java index b4570cf6b..92c051912 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HumanController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HumanController.java @@ -7,6 +7,7 @@ import org.bukkit.Location; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; +import org.bukkit.scoreboard.NameTagVisibility; import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Team; @@ -33,11 +34,7 @@ public class HumanController extends AbstractEntityController { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = npc.getFullName(); String name = coloredName.length() > 16 ? coloredName.substring(0, 16) : coloredName; - if (npc.requiresNameHologram()) { - name = npc.getId() + UUID.randomUUID().toString().replace("-", ""); - name = name.substring(0, 16); - } - + UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { // clear version long msb = uuid.getMostSignificantBits(); @@ -46,6 +43,11 @@ public class HumanController extends AbstractEntityController { uuid = new UUID(msb, uuid.getLeastSignificantBits()); } + final String teamName = Util.getTeamName(uuid); + if (npc.requiresNameHologram()) { + name = teamName; + } + final GameProfile profile = new GameProfile(uuid, name); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, @@ -67,12 +69,14 @@ public class HumanController extends AbstractEntityController { if (Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { Scoreboard scoreboard = Util.getDummyScoreboard(); - String teamName = Util.getTeamName(profile.getId()); Team team = scoreboard.getTeam(teamName); int mode = 2; if (team == null) { team = scoreboard.registerNewTeam(teamName); + if (npc.requiresNameHologram()) { + team.setNameTagVisibility(NameTagVisibility.NEVER); + } mode = 0; } team.addPlayer(handle.getBukkitEntity());