[MECH] IOBookcase v1.32 - Allowing users to read/write to bookcases [766]

Discussion in 'Inactive/Unsupported Plugins' started by lonelydime, Feb 24, 2011.

  1. Offline

    lonelydime

    IOBookcase - Lets users read and write to bookcases.

    Version: v1.32

    This plugin makes normally useless bookcases somewhat useful! You can write up to 5 lines per bookcase to display to users who walk by and right click them.

    Commands:
    • No commands, it's all done in game!
    Requirements:
    • The sqlitejdbc-v056.jar file needs to go where craftbukkit is (one directory above plugins).
    • Permissions 2.0 or GroupManager are optional, but it's a good idea to have one.
    Quick Links:
    Install:
    • Upload the directory structure into your root minecraft directory (where craftbukkit is).
    Use:
    • Place a bookcase where ever you'd like to put it.
    • Grab a sign and place it on the bookcase.
    • In the top line, write @line # [color].
      • # is the line number, 1-10
      • [color] is optional, it can be black, navy, green, blue, red, purple, gold, gray, rose, yellow, white or the corresponding color number (dark and light color strings are too long).
    • Finish writing your text in the last 3 lines and hit enter.
    • Right click your bookcase and see your text!
    Importing from file:
    If you choose to import from a file, you can create or edit the file plugins/IOBookcase/import.txt (The file will be created when you restart your server). The formatting of this file is very important, it's not fully functional XML, but it mirrors it. Keep that in mind. Here is an example of this file properly formatted:
    Show Spoiler

    <case name="case1">
    <line num="1" color="red">
    this is text for line 1
    </line>
    <line num="2" color="green">
    this is text for line 2
    </line>
    <line num="3">
    this is text for line 3
    </line>
    <line num="4">
    this is text for line 4
    </line>
    </case>
    <case name="case2">
    <line num="1">
    this is text for line 5
    </line>
    <line num="2">
    this is text for line 6
    </line>
    <line num="3">
    this is text for line 7
    </line>
    <line num="4">
    this is text for line 8
    </line>
    </case>

    Please note in the example, the line breaks. In real XML you can do <line num="1">text</line> all on one line, here you can't. Keep the line breaks. The tabbing is just for readability, it's not required.

    The num parameter for <line> is required, color is optional. If your color is coming out white if you specified a color, it doesn't understand your color choice. Please use black, navy, green, blue, red, purple, gold, lightgray, gray, darkpurple, lightgreen, lightblue, rose, lightpurple, yellow or white.

    Finally, to import in game place a sign on the bookcase. Line 1 needs to be @import. Line 2 needs to be the case's name specified in the import.txt file (in the above example of import.txt, case1 and case2 are valid names). Lines 1-10 are accepted, any more then you will get an error.

    Permissions or GroupManager:

    Code:
    iobookcase.canread - for groups that can read bookcases
    iobookcase.canwrite - for groups that can write to bookcases
    
    Todo:
    • Experimenting with opening the sign dialog without having to place a sign.
    • If a bookcase is destroyed, drop a bookcase.
    • Add noteblock triggering lines.
    • Make 'bookcase is empty' message configurable.
    Changelog:
    Version 1.32
    • Fixed the player interact bug causing errors on left click.
    Version 1.31
    • Replaced depreciated methods to work with CB602.
    Version 1.3
    • Added option to import cases from a text file
    Version 1.2
    • Increased bookcase lines to 10
    • Fixed color being mandatory, it's now optional as designed.
    • Removed spaces between lines.
    Version 1.1
    • Added optional GroupManager support.
    • Added colored text.
    Version 1.0
    • Public Release
     
  2. Offline

    fullwall

    Can you get rid of the sign once added to the bookcase?
     
  3. Offline

    lonelydime

    The sign disappears and appears back into your hand once it has been "entered" into the bookcase.
     
  4. Offline

    Daveyo

    Nifty.
     
  5. Offline

    RioS

    Can you add chat color support ?

    I thinking to a syntax like that:
    [Line 1] #DARK_RED
    lorem ipsum

    But if you got a better idea, just do it !

    PS: org.bukkit.ChatColor
    PS2: player.sendMessage(ChatColor.DARK_RED.toString() + " something in dark red");
     
  6. Offline

    lonelydime

    I can do that.

    PS. You actually don't need the .toString(), it's just sendMessage(ChatColor.DARK_RED+" something in dark red"); :)
     
  7. Offline

    Emalde

    Now our player libraries can contain stories. Thanks for the plugin!
     
  8. Offline

    Slice

    Screenshots please?
     
  9. Offline

    lonelydime

    Updated to support GroupManager and colored text inside cases.
     
  10. Offline

    person

    im not quite sure what this means but if u could help thanks it sas this

    ( [info] read: java.sql.SQLException: no such table: bookshelf )

    well thats what it sas plz help my server could realy use this awesome plugin
     
  11. Offline

    lonelydime

    For whatever reason the table wasn't created. Delete plugins/IOBookcase/bookcase.db if it exists and restart your server. Look for errors on server startup.
     
  12. Offline

    Juze

    Nice replacement for CraftBook. :)
     
  13. Offline

    DigidragonZX

    Does it work without groupmaneger/permissions just so everybody can do it?
     
  14. Offline

    Juze

    I don't know, but it may be that this plugin has a really bad memory leak in it or something, crashes my server randomly.

    EDIT: Nevermind, it was #447.
     
  15. Offline

    lonelydime

    You betcha
     
  16. Offline

    ark3typ3

    [Craftbukkit 443]

    2011-02-26 08:13:26 [SEVERE] Could not pass event SIGN_CHANGE to IOBookcase
    java.lang.ArrayIndexOutOfBoundsException: 2
    at com.lonelydime.IOBookcase.BioBListenerEvent.onSignChange(BioBListenerEvent.java:99)
    at org.bukkit.plugin.java.JavaPluginLoader$27.execute(JavaPluginLoader.java:262)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:225)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:842)
    at net.minecraft.server.Packet130UpdateSign.a(SourceFile:39)
    at net.minecraft.server.NetworkManager.a(SourceFile:230)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:70)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:338)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:253)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
     
  17. Offline

    person

    still have the same problem as before i even tried running a server with only that plugin and it gave me the same error not sure whats wrong though
     
  18. Offline

    Neox301291

    i have no errors but when i place a sign on the top of the shelf and type in the first line @line 1

    and then the message in the last 3 lines the sign stand on the bookshelf an nothing happens the same when i place ist on the side o the shelf pls help i need this Plug for my rpg server
     
  19. Offline

    lonelydime

    Do you have the sqlite jar in the craftbukkit directory?

    The signs only work when placed on the bookcase, like you put it on the wall. Either the N, E, S or W side of it. Not on top.
     
  20. Offline

    Neox301291

    ok when i place a sign on the side the concole says

    2011-02-27 02:43:04 [SEVERE] Could not pass event SIGN_CHANGE to IOBookcase
    java.lang.ArrayIndexOutOfBoundsException: 1
    at com.lonelydime.IOBookcase.BioBListenerEvent.onSignChange(BioBListe
    Event.java:97)
    at org.bukkit.plugin.java.JavaPluginLoader$27.execute(JavaPluginLoade
    ava:262)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.
    a:59)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManage
    ava:225)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:821)
    at net.minecraft.server.Packet130UpdateSign.a(SourceFile:39)
    at net.minecraft.server.NetworkManager.a(SourceFile:230)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:70)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:338)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:252)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
     
  21. Offline

    Threore

    First of all, thanks for this awesome mod, now my library is useful! I have three suggestions for you to make it, in my opinion, even better:

    1) Could you make it so that you can write one word over multiple sign lines without getting spaces put in the middle?
    2) Could you change the 5 line limit? It's already a lot more than signs but more is always better :D
    3) Could you create an easy way to delete the text of a bookcase?


    Not sure if the first was clear so I'll give an example. I'm writing a small part about the founding of my nation called Westwind, what I wrote in the sign was:
    @line 2 gray
    Westwind was fo
    unded in the ye
    ar 3045 by Lord

    the output gave me:
    Westwind was fo unded in the ye ar 3045 by Lord

    I wanted:
    Westwind was founded in the year 3045 by Lord

    I did not put those spaces there, and not having to fit each word completely on one sign line would allow me to write a lot more in one bookcase.
     
  22. Offline

    Neox301291

    i dont know why but know it works hmm..
     
  23. Offline

    lonelydime

    The magic of bukkit and its many versions haha.

    1) I put the spaces in beween the lines because it made sense to me, I can remove them no problem.
    2) I could, how many were you thinking. There always has to be a hard limit :)
    3) Right now the only way to delete is to overwrite. If you wanted to get rid of line 4, just place a sign on the bookcase saying @line 4 and nothing else.
     
  24. Offline

    Threore

    1) Look at it like this, words are on avarage around 5 characters long. Including the space after it that is 6 different places where a sentence could be cut off by the sign limit. Of these places the only one where a forced space would be useful is when the sentence is cut off exactly at the end of the word. There it would allow you to write 1 more character than otherwise. In 1 other case the resulting amount of usable characters is the same, in the the other 4 cases there are less usable characters, ranging from 1 to 4 less, for a total of 10. So no spaces decimates the amount of unusable characters. So even though replacing returns with spaces seems logical, in the end it just costs a lot of space.
    tl;dr, or unclear explanation:
    Spaces seem logical but cost a lot of characters, of which there aren't much on a sign.

    2) Well, 10 is the maximum amount of lines displayed when not in chat, 20 when in chat. Anything above 20 can't be read so making it higher than that would be useless. 20 lines itself is hard to finish before something else is displayed in chat, but we don't _have_ to make each text that long.

    3) okay :S

    and something else...
    4) [color] doesn't seem to be optional. I don't know if we're running an outdated version of bukkit or something, but when I don't specify a color the sign just sits there.

    While using it I've thought of some other things. Basically these are ways to make writing stuff for bookcases easier.

    5) make a shorthand version of @Line # [color] that's like @l # [color]. Saves a bit of typing when filling a library

    6) let text be imported from and written to a text file (or anything else I can edit in notepad), which can then be used and reused elsewhere, working approximately like this:

    bookcaseTexts.txt
    then let us add these to bookcases with a sign saying @use [number]

    and if you can do that, maybe you can also create a command like
    /book [text number] [line number] [color] [content]
    and
    /book add
    to add a new text number

    you could keep using your bookcase.db the way you do now, and just edit it from the new bookcaseText.txt file with these commands.

    If you could implement this it would make this awesome plugin even better :)
     
  25. Offline

    lonelydime

    Removed forced spaces between lines, added a total of 10 lines per case (it will add them when you restart your server) and fixed the color field being mandatory bug.

    The shorthand I want to back off of since it looks at line 1 of your sign and checks to see if @Line is there. If someone was doing something unrelated and did @lol, it would try and create a case for it. Granted not a lot of people place signs on bookcases, but it's neater this way.

    Importing from a text file would be tricky since you would have to know the location of the bookcase (that's how the database knows what text to pull). I could write some form of import on server start, but it may get messy since people could create cases at locations where cases don't exist because they misjudged where the case is. The same problem comes from using a command line.
     
  26. Offline

    OrtwinS


    I fully agree with this, for me color isn't optional either and writing books and tutorials in a text file and importing them ingame would be GREAT.
     
  27. Offline

    lonelydime

    Update to 1.2, fixes colors.
     
  28. Offline

    philaiasi

    Hi all!

    Really a great plugin to make bookshelfs functional!

    Agree, but you can do it right now with a sqlite database editor(for example this one)!
    Thats not easy as it would be with a textfile but it works.
     
  29. Awesome plugin. Thank you for creating it.
     
  30. Offline

    Reconnoob

    Great Plugin :D The Owner of the server Threore is a Admin on :D
     

Share This Page