Fix Dinnerbone and Grumm being spun the wrong way around

This commit is contained in:
libraryaddict 2020-04-05 02:24:02 +13:00
parent efbd6e29e3
commit 2495ea65c3
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 22 additions and 2 deletions

View File

@ -98,7 +98,15 @@ public class PlayerDisguise extends TargetedDisguise {
return scoreboardName; return scoreboardName;
} }
private boolean isStaticName(String name) {
return name != null && (name.equalsIgnoreCase("Dinnerbone") || name.equalsIgnoreCase("Grumm"));
}
public boolean hasScoreboardName() { public boolean hasScoreboardName() {
if (isStaticName(getName())) {
return false;
}
return scoreboardName != null || DisguiseConfig.isScoreboardDisguiseNames() || getName().length() > 16; return scoreboardName != null || DisguiseConfig.isScoreboardDisguiseNames() || getName().length() > 16;
} }
@ -214,9 +222,9 @@ public class PlayerDisguise extends TargetedDisguise {
} }
if (isDisguiseInUse()) { if (isDisguiseInUse()) {
boolean resendDisguise = !DisguiseConfig.isScoreboardDisguiseNames(); boolean resendDisguise = false;
if (hasScoreboardName()) { if (DisguiseConfig.isScoreboardDisguiseNames() && !isStaticName(name)) {
DisguiseUtilities.DScoreTeam team = getScoreboardName(); DisguiseUtilities.DScoreTeam team = getScoreboardName();
String[] split = DisguiseUtilities.getExtendedNameSplit(team.getPlayer(), name); String[] split = DisguiseUtilities.getExtendedNameSplit(team.getPlayer(), name);
@ -224,6 +232,10 @@ public class PlayerDisguise extends TargetedDisguise {
team.setSplit(split); team.setSplit(split);
} }
resendDisguise =
!DisguiseConfig.isScoreboardDisguiseNames() || isStaticName(name) || isStaticName(getName()) ||
resendDisguise;
if (resendDisguise) { if (resendDisguise) {
if (stopDisguise()) { if (stopDisguise()) {
if (getName().isEmpty() && !name.isEmpty()) { if (getName().isEmpty() && !name.isEmpty()) {

View File

@ -1300,6 +1300,10 @@ public class DisguiseUtilities {
public static void updateExtendedName(PlayerDisguise disguise) { public static void updateExtendedName(PlayerDisguise disguise) {
DScoreTeam exName = disguise.getScoreboardName(); DScoreTeam exName = disguise.getScoreboardName();
if (exName.getTeamName() == null) {
exName.setTeamName(getUniqueTeam());
}
for (Scoreboard board : getAllScoreboards()) { for (Scoreboard board : getAllScoreboards()) {
exName.handleTeam(board, disguise.isNameVisible()); exName.handleTeam(board, disguise.isNameVisible());
} }
@ -1326,6 +1330,10 @@ public class DisguiseUtilities {
DScoreTeam name = ((PlayerDisguise) disguise).getScoreboardName(); DScoreTeam name = ((PlayerDisguise) disguise).getScoreboardName();
if (name.getTeamName() == null) {
continue;
}
name.handleTeam(scoreboard, ((PlayerDisguise) disguise).isNameVisible()); name.handleTeam(scoreboard, ((PlayerDisguise) disguise).isNameVisible());
} }
} }