Auto-correct of Nickname (BUG)
ProblemsSender opened this issue ยท 5 comments
Information
Full output of /ess version
:
EssentialsX version: 2.15.0.55
PermissionsEx version: 1.23.4
Vault version: 1.6.7-b${env.TRAVIS_BUILD_NUMBER}
EssentialsXProtect version: 2.15.0.55
EssentialsXSpawn version: 2.15.0.55
EssentialsXChat version: 2.15.0.55
EssentialsXAntiBuild version: 2.15.0.55
Server log: No error I've met in this log
EssentialsX config: My config is completely fine.
Details
Description
Happen upon "duplicate" nickname
Steps to reproduce
1/Enter the server with name Husky(any name you like), then /nick Temtem, this player is now masked with Temtem
2/Enter the server with name AnotherPlayer, then /nick TeMtEmM.
3/Use /kill Tem
4/Everything with cap more than tem(Tem, tem, TEM, TEm, tEm, etc "AND" ie, abs, gru, xyz, etc, asjkdghfsugiaruhgsdfhg) will be killed, except that player isn't registered or offline
Expected behavior
If I used /kill Tem, it should send error back, like "Did you mean: Temtem, TeMtEmM? instead of kill both 2 player
*Already tested with /give, it shouldn't a big deal for now cuz it won't give diamond to other player except we enter correctly name. This bug I think is comes from the "auto-correct" function, it could kill "tEmasdasdasdsd" player if he exist
Command I've tested, Fine mean no BUG, BUG mean... I think you would get it...
/realname - BUG
/kill - BUG
/give - Fine
/afk - Fine
/bal - Fine
/gm - Fine
/eclean - Fine
/eco - Fine
/ec - Fine
/fly - Fine
/heal - BUG
/home - Fine
/ignore - BUG
/invsee - affect to last first player it met with name, mean Tem will be Temtem first.
...
Okay I tired now, maybe another time to dig in this bug -_-! Thanks for reading.
This is intended behaviour.
If you don't type an exact username, many EssentialsX commands will run on every user who has a username or nickname that matches the given name.
If you want to target specific users, use /realname
to find the right usernames of the players, then use the proper usernames in the other command (like /kill
, /heal
).
Relevant excerpt from CraftBukkit's implementation of Server.matchPlayer
(partialName
is the name you typed into the command) (source)
if (partialName.equalsIgnoreCase(iterPlayerName)) {
// Exact match
matchedPlayers.clear();
matchedPlayers.add(iterPlayer);
break;
}
Glowstone also implements Server.matchPlayer
like this (name
is the name you typed into the command) (source)
name = name.toLowerCase();
// ...
String lower = player.getName().toLowerCase();
if (lower.equals(name)) {
result.clear();
result.add(player);
break;
} else { // ...
If the name is exactly the same as a player's username (case-insensitive), the server will only give EssentialsX that player and no others. It is impossible for EssentialsX to run the command on any other players if you type in someone's exact username.
Try pressing TAB to complete someone's username to see if this solves the issue.
1/https://www.upsieutoc.com/image/GfQKwj
2/https://www.upsieutoc.com/image/GfQAMC
3/https://www.upsieutoc.com/image/GfQidw
4/https://www.upsieutoc.com/image/GfQtmq
5/https://www.upsieutoc.com/image/GfQyBt
I tested it and still found bugs, I used Spigot 1.12.2 latest(already updated til 12/7 today), and the other information above.
Note that I already gave player the full permissions, maybe it was my fault, letting a moderator possible to do command /kill player might not a good idea, but with /heal that gives player permission to heal other players, there's a chance that player in guild using same tree name to take advantage, basically trump-trumpower-trumpowergod-trumpowergodness-etc , even it's bug I still find it funny :) maybe just let these players to /heal themselves :< but this still not what I mean to let this bug not to be fixed, there are lots of commands needs to test to find out bug, there was just the surface information I found about this bug.