[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


    Im 100% positive its easier said then done...but can you add a gui when you right click the npc, maybe something similar to opening a chest?
    oh 1 more sugestion can you include the addition of using an infinite (-1) block to stock your npc's I don't use this to sell things to other players more of a shop everyone uses and no one gets the money...
  3. Offline


    IT sounds like you are using a newer bukkit build that iConomy is not compatible in.
  4. Offline


    This is because right now this plugin only works with build 313, I believe.
  5. Offline


    GUI's are client side things for now, meaning the server has nothing and can do nothing with GUI unless the actual client itself has a way to handle it. Once Mojang changes the client to use server side stuffs then it could be done, until then no. What I am going to do is have the /npc list come up on right click in the next version. I am also going to do a PHP based interface so you can do it from a website, but don't expect that too quickly, that is down the road.

    Also in the next version is going to be permissions support and admin commands, I will include admin commands to turn an NPC into an Infinite stock NPC.
  6. Offline


    That would be great. Hoping you get down to work on this! Great idea! Isn't it possible to have different skins, just have it within the server or something that pulls it up?
  7. Offline


    If opening a chest/dispenser window is impossible from server's side, then perhaps you could use the player's inventory for trading? For example, replace the bottom hotbar with the trader's stock for as long as the player's right next to the NPC. Also, think it would be possible to add an option to sell stuff by dropping at where the NPC's standing?

    Skins are client-side and depend solely on the player's nickname, so you can name an NPC as another player is called and he'll show up with that player's skin. As far as I know this is the only way to do this at the moment.
  8. Offline


    I could invoke the chest/dispenser windows, for now do to complexity of it I will put it on my down the road consideration list.
  9. Offline


    with this next version, could you include a configurable limit on how many npcs a group can create? thanks
  10. Offline



    Any chance of getting Total Global Prices as an options maybe even dynamic prices such as this plugin does http://forums.bukkit.org/threads/econ-simplemarket-v-0-4a-dynamic-price-shop-plugin-326.3266/

    Maybe even make it a seperate NPC or something so you would have a choice to make a static price NPC going off ur own price list or a NPC that would get prices that come from a GLOBAL list, Perfferable Global be default in the config as well.

    I have a couple of other ideas as well
    Expanding Messeges " I no doupt assume u will be bringing back" to full blown conversations based on choice selection of maybe it can be an optional extra plugin to have npcs speak like quest givers if there is not a plugin already doing this.

    My last idea is to get NPCS to be wearing any type and combination of armor to spice up not only there looks but also to help make them more noticable.
  11. Offline


    If this was compatible with the Permissions plugin, that would be great. But I'll let you decide.
  12. Offline


    I would love to have permissions as well. Many thanks!!!
  13. Offline


    Been checking this thread the last couple of days, hoping for SQLite :) god I want this plugin bad! Installing MYsql on virtual Linux host gave me migraines
  14. Offline


    Permissions support will be in the next release.
  15. Offline


    I'm gonna try this tomorrow. If this works, it'll be the best thing since sliced bread!
  16. Offline


    Haven't installed this yet, but my past experience with NPCs is their name viewing distance was vastly too large. How does this plug handle the viewing distance of the NPC name created overhead? If it is similar to the plugin of old, Craftizens, and the distance is as long, can the code written in a way to limit visibility? (My old Spawn Town had about 15 NPCs and the yellow text was blistering!)
  17. Offline


    Found a typo for you bud... [​IMG]

    Should be "You now have a fully setup and functioning NPC"

    And a few questions...

    1. Can you have multiple NPCs? (one player)

    2. Is this only for OPs until permissions support comes out?

  18. Offline


    I believe name visibility is handled client side, nothing can be done about it for now.

    Yes you can have multiple NPCs and the current build lets anyone.

    As a note for those wanted SQLite...

    I found another similar type of DB called Apache Derby. It is a lot like SQLite in that it is very portable (Only has a 2.6mb footprint, SQLite has a 1mb footprint.), if it works then I will use that instead of SQLite. Using it would just be a matter of plopping a jar in your main minecraft directory and setting up your condig.yml to tell it to use it.

    I should have Version 1.0.0 out in the next hour or two. This will include full permissions support, a much better handled error returning in-game, MAYBE Apache Derby option, Working Greeting and Goodbye messages, /npc list will show when right clicking on NPC, a few bugs I found while re-organizing the code, possibly some new bugs :).
  19. Could there be an option to set unlimited stock for the npc?
  20. Offline


    Apache Derby would be nice, and I would install it right away. Hopefully it will work :)
    SQLite can have its issues too...
  21. Offline


    Too tired to finish this tonight, I will have the next version out tomorrow, possibly with derby support... It does not support if not exists on table creations, but I can get around that.
  22. Offline


    You didn't fix the typo? Haha I know I'm annoying...

    But anyway couldn't that kind of enable NPCs as use of spam?

    Permissions support coming anytime soon? [​IMG]
  23. Offline


    Hey all,
    this plugin looks perfect, but everytime I try to create an npc I just get the message "Null"
    I think this has been asked before, but most of the answers are in techno-jarble and I understand none of it, sorry for
    being redundant but I really want this plugin to work, could anyone give me a hand?
    Please and thank you
  24. Offline

    Evan Melvin

    So I'm running 313, and every time NPCTrader tries to call on iConomy during server startup, it hangs. I get no errors, just "NPCTrader version 0.94: found iconomy". I've tried updating CB, rolling back CB, etc. If I remove NPCTrader, the server starts fine.

    Any suggestions?
  25. Offline


  26. Offline


    I don't know if this would be possible, but when a player is in sneaking mode his name cannot be seen through walls and the distance of viewing the name decreases. (Minecraft Wiki)
    Is it possible to let the NPC sneak? Sure, it will look silly when all your NPCs are bending down... But its better than nothing ;)
  27. salut lors de la creation du npc ca me marque "DATABASE failure trying to add NPC" ce probleme vient d'ou ?

  28. Offline


    I have my minecraft server hosted on a VPS (Provisionhost) and I don't know how to set up mysql on that. I do however have a web host, and I can (and have) set up mysql databases on that. My problem is how do I link the database on that server in the config file?

    Database: "jdbc:mysql://localhost:3306/minecraft"
    User: "user"
    Pass: "pass"
  29. Offline


    Replace "localhost" with the url of your MySQL server and add your minecraft server as a host in the MySQL configuration.
  30. Offline


    What I''ve done is tried the domain, and also the server IP for the localhost part. That didn't work. I'm unsure what you mean by minecraft server as the host. I have access to cpanel on the server the Mysql is on.

    Ah wait, need to add the server on the Remote Database Access Hosts
  31. Offline

    Gene Myers

    how would i go about setting up a remote mysql data base.. i have a website where i can create unlimited databases.. but i rent my server from jestservers its on a VPN they dont support mysql.. they told me to set up a remote mysql.. not sure how to make this work?
    --- merged: Feb 16, 2011 6:27 PM ---
    Also if this is possible, I am very willing to give out remote databases to whoever needs them!

Share This Page