[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

    MatCat

    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!

    Features
    • 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

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

    Code:
    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.

    Usage

    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)
    Misc


    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.***

    Changelog
    • 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. EDIT: Fix'd nvm
     
  3. Offline

    Hoddie54

    I'm assuming you'll never use SQLite then...?

    Sorry, I just really want to use this plugin but MySQL is just too much of a hassle for a small server like mine.
     
  4. Offline

    QQCucumber

    Read, he says he's going to try to implement SQLite again later after he reorganizes his code.

    You don't want to be welcome in the bukkit community for very long, do you?

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

    Daveyo

    qq
     
  6. Offline

    Schmogel

    Just explain where your problem is and you'll get help. A lot of people are happy with MatCat's work. Its not perfect yet, but its a useful NPC trader.
    Btw, its awesome to have notch, deadmau5 and Herobrine on your server :D
     
  7. Offline

    ToitagL

  8. Offline

    Plyz

    Sorry to say it but this just made my day, even though it was a stupid and lame comment.

    And anyone got a fix for the npc trader getting like 4096 cobble even though i only have 1 stack ? ^,-
     
  9. Offline

    DerET

    Tested and signed...
     
  10. Offline

    QQCucumber

    Are you using 0.94?
     
  11. Offline

    Codisimus

    I would like to get this running on my server but i have a few questions. This needs MySQL correct? its not optional? and will installing MySQL effect my other plugins? and does iConomy have to be using MySQL as well?
     
  12. Offline

    eafef

    can you make the NPCs talk? Or just trade?
     
  13. Offline

    MatCat

    Ok a flurry of stuff, not sure what all the admin edited stuff is about...

    My plugin for the moment uses MySQL, yes iConomy can use MySQL but it's setup is independent, my plugin just implements iConomies own built in API to do money stuffs, so you could have your iConomy setup for SQLite, MySQL or Flatfile and it will make no difference, it will work with iConomy in any of it's configurations.

    Now as far as global pricing, I designed this for my server with a realistic modal of player driven economy, I hated the idea of sign shops or trader shops set on fixed pricing because it cripples any capacity to have a player driven economy at all. On my server the iConomy currency is backed by a Gold standard, where one gold ingot is worth 20 iConomy currency, other then that no admin or server shop exists for anything but gold exchange. This is why I never put permissions on who can create an NPC, because it was originally designed for my servers econ setup of player driven economy.

    Now for the sake of the community, I will look into doing some of these features, but I wanted you all to understand why it's a very open plugin.

    I have a side project I am working on called GeneralNPC, this NPC will be designed for things such as simple NPC's, Quest NPC's, etc.

    I am not sure about armor, I have to experiment with that, if I can figure it out I will implement it. NPC's can also hold something in their hand, I will add that as an option as well.

    What are you typing to get this to happen?
     
  14. Offline

    Michael Murphy

    what does /npc banker do?
     
  15. Offline

    qlpwii

    i dont get a config file?
     
  16. Offline

    MatCat

    the banker command sets who gets / looses money when someone buys/sells from the NPC. You can have as many owners listed on an NPC as you want, but there can only be one banker whom must be a owner.

    If for some odd reason it does not create the config file then open the .jar with 7zip or winrar, and put the config.yml from src/ into plugins/NPCTrader/
     
  17. Offline

    qlpwii

    when i open it with winrar i get a config.ymail thing but when i run the server and say /npc create qlpwii 6 10
    it says null why does it do that?
     
  18. Offline

    MatCat

    Show me the exact errors you get from the server console
     
  19. Offline

    FXStrato

    I still don't get how to set up a database on MySQL for Windows. The tutorials out there confuse me.
     
  20. Offline

    MatCat

    Generally when you first setup MySQL it should ask you for a database name and a password for root. Whatever your database name is, is what you will change the /minecraft to in the databases: field, so for example if your database name is blah_mydb then it would be /blah_mydb.
     
  21. Offline

    FXStrato

    It didn't; I used the .msi setup, and never got around to naming a database. However, I used the command line to create a database named minecraft, so it works now. Maybe I should upload a video for windows users as to how to get this to work. I finally got it. Thank u, Mat. Tell me if you need video. I can try to post one. :D
     
  22. amazing! is there any way to change the skin of the npc?
     
  23. Offline

    Retricide

    I'm a mysql noob too. How did you create a database in command line? I've set up the username and password, but don't know about the database.
    Nevermind; I got it [​IMG]
     
  24. Offline

    Schmogel

    Delete the [NPC] prefix in your config file and name your NPC after an existing player (i.e. "Notch"). Your client will load this user's skin. But there is no way to give it a fully customized skin without client modding.
     
  25. Offline

    FXStrato

  26. Offline

    qlpwii

    ok i downloaded and follow rule but it doesnt work i put jar in plugins and other file in teh main folder i opend up teh config and looked at it when i run server it gives me error messages
     
  27. Offline

    MatCat

    I put the link in the OP to make it easyer for everyone, thanks for finding that tutorial!
    You need to show the console output so I can see what error it is.
     
  28. Offline

    Plyz

    i found the fault, lets say i try to sell cobble stone to npc without having any cobblestone in inventory like this gives the right outcome = u dont have xx cobblestone.

    when i just have 1 stack, i can use /npc sell 1 xxxx whatever i want, and it sells all stacks even though i only have 1.

    Also with 1 single cobblestone i can sell as much bundles as i want, its like its just checking for the id, not how many i have ?
     
  29. Offline

    MatCat

    I will check on this...
     
  30. Offline

    FXStrato

    Maybe for next update, you can add changeable skins? And maybe make the help section for /npc a bit more less cluttered... its wonderful, its just it takes me forever to get everything set up, and even then, i get pissed at myself because i cant follow what it tells me. :D It's just me, i think.
     

Share This Page