mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
mmoinfo command now links to the official wiki
This commit is contained in:
parent
b42b4cadbe
commit
f8b7d5e10d
@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.TextComponentFactory;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -85,7 +86,9 @@ public class MmoInfoCommand implements TabExecutor {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
||||
//TextComponentFactory.sendPlayerUrlHeader(player);
|
||||
}
|
||||
}
|
||||
|
||||
//Send Player Wiki Link
|
||||
TextComponentFactory.sendPlayerSubSkillWikiLink(player, subSkillName);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.*;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -64,6 +65,27 @@ public class TextComponentFactory {
|
||||
return new TextComponent(text);
|
||||
}
|
||||
|
||||
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted)
|
||||
{
|
||||
if(!Config.getInstance().getUrlLinksEnabled())
|
||||
return;
|
||||
|
||||
Player.Spigot spigotPlayer = player.spigot();
|
||||
|
||||
TextComponent wikiLinkComponent = new TextComponent(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
|
||||
wikiLinkComponent.setUnderlined(true);
|
||||
|
||||
String wikiUrl = "https://mcmmo.org/wiki/"+subskillformatted;
|
||||
|
||||
wikiLinkComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, wikiUrl));
|
||||
|
||||
ComponentBuilder componentBuilder = new ComponentBuilder(subskillformatted).append("\n").append(wikiUrl).color(ChatColor.GRAY).italic(true);
|
||||
|
||||
wikiLinkComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, componentBuilder.create()));
|
||||
|
||||
spigotPlayer.sendMessage(ChatMessageType.SYSTEM, wikiLinkComponent);
|
||||
}
|
||||
|
||||
public static void sendPlayerUrlHeader(Player player) {
|
||||
if(!Config.getInstance().getUrlLinksEnabled())
|
||||
return;
|
||||
|
@ -77,6 +77,7 @@ MOTD.Version.Overhaul=[[GOLD]][mcMMO] [[DARK_AQUA]]Overhaul Era[[GOLD]] - [[DARK
|
||||
Overhaul.mcMMO.Header=[[RED]][]=====[][[GREEN]] mcMMO - Overhaul Era [[RED]][]=====[]
|
||||
Overhaul.mcMMO.Url.Wrap.Prefix=[[RED]][|
|
||||
Overhaul.mcMMO.Url.Wrap.Suffix=[[RED]]|]
|
||||
Overhaul.mcMMO.MmoInfo.Wiki=[[YELLOW]][[[WHITE]]View this skill on the wiki![[YELLOW]]]
|
||||
# /mcMMO Command Style Stuff
|
||||
Commands.mcc.Header=[[RED]]---[][[GREEN]]mcMMO Commands[[RED]][]---
|
||||
Commands.Other=[[RED]]---[][[GREEN]]SPECIAL COMMANDS[[RED]][]---
|
||||
|
Loading…
Reference in New Issue
Block a user