mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-23 23:03:05 +02:00
[Fix] Allow /nick to change nickname case, without adding prefix character.
This commit is contained in:
@@ -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"));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user