Adding list name to /nick support.

This commit is contained in:
KHobbits 2011-10-04 07:21:09 +01:00
parent 0aa9f79629
commit da337284e5
3 changed files with 15 additions and 9 deletions

View File

@ -46,11 +46,11 @@ public class EssentialsPlayerListener extends PlayerListener
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
user.setDisplayName(user.getNick());
user.setDisplayNick(user.getNick());
updateCompass(user);
if (ess.getSettings().changeDisplayName())
{
user.setDisplayName(user.getNick());
user.setDisplayNick(user.getNick());
}
}
@ -76,7 +76,7 @@ public class EssentialsPlayerListener extends PlayerListener
user.updateActivity(true);
if (ess.getSettings().changeDisplayName())
{
user.setDisplayName(user.getNick());
user.setDisplayNick(user.getNick());
}
}
@ -262,7 +262,7 @@ public class EssentialsPlayerListener extends PlayerListener
if (ess.getSettings().changeDisplayName())
{
user.setDisplayName(user.getNick());
user.setDisplayNick(user.getNick());
}
user.updateActivity(false);
if (user.isAuthorized("essentials.sleepingignored"))
@ -351,7 +351,7 @@ public class EssentialsPlayerListener extends PlayerListener
final User user = ess.getUser(event.getPlayer());
if (ess.getSettings().changeDisplayName())
{
user.setDisplayName(user.getNick());
user.setDisplayNick(user.getNick());
}
updateCompass(user);
}

View File

@ -282,6 +282,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return nickname.toString();
}
public void setDisplayNick(String name)
{
setDisplayName(name);
setPlayerListName(name);
}
public Teleport getTeleport()
{

View File

@ -41,7 +41,7 @@ public class Commandnick extends EssentialsCommand
String nick = args[0];
if ("off".equalsIgnoreCase(nick) || user.getName().equalsIgnoreCase(nick))
{
user.setDisplayName(user.getName());
user.setDisplayNick(user.getName());
user.setNickname(null);
user.sendMessage(Util.i18n("nickNoMore"));
return;
@ -67,7 +67,7 @@ public class Commandnick extends EssentialsCommand
}
}
user.setDisplayName(ess.getSettings().getNicknamePrefix() + nick);
user.setDisplayNick(ess.getSettings().getNicknamePrefix() + nick);
user.setNickname(nick);
user.sendMessage(Util.format("nickSet", user.getDisplayName() + "§7."));
}
@ -95,13 +95,13 @@ public class Commandnick extends EssentialsCommand
String nick = args[1];
if ("off".equalsIgnoreCase(nick) || target.getName().equalsIgnoreCase(nick))
{
target.setDisplayName(target.getName());
target.setDisplayNick(target.getName());
target.setNickname(null);
target.sendMessage(Util.i18n("nickNoMore"));
}
else
{
target.setDisplayName(ess.getSettings().getNicknamePrefix() + nick);
target.setDisplayNick(ess.getSettings().getNicknamePrefix() + nick);
target.setNickname(nick);
target.sendMessage(Util.format("nickSet", target.getDisplayName() + "§7."));
}