Usage- Right clicking on a bookshelf opens a chest GUI. Players are allowed to put ONLY books inside. If anyone could make this, that would be awesome!
This seems doable. database could get a bit large and map editing like WorldEdit could cause "ghost blocks" but I think that could be worked around... Could be a bit tricky if someone decides to take it on, but it would be cool!
Even if so, it's nice to have plugins that don't contain all the features of another plugin. Some people may only want bookshelves and not the other features that come along with BookWorm
Man your going to have a bit of an issue. The itemstack returns that it is only a Written_Book. Man I didn't mean to knock your style, but I wrote it.
Actually everything works out fine as of now. You can write books, store them, retrieve them, continue writing, etc. The only place I'm having trouble on right now is dropping books when the case is broken, but it's more than likely an I-stayed-up-all-night silly mistake.
I'm not going to link the download but If your creating an inventory just get the contents and loop it while dropping Naturally. This may help though. https://github.com/deathmarine/BookAPI/
Well that's what doesn't work. I loop through it, dropping the books, but it seems when you drop an item, the tag isn't carried along with it. When I pick it up, the pages are missing, and if it was signed the title changes to "Written Book."
Huh I just checked this. I did find a work around. Get the minecraft handle from the itemstack, clone it, and spawn it into the minecraft world. Code:java Location loc = event.getBlock().getLocation(); Random gen = new Random(); double xs = gen.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; double ys = gen.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; double zs = gen.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; EntityItem entity = new EntityItem(((CraftWorld) loc.getWorld()).getHandle(), loc.getX() + xs, loc.getY() + ys, loc.getZ() + zs, ((CraftItemStack) item).getHandle()); ((CraftWorld) loc.getWorld()).getHandle().addEntity(entity);
So the plugin is out? I really liked this idea. But if you right click on the shelf should you make it say Bookshelf instead of chest. If it's possible
http://dev.bukkit.org/server-mods/bookshelf/files/2-book-shelf-v0-1/ If you break it (you probably will), just go into the folder, delete the BookShelf folder, (Or just Shelves.db) and restart. Then you can go ahead and break it again. Post all the bugs, I need a list of crap to fix. Here's a To-Do List, if anyone has some suggestions let me know. http://dev.bukkit.org/server-mods/bookshelf/pages/to-do/ I'm having a bit of trouble with more than one player accessing the same bookshelf. Custom Inventories don't have their own id's, so I can't save the inventory id to a database, so everyone has to make a new custom inventory. If someone adds items to an inventory of a bookshelf, closes their inventory, then another player who had the same bookshelf open closes their inventory, it overwrites everything, because one players inventory is different than the other. This could easily be solved by having both players access the same inventory, but like I said there's no way to save it, unless I use global variables which would mean anyone accessing any bookshelf would open the exact same inventory. That wouldn't work. Another idea would be updating each time a player adds an item to an inventory, but I can't find an event that will fire when someone adds items to an inventory. This would also require inventories to have ids. I noticed inventories have getName and getTitle, which return the exact same thing, and there is no setName or setTitle, otherwise I could use those as ids. Maybe I can make my own function for an id. Hmm. So basically, the issue is: Player1 opens bookshelf. Plugin makes a new inventory for Player1, and populates it with items in the database. Player2 opens the same bookshelf. Plugin makes a new inventory for Player2, and populates it with items in the database. Player1 adds a new book he spent forever creating. Player2 adds a different book that he spent no time creating. Player1 closes the bookshelf. Plugin gets Player1's inventory contents through a global variable, which means the contents are now Player2's inventory, as the variable was overwritten when Player2 opened the bookshelf. Player2 hadn't closed his bookshelf yet, so Player1's contents will be what the contents were originally in the database. Plugin deletes the old items from database and puts in the new ones, which happen to be the exact same, and Player1's book is gone forever. Player2 closes his inventory, and the database gets his contents, deletes the old items, and puts in new ones. Player2's book was saved, but everything else is gone. Big problem, I have no solution. Basically I need to be able to save an inventory instance to the database. Edit: I came up with an idea of how to make this work, but I don't know what to use. If anyone knows of something like what I'm talking about, let me know. My idea is that I could save all the variables I need into a code block type of deal, like: CodeBlock blah = new CodeBlock(inventory, x, y, z, name, player, blah, blah, variable); int id = blah.getId(); sqlite.query("INSERT INTO table (id, x, y, z) VALUES ("+id+","+x+","+y+","+z+");"); Obviously this is pseudo code and will never work, but my idea is that I could save the variables in a code block, which has an Id, and I can retrieve the code block by it's id, which would return it's variables. EDIT by Moderator: merged posts, please use the edit button instead of double posting.