[ECON] NPCTrader v1.1.4 - The Full featured localized shop system [RB740 - 766]

Discussion in 'Inactive/Unsupported Plugins' started by MatCat, Feb 13, 2011.

  1. Offline


    NPC Trader - The Full featured localized shop system

    Version 1.1.4 (Testing Version!)

    The first localized full featured shop system for Bukkit/iConomy, in NPC Form!

    What's better for a localized shop system then your very own NPC Clerk / Teller / Worker / Slave / Whatever word you want to call your NPC!

    • Localized system
    • Fully player controlled (No admin intervention needed)
    • Full Item and Metadata support (Colored wools, etc)
    • Item name or ID recognition
    • Partial name recognition (If online)
    • Complete internal permissions system for managers of the NPC
    • iConomy Based
    • MySQL data storage
    • Item stocking system
    • In-Game help for everything
    • Supports Permissions and GroupManager (Using FakePermissions) Plugins!
    Installation / Setup

    1. Put NPCTrader.jar in your plugins folder
    2. Put mysql-connector-java-bin.jar in your main minecraft folder
    3. Restart your server (Auto-generates config.yml in plugins/NPCTrader/)
    4. Edit the config.yml for MySQL and other config settings.
    5. Restart once more
    6. Enjoy!
    If for some reason the folder / config does not auto-generate, then you can open the .jar file with 7zip or winzip or other archiving utility that supports jars and extract the config.yml from the jar.

    NOTE: If you do not have or do not know if you have MySQL setup then you either have to setup MySQL or not use this plugin for now. Please do not post questions asking how to install MySQL as that is outside of the scope of this post. You can follow this tutorial (Thanks @Germata!) for detailed windows installation and setup, but I cannot provide support for installing and setting up MySQL, only support for my plugin specifically.


    Permissions will only be used if it is installed. The following is the permissions list:

    npc.admin      - Give to admins for full access to all NPCs
    npc.admin.list - Access to /npc list npcs
    npc.user.*     - General user commands, you can specify by replacing * with command name, I.E. buy
    npc.manager.*  - NPC Manager commands
    npc.owner.*    - NPC Owner commands
    npc.create     - Ability to create an NPC 
    If permissions is used you may also specify limits on how many NPCs a specific player or group may have ownership flag on, please see config file for more information.


    Once the plugin is installed and running, you can see the in-game help by typing /npc in your chat window. To interact with an NPC just right click on it first.

    Here is a simple tutorial for setting up an NPC named Bob that sell's bread, cooked fish, and cooked pork, and buys wheat, raw fish, and raw pork.

    1. Stand exactly where you want your NPC, including head position and body rotation.
    2. Type: /npc create Bob 6 10 This will create the NPC with 6 Item Slots, each holding 10 units.
    3. Right click on the newly created NPC
    4. Type: /npc setup 1 bread 1 2 0 true false This will setup Slot 1 with Bread, selling lots of 1 at 2 Coins, buying them from players at 0, True for NPC Selling it, False for buying from players.
    5. Repeat step 4 for Cooked fish and Pork
    6. Type: /npc setup 4 wheat 64 0 10 false true This will setup Slot 4 with Wheat, buying lots of 64 at 10 Coins. This one is set False to selling it to players, but true to buy from players.
    7. Type: /npc stock 1 20 This will stock the NPC with 20 breads on slot 1 (Assuming you have enough bread).
    8. Repeat step 7 for raw fish and pork.
    You know have a fully setup and functioning NPC.

    Known Issues / Bugs

    • Config folder does not get generated on Linux - Works on Windows
    • Cookies and beds, and pretty much any other 1.4/1.5 items.
    • Spams console when you stand close to an NPC
    • Gives error when an NPC is spawned (Can be ignored)
    • Head / Rotation is not being properly set on spawn / move. (Fixed in 1.14)
    • Does not work with actual permissions (works with GroupManager)
    • Rename command is broken
    Things Todo

    • Re-write item handling
    • Support for both GroupManager and Permissions
    • iConomy 5 Support
    • Add armor capacity
    • Tie into WorldGuard for checking for build rights (Will be optional)

    If you installed MySQL for Windows just to run this plugin then check out this link to see how to create the initial minecraft database you will need.

    *** NOTE: SQLite IS NEVER GONNA HAPPEN! If you want to see an alternative, fork the src, make it work as an option, and I will include it in.***

    • Version 1.1.4
      • Changed out item name / id handling system
      • Now supports all current official items
      • Fixed Move Bug
      • Fixed NPC Creation Errors
      • Fixed a few other errors
      • Fixed Config creation on linux (hopefully!)
    • Version 1.1.3
      • Completely rewrote most of the code that directly interfaces with the NPC Library.
      • Now uses chunk loading/unloading to make sure only NPC's in loaded chunks are loaded (Way more efficient)
      • Changed banker command to only allow setting yourself as banker (to stop an exploit situation).
    • Version 1.1.2
      • Fixed upgrading stack counts for free bug
      • Fixed rename command not working on linux
      • Made it so an NPC must have 1 item slot to be created
      • Added permissions support for owned npc limits (By group or player)
    • Version 1.1.1
      • Fixed issues with quantities of '0'
      • Added rename command
      • Fixed iConomy hooking on startup
    • Version 1.1.0
      • Fixed Admin Override Permissions not working
      • Added Half and Double Slabs
      • Updated to work with B612+
    • Version 1.0.9
      • Updated to work on B531+
      • Updated to work with iConomy 4.*
      • Much needed overhaul of error handling and disabling procedures.
      • Converted integer based money to decimal based.
    • Version 1.0.8
      • Updated for newer builds
    • Version 1.0.7
      • Fixed more issues with ItemData, hopefully they are fixed for good.
      • Added log names
      • Added Coal/Charcoal distinction
      • Order of slots listed will always be in ascending order
    • Version 1.0.6
      • More meta-data issues, resolved.
    • Version 1.0.5
      • My restructuring of the code to try to support SQlite completely foobared the connect and close code, causing timeouts and errors. Fixed it.
    • Version 1.0.3
      • Fixed buy/sell/stock/unstock to use absolute values so that negatives cannot happen.
    • Version 1.0.2
      • Fixed bug where db connection was closed on /npc create
    • Version 1.0.1
      • Fixed bug with null Item Datas
    • Version 1.0.0
      • Fixed many many bugs
      • Added /npc list npcs as an admin command to let you see a full list of NPCs
      • Added recording transactions.
      • Added full permissions support
      • Better error handling and message delivery.
    • Version 0.94
      • Fixed not checking stock when doing /npc setup
      • Made the setup's error messages way more intuitive
    • Version 0.93
      • Fixed disappearing NPC bug.
    • Version 0.92
      • Fixed bug where selling was not checking player inventory.
    • Version 0.91
      • Fixed bug where giving improper arguments for upgrading and creating reported iConomy and NPC Trader out of sync.
    • Version 0.9
      • Initial Release
    You can download the jar here.

    You can download the mysql connector jar here.
  2. Offline


    awesome plug in... really excited for the next update!

    keep up the good work.
  3. Offline

    Evan Melvin

    Just an idea, it'd be nice if the NPCs could be set to auto-restock on intervals. I'd like to set up some shops on my server, and I don't want players running any. It'd be nice not to have to restock everything manually.
  4. Offline


    Ok I found I was using the wrong server IP... found my mysql server IP. But now, when I try to start myserver... it gets to "NPC found iconomy" or whatever and then putty stops doing anything for 5 minutes and the server crashes.

    NPCTrader version 0.94: Found iConomy
    NPCTrader version 0.94: Found iConomy

    stuff it... give up on this crap til you get sqlite
  5. Offline

    Evan Melvin

    And what port are you trying to connect to on your mysql box?
  6. Offline


  7. Offline


    My plugin should not have any comptability problems at all with sign lifts, if there is a problem please show the errors.
    --- merged: Feb 16, 2011 8:45 PM ---
    I wasn't ignoring you :p I will look into the armor bit, as far as conversations and such go I will do a separate NPC plugin for non-shop based functionality.

    For global pricing I am not going to be able to get that in this next release but maybe soon.
  8. Offline


    Waiting for the next update... tell me when you get it done, so I can update bukkit again to the latest build. :D
  9. Offline


    This mod is great! I've used the hMod NPC v4 mod before and one of the things I liked about it was the NPCs were always looking at you when you interact with them. Is that something we can see in the future with this mod?
  10. Offline


    The only thing holding my plugin back from going past 313 is iConomy, it need's to be updated, until then there is nothing I can do about it, my plugin is compatible with the newer builds but iConomy is not.

    I am also going to be working on a non-shop based NPC plugin, and when I get onto that I will be looking into having NPC's move, look around, etc.
  11. Offline


    Wait, what? I'm using iconomy on my server running 326 and it's working just fine.
  12. Offline


    Version 2.2b?
  13. Offline


    Yeah. Can you tell me what specifically isn't working?

    I only just started using it for iMonster as a framework for the future economy, but I'm getting my 1 currency per kill just fine.
  14. Offline


    So iConomy got updated already? Gonna have to try it out with the latest build...
    --- merged: Feb 17, 2011 2:04 AM ---
    Works with latest build of craftbukkit with iConomy 2.2 on b328. AWESOME.
  15. Offline


    please make a full guide to install mysql and get it setup, database failure:[
  16. Offline

    Phantom Index

    Shinfo, It's very easy to do this.
    If you know the name of your database for MYSQL then do this.

    Database: "jdbc:mysql://localhost:3306/minecraft" <---- Replace "minecraft" with Database name
    User: "user" <--- Username you use to log into the MYSQL
    Pass: "pass <-- and of course the password.

    You should ask me for help more often.
  17. Offline


    As far as MySQL goes if you install it on windows it will default to be username of root with whatever password you set for it. Then you can checkout this link to see how to create a minecraft DB.

    As a side note on Version 1.0.0, It's nearly complete. Sorry but I could not get SQLite to work for it just yet. Actually SQLite does work, BUT it gives db lock errors because it can only handle 1 connection at a time, so unless I can figure out how to get it to not lock up I don't see it working. I have tried 10 different other embeddable SQL systems and cannot get any of them to work properly. But I haven't given up yet on it.
  18. Offline


    Hey, so I'm trying to sell Lapis Lazuli with an NPC on my server, and the functionality is working, but in the npc list it says ink_sack. I looked through items.db and it looks like there's no specific names for items with metadata. Is this being planned? Because I'd like to sell this Lapis and it's a lot more rare than the ink sack. I'd like to offer people a little more confidence than saying that it really will be lapis lazuli =)

    Thanks for the awesome plugin by the way. My players and I love it!
  19. Offline


    i still have no idea how to set up the mysql data base as the mysql 5.5 i downloaded does not have a cmd line client to use as per instruction says, can anyone help me?
  20. Offline


    I will look into that. All ink's use the same item ID but have different names making it rather confusing and honestly I did not think of it. But I will fix it for release 1.0.0.
  21. Offline


    Also, I don't konw if you're looking for new ideas, but an interesting thought I had would be to log all the transactions in a table in the database. That way you could analyze them to get actual market prices on a server for every item.
  22. Offline


    This is already going to be in the next release of Version 1.0.0! I am actually programming it right now.
  23. Offline


    Smart arse :p
    Obviously I did that. Curious, you're set up with provision too right? Did you manage to set up a mysql server on there or use an external?

    I'm trying to use an external, all properties are right (mysql ip, database name, db user & pass). But as I said, NPC crashes my server before it even launches now. Frustrating.
  24. Offline

    Phantom Index

    Hmmm we switched out from provisionhost. So no.
  25. Offline


    Ah ok. Where'd you move? Any better?
  26. Offline


    Does it support flatfile?
  27. Offline


    Uh.... WOW.

    This sounds awesome. Downloading now- you're gonna be the first plugin I put on my public server that I didn't write since hMod ;)
    --- merged: Feb 17, 2011 3:32 PM ---
    Oh, hey, just read the OP- I'd love to help you with your SQLite issues! :D

    I shut down my MySQL server when hMod died... I'm not super ready to fire it back up yet :)

    If you have github source, I'd be happy to take a peek.

    I'll also PM you and see if I can maybe just answer a quick question to get you going. SQLite shouldn't be doing anything too strange on you, at least in terms of SQL parsing....

    Also: consider Persistence :)
    --- merged: Feb 17, 2011 3:37 PM ---
    Man... want this for my wand/spell shop so bad...

    Oooh, and I guess, technically iConomy will have to be the first plugin I install ;) Ah, dependencies...

    Can I just have him give away stuff for free? I really just want the NPC, and his ability to give people items- not so much make people pay for them :D
  28. Offline


    Is there an easy way to customize the skins for NPCs? Would be nice if this was possible (even as a future update). ^_^

    I'm eagerly waiting to get this on my server!
  29. Offline

    Phantom Index

    Web-Mart.me, it's pricey though. end up paying $60
  30. Offline


    It's actually completely impossible to do, sorry. Skins are a completely client-side thing and modifying the server in any shape or form won't change that.

Share This Page