chat commands: support boss shortnames for !lvl
This commit is contained in:
@@ -94,7 +94,7 @@ public enum HiscoreSkill
|
||||
KALPHITE_QUEEN("Kalphite Queen", BOSS),
|
||||
KING_BLACK_DRAGON("King Black Dragon", BOSS),
|
||||
KRAKEN("Kraken", BOSS),
|
||||
KREEARRA("Kree'Arra", BOSS),
|
||||
KREEARRA("Kree'arra", BOSS),
|
||||
KRIL_TSUTSAROTH("K'ril Tsutsaroth", BOSS),
|
||||
MIMIC("Mimic", BOSS),
|
||||
NEX("Nex", BOSS),
|
||||
|
||||
@@ -1339,13 +1339,8 @@ public class ChatCommandsPlugin extends Plugin
|
||||
search = message.substring(LEVEL_COMMAND_STRING.length() + 1);
|
||||
}
|
||||
|
||||
search = SkillAbbreviations.getFullName(search);
|
||||
final HiscoreSkill skill;
|
||||
try
|
||||
{
|
||||
skill = HiscoreSkill.valueOf(search.toUpperCase());
|
||||
}
|
||||
catch (IllegalArgumentException i)
|
||||
final HiscoreSkill skill = findHiscoreSkill(search);
|
||||
if (skill == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2171,4 +2166,21 @@ public class ChatCommandsPlugin extends Plugin
|
||||
return WordUtils.capitalize(boss);
|
||||
}
|
||||
}
|
||||
|
||||
private static HiscoreSkill findHiscoreSkill(String search)
|
||||
{
|
||||
String s = SkillAbbreviations.getFullName(search);
|
||||
if (s == search)
|
||||
{
|
||||
s = longBossName(search);
|
||||
}
|
||||
for (HiscoreSkill skill : HiscoreSkill.values())
|
||||
{
|
||||
if (skill.getName().equals(s))
|
||||
{
|
||||
return skill;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user