Fix name not updated when setting name visible or deadmau, and hopefully fix empty names showing
This commit is contained in:
parent
ba9eba508b
commit
249b02aa85
@ -143,8 +143,12 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
return DisguiseConfig.isScoreboardNames();
|
return DisguiseConfig.isScoreboardNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual name that'll be sent in the game profile, not the name that they're known as
|
||||||
|
*/
|
||||||
public String getProfileName() {
|
public String getProfileName() {
|
||||||
return isUpsideDown() ? "Dinnerbone" : isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName();
|
return isUpsideDown() ? "Dinnerbone" : isDeadmau5Ears() ? "deadmau5" :
|
||||||
|
hasScoreboardName() ? getScoreboardName().getPlayer() : DisguiseConfig.isScoreboardNames() && getName().isEmpty() ? "LD_NoName" : getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUUID() {
|
public UUID getUUID() {
|
||||||
@ -210,6 +214,10 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
|
|
||||||
getWatcher().setInternalUpsideDown(upsideDown);
|
getWatcher().setInternalUpsideDown(upsideDown);
|
||||||
|
|
||||||
|
if (gameProfile != null) {
|
||||||
|
gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, getProfileName(), getGameProfile());
|
||||||
|
}
|
||||||
|
|
||||||
if (isDisguiseInUse()) {
|
if (isDisguiseInUse()) {
|
||||||
resendDisguise(DisguiseConfig.isArmorstandsName() ? getName() : "Dinnerbone", true);
|
resendDisguise(DisguiseConfig.isArmorstandsName() ? getName() : "Dinnerbone", true);
|
||||||
} else {
|
} else {
|
||||||
@ -226,6 +234,10 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
|
|
||||||
this.deadmau5Ears = deadmau5Ears;
|
this.deadmau5Ears = deadmau5Ears;
|
||||||
|
|
||||||
|
if (gameProfile != null) {
|
||||||
|
gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, getProfileName(), getGameProfile());
|
||||||
|
}
|
||||||
|
|
||||||
if (isDisguiseInUse()) {
|
if (isDisguiseInUse()) {
|
||||||
resendDisguise(DisguiseConfig.isArmorstandsName() ? getName() : "deadmau5", true);
|
resendDisguise(DisguiseConfig.isArmorstandsName() ? getName() : "deadmau5", true);
|
||||||
} else {
|
} else {
|
||||||
@ -468,8 +480,7 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
WrappedGameProfile gameProfile = DisguiseUtilities
|
WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
|
||||||
.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
|
|
||||||
|
|
||||||
if (gameProfile != null) {
|
if (gameProfile != null) {
|
||||||
setSkin(gameProfile);
|
setSkin(gameProfile);
|
||||||
@ -516,29 +527,31 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refreshDisguise() {
|
private void refreshDisguise() {
|
||||||
if (DisguiseUtilities.isDisguiseInUse(this)) {
|
if (!DisguiseUtilities.isDisguiseInUse(this)) {
|
||||||
if (isDisplayedInTab()) {
|
return;
|
||||||
PacketContainer addTab = DisguiseUtilities.getTabPacket(this, PlayerInfoAction.ADD_PLAYER);
|
|
||||||
|
|
||||||
PacketContainer deleteTab = addTab.shallowClone();
|
|
||||||
deleteTab.getPlayerInfoAction().write(0, PlayerInfoAction.REMOVE_PLAYER);
|
|
||||||
|
|
||||||
try {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (!canSee(player)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, addTab);
|
|
||||||
}
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DisguiseUtilities.refreshTrackers(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDisplayedInTab()) {
|
||||||
|
PacketContainer addTab = DisguiseUtilities.getTabPacket(this, PlayerInfoAction.ADD_PLAYER);
|
||||||
|
|
||||||
|
PacketContainer deleteTab = addTab.shallowClone();
|
||||||
|
deleteTab.getPlayerInfoAction().write(0, PlayerInfoAction.REMOVE_PLAYER);
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (!canSee(player)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
|
||||||
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, addTab);
|
||||||
|
}
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DisguiseUtilities.refreshTrackers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -634,8 +647,7 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
WrappedGameProfile gameProfile = DisguiseUtilities
|
WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
|
||||||
.getProfileFromMojang(this.skinToUse, currentLookup, DisguiseConfig.isContactMojangServers());
|
|
||||||
|
|
||||||
if (gameProfile != null) {
|
if (gameProfile != null) {
|
||||||
setSkin(gameProfile);
|
setSkin(gameProfile);
|
||||||
|
Loading…
Reference in New Issue
Block a user