Move ChatCommandsPlugin#sanitize to Text

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2019-01-06 00:31:43 +01:00
parent 1c88c93425
commit d808baa3d3
2 changed files with 14 additions and 13 deletions

View File

@@ -62,6 +62,7 @@ import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.StackFormatter;
import static net.runelite.client.util.Text.sanitize;
import net.runelite.http.api.chat.ChatClient;
import net.runelite.http.api.hiscore.HiscoreClient;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
@@ -792,19 +793,6 @@ public class ChatCommandsPlugin extends Plugin
return shortest;
}
/**
* Cleans the ironman status icon from playername string if present and
* corrects spaces.
*
* @param lookup Playername to lookup.
* @return Cleaned playername.
*/
private static String sanitize(String lookup)
{
String cleaned = lookup.contains("<img") ? lookup.substring(lookup.lastIndexOf('>') + 1) : lookup;
return cleaned.replace('\u00A0', ' ');
}
/**
* Looks up the ironman status of the local player. Does NOT work on other players.
*

View File

@@ -146,4 +146,17 @@ public class Text
return out.toString();
}
/**
* Cleans the ironman status icon from playername string if present and
* corrects spaces.
*
* @param name Playername to lookup.
* @return Cleaned playername.
*/
public static String sanitize(String name)
{
String cleaned = name.contains("<img") ? name.substring(name.lastIndexOf('>') + 1) : name;
return cleaned.replace('\u00A0', ' ');
}
}