From a696a8b23bfd4fee24b865afd2fb3ff0df62c788 Mon Sep 17 00:00:00 2001 From: Jerom van der Sar Date: Wed, 21 Nov 2012 16:48:23 +0100 Subject: [PATCH] Make commands guess players by nickname --- .../StevenLawson/TotalFreedomMod/Commands/TFM_Command.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java b/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java index b493e3e6..ba4d5828 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/TFM_Command.java @@ -36,6 +36,13 @@ public class TFM_Command List matches = server.matchPlayer(partialname); if (matches.isEmpty()) { + for(Player p : server.getOnlinePlayers()) + { + if(p.getDisplayName().toLowerCase().indexOf(partialname) != -1) + { + return p; + } + } throw new CantFindPlayerException(partialname); } else