[INACTIVE][INFO] HelpCenter v1.78 - A Flat and HTTP Helpfile/Topic Server [860]

Discussion in 'Inactive/Unsupported Plugins' started by weasel5i2, Feb 10, 2011.

  1. Offline

    weasel5i2

    HelpCenter - A Flat and HTTP Helpfile/Topic Server:
    Version: 1.78

    Description: **COLOUR CODES have CHANGED! See below...**

    This plugin allows you to serve any number of textfiles (and/or web-based texts) as help topics, using the /help command. The help files are placed in the HelpCenter/ folder, and their existence determines their availability within the game. Since the plugin reads the files each time it is invoked, any changes to the textfiles will be reflected immediately in-game. Note that the filenames must contain only characters which are enterable into the Minecraft client. It can also fetch helpfiles from a web server (the files must be in text/plain format, it will not strip out HTML tags or any weird characters, or do any unescaping() so make sure your help page(s) are returning plain text.)​

    If you create a file called HelpCenter/welcome.txt, it will be displayed to every user upon login. This is handy for displaying a message like "Type /help topics for a list of help topics." and so on..​

    If the file contains a specially crafted URL line (see below) then it will fetch the contents of a web page via the URL and return that to the player instead.​

    If the folder ./HelpCenter doesn't exist, it will be created when you first run the plugin.​

    Features:
    • Compatible with Craftbukkit running Minecraft 1.3x
    • Word-wrapping for those long lines of text
    • Dynamic: any changes to the helpfiles are reflected immediately to the players.
    • Directory traversal protection (trying "/help ../../../../../../../etc/passwd" will not work)
    • This plugin will support as many helpfiles as you can possibly create.
    • It can fetch web-based helpfiles via HTTP. :)
    • C o l o u r s ! (see codes below)
    • Default helpfile with randomly-chosen help item capability (otherwise will pass-thru the /help command if typed in without any arguments)
    • Helpfile redirection!
    Example help files:


    HelpCenter/spears.txt:
    Code:
    Spears are long and pointy. They can be used to stab things.
    You can also throw them or use them to roast hot dogs.
    ..will result in this when the player types /help spears:
    [​IMG]

    Here is an example of the text-wrapping feature. This is the help file I made:
    Code:
    The quick brown fox jumped over the lazy dogs. The quick brown fox jumped over the lazy dogs. The quick brown fox jumped over the lazy dogs. The quick brown fox jumped over the lazy dogs. The quick brown fox jumped over the lazy dogs.
    ..and here is the line-wrapping (it ended up being split into four separate lines):
    [​IMG]

    for web-based helpfiles, the format is a single line in the text file consisting of
    Code:
    [URL http://some.site.url.here..]
    e.g.: [URL http://bananas.are.nice] or [URL http://so.are.raspberries].

    If you want to make it so players can use the above example by typing "/help spear" as well, simply create a file called spear.txt and insert this redirection line:
    Code:
    [HELP spears]
    This way, you only need to update the original spears.txt to make changes to all linked helpfiles.

    Keywords (replaced by values) - If a help file contains any of the blue keywords listed below, they will be replaced by the following values, respectively:

    • %user% - Bukkit - player - The players name
    • %world% - Bukkit - player - The world the player is in
    • %health% - Bukkit - player - The players health value (0 = dead, 20 = full health)
    • %locx% - Bukkit - player - The players location X
    • %locy% - Bukkit - player - The players location Y
    • %locz% - Bukkit - player - The players location Z
    • %iteminhandid% - Bukkit - player - The ID of the item the player has in hand
    • %iteminhand% - Bukkit - player - The item the player has in hand
    • %isop% - Bukkit - player - Is the player an OP - "YES" or "NO"
    • %serveronlinecount% - Bukkit - Number of players currently on server
    • %serverver% - Bukkit - version of the server
    • %groups% - Plugin - Permissions - The list of groups to which the player belongs.
    • %prigroup% - Plugin - Permissions - The first group returned by Permissions to which the player belongs.
    • %helpver% - Plugin - HelpCenter - Version of the plugin
    Colour Codes:


    To use colours, simply add the following codes anywhere in the text file. They will be parsed out and replaced with the proper codes:​

    &0 = black, &8 = black (hi) = dark grey
    &1 = blue (lo), &9 = blue (hi)
    &2 = green (lo), &a = green (hi)
    &3 = cyan (lo), &b = cyan (hi)
    &4 = red (lo), &c = red (hi)
    &5 = magenta (lo), &d = magenta (hi)
    &6 = yellow (lo), &e = yellow (hi)
    &7 = white (lo) = light grey, &f = white (hi)


    Default Helpfile / Random Help Items:
    If you create a file called HelpCenter/HCdefault.txt (case-sensitive) it will display the contents when the player types /help without any parameters. You can also put multiple items, separated by #!HELP (on its own line) and the HelpCenter will randomly select one of the items and display it to the player when they type /help without any parameters. Otherwise, if HCdefault.txt doesn't exist, it will pass-thru the /help command and return the default Minecraft help text.​

    Example HCdefault.txt:

    Code:
    There are many help topics available. Please be more specific?
    #!HELP
    Help me Rhonda!
    #!HELP
    Here's a hint: /help topics
    #!HELP
    I'm sorry Dave, I can't help you.

    Installation:
    1. Copy the file HelpCenter.jar into your plugins folder.​
    2. Run the plugin at least once to create the HelpCenter/ directory.​
    3. Create your help text files as described above.​

    Download:
    Download The Plugin (JAR) v1.78 or..​
    Download The Plugin (ZIP) v1.78​

    Source is at Github ^_^​


    Older Versions (Why you'd want them, I don't know..)​

    Changelog:
    Version 1.78 13-Jun-2011 The_Nut
    • Fixed issue where long line without spaces was not displayed to user in console or ingame and caused the game to crash after a short while.
    Version 1.77 06-Jun-2011 The_Nut
    • Added additional key word replacement:
      %armor% - Bukkit - player - The players armor durability value (0 = none, 20 = full armor not damaged)

      Just a note, if you open up the .jar file you will see the README which is the change log and a player.txt file. The player.txt file is a sample help file with all the keyword replacements so you can see how it works.
    < 1.77:
    Show Spoiler

    Version 1.76 04-Jun-2011 The_Nut
    • Updated to work properly with permissions version 3.0+.
    • Fixed display of message on player login so it has proper line wrapping.
    • Tested and working well on my system CB 803 with permissions 2.7.2
    • Tested and working well on my system CB 818 with permissions 3.1
    Version 1.75 23-May-2011 The_Nut
    • Added more key word replacements (see list above)
    Version 1.73 10-May-2011 The_Nut
    • Add Javadoc, Cleaned up additional code.
    • Allow for HelpCenter to be used in console.
    • Fixed buildHelpFiles and buildPlugin commands to be more robust and consistent in building help files.
    • Added command helpp to pull help file information directly from the server's installed plugins.
    • Cleaned up internal code
    • Fixed line wrapping so it will not count chat color codes as part of the 60 char limit per line.
    Version 1.72c 05-May-2011 The_Nut, weasel5i2

    • Changed the colour codes to fit the accepted standard. I apologise if this broke all of your helpfiles!!
    • Incorporated changes by The_Nut (via Github merge)
    • Recompiled against latest recommended Craftbukkit build #740.
    Version 1.72 30-Mar-2011 weasel5i2

    • Recompiled against latest recommended Craftbukkit build #602.
    Version 1.71 21-Mar-2011 weasel5i2

    • Fixed a minor bug with the colour code parsing
    Version 1.7 18-Mar-2011 weasel5i2

    • Recompiled against latest recommended Craftbukkit build #556.
    • Added line-wrapping functionality for long lines
    Version 1.61 09-Mar-2011

    • Recompiled against latest recommended Craftbukkit build #522.
    • Fixed the CommandSender issues. Sorry about the inconvenience. :)
    Version 1.6 08-Mar-2011

    • HelpCenter folder now moved to plugins/HelpCenter. This should happen automatically. If you have an empty plugins/HelpCenter folder and all your helpfiles are in HelpCenter then simply delete the empty folder plugins/HelpCenter and restart the server and it should move it properly to the new location.
    • Complete rewrite of helpfile content handling.. Now nested help keys URL/HELP work properly (and infinitely, try not to make any infinite helpfile loops! :D)
    • Recompiled against latest recommended Craftbukkit build #493.
    Version 1.5 03-Mar-2011

    • Removed deprecated PLAYER_COMMAND code, replaced with the new onCommand() method.
    • Fixed /? to work the same as /help.
    Version 1.4 27-Feb-2011

    • Recompiled against Craftbukkit build 440
    • Added helpfile redirection capability.
    • Added informative console output error messages.
    • Now sends "No help found for ___." to player if an error occurs (malformed redirector/url formatting, file errors, etc).
    • Removed the need to add a space before the closing ] bracket. Both ways will work now. (e.g.: "[URL http://web.site/help.file]" and "[URL http://web.site/help.file ]" will both work)
    Version 1.31 24-Feb-2011

    • Removed stupidly long constructor and compiled against Craftbukkit build 432
    Version 1.3 15-Feb-2011

    • Fixed bug in which all PLAYER_COMMAND events were being intercepted and mishandled.
    Version 1.2 14-Feb-2011

    • Added colour capability (see codes above).
    • Added default helpfile random item capability per user request.
    Version 1.1 11-Feb-2011

    • Added web-based help fetching capability (see notes above)
    • Removed command case-sensitivity. Filenames must be in lowercase (excepting HCDefault.txt as described above).
    Version 1.0 10-Feb-2011

    • Created plugin.


    To Do:
    • Any suggestions? :)
    Please let me know what you think, if there are any issues or if it doesn't play nicely with the other plugins. It should, though. Also, it doesn't use any super-special classes, just the basic ones, so I'm certain this should work with most earlier versions of CraftBukkit. Suggestions are always welcome.


    --W5i2
     
  2. Offline

    Matt L

    k
     
  3. Offline

    Drakmyth

    Great plugin. I'm just starting to explore bukkit and its plethora of available mods and one of the issues I had with many plugins that add commands is that the /help is either missing or not very good. Now it's super easy to make my own!

    I did come across one bug though. For some reason although my welcome.txt file looks like this:
    Code:
    =====================
    = Welcome to Minecraft! =
    =====================
    
    You are playing on a private server.
    The current world is: Server Mod Test World.
    
    You can see the list of available commands
    by typing /help.
     
    The result in-game looks like this:
    Code:
    =====================
    = Welcome to Minecraft! =
    =======
    ==============
    
    You are playing on a private server.
    Th
    e current world is: Server Mod Test World.
    
    You can see the
     list of available commands
    by typing /help.
    
    Minecraft doesn't use a mono-spaced font, so I understand why the spacing is different (particularly with regards to the = signs lining up) but where are the extra line breaks coming from? Interestingly, if I then do a
    Code:
    /help welcome
    
    the welcome message is displayed perfectly. It only seems to happen when I connect. Color codes are carried across these mysterious line breaks though (I removed the colors from my file while trying to debug the error). Any thoughts?

    EDIT: Forgot to mention I'm running HelpCenter 1.5 with CraftBukkit git-Bukkit-0.0.0-493-g8b5496e-b493jnks
     
  4. Offline

    Matt L

    any update yet weasel on getting this fixed?
     
  5. Offline

    itsmethatswho

    I'd like to preface by saying how much I love this addon. It brings real organization to my server, something that I'm sure all server hosts really appreciate.

    However, I'm having a similar issue to the one Matt L is experiencing. The help messages have their sights set on a couple of my server's players. While we all get a kick out of spamming them in unison, I do miss my command lists :( There is no error message associated with it and it began when I updated to craftbukkit 493 and HelpCenter 1.5. If there's anymore information you think you might want please let us know.

    Thanks again for creating and updating this plugin!
     
  6. Offline

    Matt L

    BTW, it doesn't work with build CB440 either... even tried rick-rolling my server back to that and it didn't help :/
     
  7. Offline

    Gray

    Yep, I am having this issue as well. This is a great Help mod, no others really compare on the simplicity of setup and ease of use.
     
  8. Offline

    Matt L

    Agreed, hope an update comes out soon for this. About half of my server (not regular) players have left already... It is so hard to appease everyone, I swear...
     
  9. Offline

    Gray


    Tell me about it! I've stopped trying to cater to people and do things my way. Like minded people stay and the rest...well.

    Just hope this plugin gets updated soon. have to answer SOOO many questions instead of saying read /help some topic.
     
  10. Same problems here, I definitely love this plugin though!!! Easy setup and allows thorough help coverage (So many plugins) Especially when there are tools like voxelbox to explain along with minecart mania. Definitely diggin it. I would like to know how to initiate a player list, player names, and perhaps call on other information if you can think to implement it soon. Thanks for the hard work Weasel!!
     
  11. Offline

    Matt L

    looks like weas disappeared... :(
     
  12. Offline

    weasel5i2

    Sorry for the AWOL moment.. I'm currently rewriting the whole thing so that help tags can be nested if needed.. It's being a bit of a bugger though. I'll try and get a new working version up today :)

    EDIT: ok, it's updated and rewritten, though I didn't change anything in the onCommand function, so please let me know if the weird players glitch is still happening.
     
    HoppyDragon likes this.
  13. Offline

    HoppyDragon

    Good to hear it! Really looking forward to it.
     
  14. Offline

    weasel5i2

    I forgot to mention something important, but it's in the changelog now :)

    HelpCenter folder now moved to plugins/HelpCenter. This should happen automatically. If you have an empty plugins/HelpCenter folder and all your helpfiles are in HelpCenter then simply delete the empty folder plugins/HelpCenter and restart the server and it should move it properly to the new location.

    ..or you can move it manually :)
     
  15. Offline

    Gray

    First, love this plugin. Easy setup, makes helpfile management easy.

    Have a strange bug. Just upgraded to 1.6 and moved my HelpCenter folder to the plugins folder. Running Craftbukkit build 493.

    Whenever anyone uses any of the /help command it sends the output to the first person who logs in after a reboot. Nothing in the server.log
     
  16. Offline

    itsmethatswho

    Yep, it's still happening weasel :(
     
  17. Offline

    DontMakeWaves

    Sometimes the text goes to the next line only about half way accross. does that have anything to do with this plugin? I notice it mostely with the welcome message when I log on, but not when I type /help welcome.
    On a similar note, would it be possable to make text go to the next line on a space rather than in the middle of a word, or is that something we should bug Mojang about? Great plugin though; very... helpfull. Thanks.
     
  18. Offline

    weasel5i2

    OK, I'll investigate and fix that today. I'm probably enumerating the player from the sender incorrectly.. :p

    I thought about the line breaks as well, when I first created the plugin. Originally, the solution was to just format your help text files so they display in a nice way, but I definitely do have plans to make the plugin do this for you instead. This will go into the next version. :)

    On an unrelated note, I know that ejhopkins is planning to make a Bukkit port for Wild Grass, but I've already figured it mostly out and plan to release a Bukkit plugin soon which makes grass grow taller and flowers spread to nearby blocks.. Still experimenting though. And it requires a client mod in order to see the grass, but it's super pretty.

    --W5i2
     
  19. Offline

    Matt L

    any news as to getting the weird serving of /help to random players fixed yet? Sooo looking forward to it :)
     
  20. Offline

    HoppyDragon

    I think that was what he was referring to in the first sentence of his last post. Just be patient. :)
     
  21. Offline

    weasel5i2

    Okay, I think it is fixed now! Also updated it to build #522.
     
  22. Offline

    Gray

    YAY! Fixed, ty kind sir. Just tested on my server.
     
    weasel5i2 likes this.
  23. Offline

    DontMakeWaves

    cool, will that also fix the line breaks from being after only a few words in some random lines? This may only happen with the welcome message when logging in, but I'm not sure. I attached a screenshot.
     

    Attached Files:

  24. Offline

    Matt L

    Awesome! Thank you so much, patched yesterday and working all better.
     
  25. Offline

    lahwran

    I'd like to request that if it doesn't find a file with extension .txt, it looks for one with no extension. I hate the .txt extension :​​​​P
    Very nice plugin though.
     
  26. Offline

    Latros

    This would be perfect for my server IF (and I don't know whether or not this is the case) it hides the current /help?

    (Our current /help is just like 35 pages of admin commands)

    Does it override the other /help display and ONLY show your .txts?

    Lastly; is it memory intensive in any way?
     
  27. Offline

    Agnate

    It can override the main help (he has instructions in his post). Also, it's not memory intensive at all. You can even add a message to display when people log in (though the formatting is bugged just for the welcome message, which is a Bukkit issue, not this plugin). :)
     
  28. Offline

    lahwran

    omfg. this looked like a good plugin, but then I tried to use it and for some reason it failed to split my lines on newline.
    decompiled and found this:
    helpData.replace("\r", "");
    are you serious? YOU USED \r AS NEWLINE?
    this makes the mod useless to me. I will fix it and edit it the link here, but come on, seriously? dumbest mistake to break cross-platform I've ever seen.

    EDIT: god I just did the internet version of walking into a wall. that doesn't do what I thought it did at all, and it's obvious too. will edit again in a minute >.<

    EDIT 2: oh, I see what you did there. you deleted \r instead of properly dealing with it (replace("(\n\r|\n[^\r]|[^\n]\r)", "\n") probably, assuming java supports that regex).

    EDIT 3: ([^\r\n]\r\n[^\r\n]|[^\r\n]\n\r[^\r\n]||[^\r\n][\n\r][^\r\n])
     
  29. Offline

    dompie

    Hello weasel, the colored text thing did not work for me, so I looked into your code.

    In HelpCenter.java on line (about) 455 you wrote something like
    Code:
    if( wrapData.length == 1 )  {
        sendToPlayer( who, item, null, topic );
    }else{
        sendToPlayer( who, null, wrapData, topic );
    }
    
    Why? Because when I remove the if statement and just put sendToPlayer in it:
    Code:
    sendToPlayer( who, null, wrapData, topic );
    
    Then the colored text is returned. Did this happen by accident?

    Cheers
    dompie
     
  30. Offline

    weasel5i2

    I had put the cColour() wrapper function in the wrong places, but they're in the correct place now with v1.71 :)

    yeah, I basically stripped the carriage returns (just in case) and then worked the split via the newlines.. It's probably redundant and unnecessary, but you never know what kind of CR/LF formatting will be returned by a web server when fetching the help pages via http, which is the entire reasoning behind that.. :)

    Should I replace that part with the regex you provided above? It does seem to be a better approach.

    --W5i2

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 8, 2016
  31. Offline

    lahwran

    Assuming it works, that'd be good. I didn't actually test it, but it looks right.
     

Share This Page