mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
MMOInfo command makes better wiki links
This commit is contained in:
parent
71d1574a7d
commit
cf9117097d
@ -1,10 +1,12 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.listeners.InteractionManager;
|
import com.gmail.nossr50.listeners.InteractionManager;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -88,6 +90,12 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(SubSkillType subSkillType : SubSkillType.values())
|
||||||
|
{
|
||||||
|
if(subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(subSkillName))
|
||||||
|
subSkillName = subSkillType.getWikiName(subSkillType.toString());
|
||||||
|
}
|
||||||
|
|
||||||
//Send Player Wiki Link
|
//Send Player Wiki Link
|
||||||
TextComponentFactory.sendPlayerSubSkillWikiLink(player, subSkillName);
|
TextComponentFactory.sendPlayerSubSkillWikiLink(player, subSkillName);
|
||||||
}
|
}
|
||||||
|
@ -196,6 +196,37 @@ public enum SubSkillType {
|
|||||||
return endResult;
|
return endResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getWikiName(String subSkillName) {
|
||||||
|
/*
|
||||||
|
* Find where to begin our substring (after the prefix)
|
||||||
|
*/
|
||||||
|
String endResult = "";
|
||||||
|
int subStringIndex = getSubStringIndex(subSkillName);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Split the string up so we can capitalize each part
|
||||||
|
*/
|
||||||
|
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||||
|
if(subskillNameWithoutPrefix.contains("_"))
|
||||||
|
{
|
||||||
|
String splitStrings[] = subskillNameWithoutPrefix.split("_");
|
||||||
|
|
||||||
|
for(int i = 0; i < splitStrings.length; i++)
|
||||||
|
{
|
||||||
|
if(i+1 >= splitStrings.length)
|
||||||
|
endResult+=StringUtils.getCapitalized(splitStrings[i]);
|
||||||
|
else {
|
||||||
|
endResult += StringUtils.getCapitalized(splitStrings[i]);
|
||||||
|
endResult += "_";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
endResult += StringUtils.getCapitalized(subskillNameWithoutPrefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
return endResult;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the parent skill from the Locale file
|
* Returns the name of the parent skill from the Locale file
|
||||||
* @return The parent skill as defined in the locale
|
* @return The parent skill as defined in the locale
|
||||||
|
Loading…
Reference in New Issue
Block a user