-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added /wiki
chat command.
#1024
base: master
Are you sure you want to change the base?
Conversation
@@ -559,5 +560,6 @@ public void serverLoad(FMLServerStartingEvent pEvent) { | |||
if (YAMCore.isDebug()) { | |||
pEvent.registerServerCommand(new AllPurposeDebugCommand()); | |||
} | |||
pEvent.registerServerCommand(new WikiCommand()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to make it a client command, not a server command otherwise it will crash
register your command in the init block of the client proxy using ClientCommandHandler.instance.registerCommand();
|
||
public class WikiCommand implements ICommand { | ||
|
||
private List aliases; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to allocate a field you can just do
@Override
public String getCommandName() {
return Collections.singletonList("wiki");
}
|
||
@Override | ||
public void processCommand(ICommandSender pCmdSender, String[] pArgs) { | ||
if (!(pCmdSender instanceof EntityPlayerMP)) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need that line once you register on the client command handler
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
|
||
public class WikiCommand implements ICommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can extend CommandBase
instead of ICommand and remove some of the methods you implemented that are the same as the vanilla command base
also you need to think about adding tabcompletion options so that it's easier to use and we can see everything that's available |
Looks like a nice addition to the wiki! |
One of my goals is to encourage a positive feedback loop: players will have easier access to the wiki, they will see articles that are missing or incomplete or outdated, complain about them on discord, which gives us a chance to fix the wiki. Everyone wins! |
The more options you add for the command, the higher likelihood of the player stumbling upon more and more pages that don't exist. Having the options is nice, but I'm still not sure about the expectation of /wiki hand or /wiki block returning an empty page most of the time. |
The
/wiki
chat command allows the player to instantly access the GTNH wiki from the game, and search for specific topics (for example, information about blocks or game features).Planned options:
/wiki
- Opens the wiki main page./wiki <topic>
- Searches the wiki for the specified topic. For example,/wiki EBF
takes you to https://wiki.gtnewhorizons.com/wiki/Electric_Blast_Furnace./wiki hand
- Searches the wiki for the item currently held in the player's hand./wiki block
- Searches the wiki for the block the player is currently looking at.First two variants are already implemented; the other two are WIP. Any comments/feedback/suggestions are welcome.
Wiki page is open in the player's default browser. The command respects the "Prompt on links" option from vanilla.
java_0uLiTPvOih.mp4