mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-04 13:54:35 +01:00
Don't allow vanilla nametag setting to ruin player disguise names
This commit is contained in:
parent
0034aa07db
commit
e0eba67f74
@ -12,6 +12,7 @@ import me.libraryaddict.disguise.commands.modify.DisguiseModifyCommand;
|
||||
import me.libraryaddict.disguise.commands.modify.DisguiseModifyEntityCommand;
|
||||
import me.libraryaddict.disguise.commands.modify.DisguiseModifyPlayerCommand;
|
||||
import me.libraryaddict.disguise.commands.modify.DisguiseModifyRadiusCommand;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
@ -293,7 +294,13 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
|
||||
return new ArrayList<>(new HashSet<>(list));
|
||||
}
|
||||
|
||||
protected String getDisplayName(CommandSender player) {
|
||||
protected String getDisplayName(Disguise disguise, CommandSender player) {
|
||||
// If we can't do fancy names, and this nametag can't go beyond the 16 char name limit
|
||||
// Then we shouldn't say anything but the actual name
|
||||
if (disguise.isPlayerDisguise() && !DisguiseConfig.isScoreboardNames()) {
|
||||
return player.getName();
|
||||
}
|
||||
|
||||
String name = DisguiseConfig.getNameAboveDisguise().replace("%simple%", player.getName());
|
||||
|
||||
if (name.contains("%complex%")) {
|
||||
|
@ -61,7 +61,7 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
|
||||
|
||||
if (DisguiseConfig.isNameOfPlayerShownAboveDisguise() && !sender.hasPermission("libsdisguises.hidename")) {
|
||||
if (disguise.getWatcher() instanceof LivingWatcher) {
|
||||
disguise.getWatcher().setCustomName(getDisplayName(sender));
|
||||
disguise.getWatcher().setCustomName(getDisplayName(disguise, sender));
|
||||
|
||||
if (DisguiseConfig.isNameAboveHeadAlwaysVisible()) {
|
||||
disguise.getWatcher().setCustomNameVisible(true);
|
||||
|
@ -97,7 +97,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (DisguiseConfig.isNameOfPlayerShownAboveDisguise() && !entityTarget.hasPermission("libsdisguises.hidename")) {
|
||||
if (disguise.getWatcher() instanceof LivingWatcher) {
|
||||
disguise.getWatcher().setCustomName(getDisplayName(entityTarget));
|
||||
disguise.getWatcher().setCustomName(getDisplayName(disguise, entityTarget));
|
||||
|
||||
if (DisguiseConfig.isNameAboveHeadAlwaysVisible()) {
|
||||
disguise.getWatcher().setCustomNameVisible(true);
|
||||
|
@ -179,7 +179,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
if (entity instanceof Player && DisguiseConfig.isNameOfPlayerShownAboveDisguise() &&
|
||||
!entity.hasPermission("libsdisguises.hidename")) {
|
||||
if (disguise.getWatcher() instanceof LivingWatcher) {
|
||||
disguise.getWatcher().setCustomName(getDisplayName(entity));
|
||||
disguise.getWatcher().setCustomName(getDisplayName(disguise, entity));
|
||||
|
||||
if (DisguiseConfig.isNameAboveHeadAlwaysVisible()) {
|
||||
disguise.getWatcher().setCustomNameVisible(true);
|
||||
|
Loading…
Reference in New Issue
Block a user