Skip to content

Commit 6180c6f

Browse files
committed
namemc cmd supports multiple lookups at once
1 parent 5c2f482 commit 6180c6f

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/main/java/net/wurstclient/commands/NameMCCmd.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.google.gson.JsonParser;
1212

1313
import net.minecraft.util.Util;
14-
import net.wurstclient.command.CmdError;
1514
import net.wurstclient.command.CmdException;
1615
import net.wurstclient.command.CmdSyntaxError;
1716
import net.wurstclient.command.Command;
@@ -35,22 +34,30 @@ public NameMCCmd()
3534
@Override
3635
public void call(String[] args) throws CmdException
3736
{
37+
// must have 1 or more arguments
3838
if(args.length < 1)
3939
throw new CmdSyntaxError();
4040

41-
final String target = String.join("", args);
42-
41+
// look up each target individually
42+
for(String target : args)
43+
{
44+
lookup(target);
45+
}
46+
}
47+
48+
private void lookup(String target)
49+
{
4350
try
4451
{
45-
// try getting the uuid just to make sure the user exists (not a
46-
// nick)
52+
// try getting the uuid just to make sure the user exists
4753
fetchUUIDFromMojang(target);
4854

49-
ChatUtils.message("Opening profile in the browser...");
55+
ChatUtils
56+
.message("Opening profile `" + target + "` in the browser...");
5057
Util.getOperatingSystem().open("https://namemc.com/" + target);
5158
}catch(Exception e)
5259
{
53-
throw new CmdError("Failed to fetch profile");
60+
ChatUtils.error("Failed to fetch profile `" + target + "`");
5461
}
5562
}
5663

0 commit comments

Comments
 (0)