mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 20:12:54 +00:00
[Fix] Allow /nick to change nickname case, without adding prefix character.
This commit is contained in:
parent
46e9471a63
commit
b1f427d52e
2 changed files with 14 additions and 8 deletions
|
@ -283,7 +283,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
String nickname;
|
String nickname;
|
||||||
String suffix = "";
|
String suffix = "";
|
||||||
final String nick = getNickname();
|
final String nick = getNickname();
|
||||||
if (ess.getSettings().isCommandDisabled("nick") || nick == null || nick.isEmpty() || nick.equals(getName()))
|
if (ess.getSettings().isCommandDisabled("nick") || nick == null || nick.isEmpty() || nick.equalsIgnoreCase(getName()))
|
||||||
{
|
{
|
||||||
nickname = getName();
|
nickname = getName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,13 @@ public class Commandnick extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new Exception(_("nickNamesAlpha"));
|
throw new Exception(_("nickNamesAlpha"));
|
||||||
}
|
}
|
||||||
else if ("off".equalsIgnoreCase(nick) || target.getName().equalsIgnoreCase(nick))
|
else if (target.getName().equalsIgnoreCase(nick))
|
||||||
|
{
|
||||||
|
target.setNickname(nick);
|
||||||
|
target.setDisplayNick();
|
||||||
|
target.sendMessage(_("nickNoMore"));
|
||||||
|
}
|
||||||
|
else if ("off".equalsIgnoreCase(nick))
|
||||||
{
|
{
|
||||||
target.setNickname(null);
|
target.setNickname(null);
|
||||||
target.setDisplayNick();
|
target.setDisplayNick();
|
||||||
|
@ -102,16 +108,16 @@ public class Commandnick extends EssentialsCommand
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (target.getBase() == p)
|
if (target.getBase() == onlinePlayer)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String dn = p.getDisplayName().toLowerCase(Locale.ENGLISH);
|
String displayName = onlinePlayer.getDisplayName().toLowerCase(Locale.ENGLISH);
|
||||||
String n = p.getName().toLowerCase(Locale.ENGLISH);
|
String name = onlinePlayer.getName().toLowerCase(Locale.ENGLISH);
|
||||||
String nk = nick.toLowerCase(Locale.ENGLISH);
|
String lowerNick = nick.toLowerCase(Locale.ENGLISH);
|
||||||
if (nk.equals(dn) || nk.equals(n))
|
if (lowerNick.equals(displayName) || lowerNick.equals(name))
|
||||||
{
|
{
|
||||||
throw new Exception(_("nickInUse"));
|
throw new Exception(_("nickInUse"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue