misc cleanup

This commit is contained in:
Draycia committed 2021-10-18 14:04:42 -07:00
1 parent e9ca2290f6
commit 5b72fce0f0
3 files changed
+17 -9

No files matched your search

@@ -124,8 +124,8 @@ public class NicknameCommand {
// Checking other player's nickname
final CarbonPlayer target = handler.flags().get("player");
if (target.temporaryDisplayName() != null) {
messageService.temporaryNicknameShowOthers(sender, target.username(),target.displayName(),
if (target.hasActiveTemporaryDisplayName()) {
messageService.temporaryNicknameShowOthers(sender, target.username(), target.temporaryDisplayName(),
this.formatMillisDuration(target.temporaryDisplayNameExpiration()));
} else if (target.displayName() != null) {
messageService.nicknameShowOthers(sender, target.username(), target.displayName());
@@ -134,8 +134,8 @@ public class NicknameCommand {
}
} else {
// Checking own nickname
if (sender.temporaryDisplayName() != null) {
messageService.temporaryNicknameShow(sender, sender.username(),CarbonPlayer.renderName(sender),
if (sender.hasActiveTemporaryDisplayName()) {
messageService.temporaryNicknameShow(sender, sender.username(), sender.temporaryDisplayName(),
this.formatMillisDuration(sender.temporaryDisplayNameExpiration()));
} else if (sender.displayName() != null){
messageService.nicknameShow(sender, sender.username(), sender.displayName());
@@ -68,13 +68,9 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
@Override
public @Nullable Component displayName() {
if (this.temporaryDisplayName != null && System.currentTimeMillis() < this.temporaryDisplayNameExpiration) {
return this.temporaryDisplayName;
}
if (this.displayName != null) {
return this.displayName;
} else
}
return null;
}
@@ -101,6 +97,13 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
return this.temporaryDisplayNameExpiration;
}
@Override
public boolean hasActiveTemporaryDisplayName() {
return this.temporaryDisplayName != null
&& (this.temporaryDisplayNameExpiration == -1
|| this.temporaryDisplayNameExpiration > System.currentTimeMillis());
}
@Override
public boolean hasPermission(final String permission) {
return false;