[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. Offline

    Codisimus

    I may not know wut im talking about but why cant you just make the NPCs name " " as in just spaces?
     
  3. Offline

    JohnnyR

    Most people aren't going to go through the hassle (and don't want the performance overhead) of setting up MySQL. If you want your plugin to be successful, you kinda have to use Sqlite. Just my two cents =)
     
  4. Offline

    Tomato

    Thats wrong. MySQL is actually better when the server is under heavy load.

    MatCat, I can't wait for an updated version! I have been working on a server all week getting it ready for public and this is the addon I am waiting for!
     
  5. Offline

    DJHenjin

    Does this work with essentialsEco.jar or do i have to switch over to iconomy? i would be more than happy to switch to iconomy just for this plugin. Also is there a good easy way to be notified when an update for this plugin comes out.?
     
  6. Offline

    MatCat

    The skin for a player is grabbed by the client, I.E. the game running on your computer, the game uses the name of a player (I.E. an NPC as technically a player as far as the game is concerned), and uses that name to look for the skin. This is why the name HAS to show, there is no way around it without modifying the client itself.
     
  7. Offline

    KiloWhiskey

    Like I said, I have 2 account so this isn't a big concern for my use, just thought I would ask. Thanks again though. The result will be awesome and allow me to put a display at spawn of server admins and mods in addition to the statues. :D
     
  8. Offline

    sumTard

    Aw dang, another switch to GroupManager, I hate being stuck in limbo. Any possibility of permissions 2.5+ support?
     
  9. Offline

    Bronski

    I installed WAMP ( http://www.wampserver.com/en/ ) and I don't think I had to configure really anything. It's just a few steps after that to create a database and run the SQL script to create the table for the NPC data. If you have been mucking about in .yml files with a text editor, it's not much more of a stretch to get this puppy going :)

    Now where are my customizable NPC messages? *poke* <3
     
  10. Offline

    JohnnyR

    http://www.sqlite.org/speed.html
     
  11. Offline

    mrgreaper

    look for yamp or wamp both easierly setup mysql for you (just be sure to add passwords to it or atleast dont allow access to it from external sources (ie dont port fwd lol)

    was reluctant to move to mysql but did specificly for npctraders and to be honest the server is much more stable for it, bigbrother for example has multiple posts stating that mysql is not just good but serously recommanded :)
    --- merged: Mar 2, 2011 10:03 PM ---
    permissions 2.5 is just permisions 2.1 updated but by a different author

    switch to groupmanager its much better and maintained by its original author
     
  12. Offline

    Phanku

    1) this page is like mega old and even says it on the top of that page.
    2) The version that this page is quoting for MySQL 3.23.41 and the current version of MySQL (source: http://www.mysql.com/downloads/) is 5.5.9. Compared to SQLite 2.7.6 and the current version of Version 3.7.5 (source: http://www.sqlite.org/).

    Trust me when I say this. I am sure they have more optimization in MySQL than sqlite anyday. The fact that MySQL has gone to enterprise level means that MySQL under heavy load will always work better than sqlite.

    Here is a non biased source:
    http://blog.sobbayi.com/2010/05/sqlite-vs-mysql-how-to-decide-which-to-use/

    Please notice this under sqlite:
    • lacking in performance measurement features
    • not good for large scale databases as SQLite stores the database in a single file and this can fall under the restrictions of the operating system where SQLite is not capable of splitting the data across volumes. (Such as Big brother dbs)
    • Not readily scalable. Altering tables is not permitted in SQLite except for adding columns and renaming tables. I could be wrong about this but from my understanding this meaning if the plugin developer decides to change a table you have to start your entire db again.
    The misnomer is that MySQL is hard to set up and that is just not true. Normally on most linux systems (with the exception of CentOS and Redhat) there is a simple package manager command you type and boom its installed.
    On Ubuntu machines it is literately 3 commands(2 if you don't have php installed):

    Open a terminal window, and use the following command:
    sudo apt-get install mysql-server​
    If you are running PHP you will also need to install the php module for mysql 5:
    sudo apt-get install php5-mysql​
    To create a new database, use the mysqladmin command:
    mysqladmin create <databasename>


    As already stated in WAMP all you have to do is set up the root access account.
    To top it all off.. it comes with a pretty easy WEB interface you can use to access all the databases and tables. (phpMyAdmin)​
     
  13. Offline

    DJHenjin

    does anyone know if this is compatable with Essentials Economy.???
     
  14. Offline

    Belarr

    I dont see anywhere is this thread where they say they're switching to GroupManager... It wouldn't make since to since the core (iConomy) is using permissions.
     
  15. Offline

    QQCucumber

    MatCat said it last page, and yeah, it does seem a bit backwards.
     
  16. Offline

    mrgreaper

    post 535 matcat states he is upgrading to groupmanager

    iConomy may use permisions but nij clearly states he will not be supporting any other plugin but iconomy now other people have taken the permission source code and updated it but they are not the core author, our server made the switch to groupmanager back when the permissions author quit and have not looked back since iconomy is the only plugin we have had difficulty with (seems to be specificly written to not work with group manager, dont you hate plugin polotics? ) however that was several versions of groupmanager ago as we have had no need for iconomy untill npc trader was back :)
     
  17. Offline

    QQCucumber

    TheYeti has been doing a fantastic job with Permissions, and Permissions 2.5.1 is my permissions plugin of choice. The GroupManager switch makes absolutely no sense to me when iConomy needs Permissions, and this plugin needs iConomy.
     
  18. Offline

    4am

    Yes! Besides Flashlight (which apparently isn't possible anymore - booo!) this is the only plugin I don't have running (even though I've had to run the iConomy 4.2 dev build). Haven't had the chance to run it yet but I'd love to get it going! I'll check back later tonight - bring on the updates! (I'm on Craftbukkit #493)
    --- merged: Mar 3, 2011 12:04 AM ---
    GroupManager is Permissions-compatible. So, if plugins support Permissions, no switch is required. I believe that the opposite is also true? Although I haven't written any code against either since Permissions 1.x so I could be wrong.

    Edit: This means that if you are required to use GroupManager, iConomy works with that. I'm running it right now with the latest GroupManager and iConomy 4.2dev and it's just fine. GroupManger is more flexible, IMO.
     
  19. Offline

    3nkao

    Oyeah MatCat is back !
    Can't wait for this update :) :)

    (As said above, could you conserve the Permissions support, it would be great ?)

    Oh and, MYSQL > SQLITE ! [​IMG]
     
  20. Offline

    QQCucumber

    The latest build of GroupManager is an alpha though, and its permissions compatibility is experimental.
     
  21. Offline

    KiloWhiskey

    @MatCat You know, you should really think of releasing my request as a very lightweight plugin called Statues or Effigies that simply allows admins to add static player models to their servers. Would be great as a greeting so players can see the admin player models and names and know who to go to for trouble.
     
  22. Offline

    crohakon

    Sadly, if you switch to groupmanager and I can't control it with the permissions plug-in... its a no go for me. Everything I run is based around permissions. Worldguard, Worldedit, craftbook, commandbook, iconomy, movecraft, etc... I'm have no issues with the new plug-in dev taking up permissions.

    *sigh*

    But, I suppose do what you must. It just going to be hard explaining to my players that NPC Trader is not an option.
     
  23. i put it this way:: Either keep the cool stuff like region protection, drawbridges, and money.... or keep NPC's... they were pretty quick to say get rid of NPC's :D
    But i'm the same way. You get rid of permissions, i gotta get rid of NPC's :( I'm actually working on removing all essentials from my server, because they are causing more problems than its worth for me.
     
  24. Offline

    Tomato

    Just support permissions. Groupmanager is backwards compatible.
     
  25. Offline

    Deikkan

    I'm also running Permissions 2.5.1 and having no problems using this plugin whatsoever. I do not know how cross-compatible permissions and groupmanager are but I'm worried that some of my other plugins will stop working if I switch to groupmanager. If you could do permission support as well for this then I will be grateful.
     
  26. Offline

    mrgreaper

    dear god! im telling you were running groupmanager on our server with zero problems

    we use
    preciouse stones
    minecartmania (all of it)
    travelportals
    worldedit
    backpack
    elevators
    controller blocks

    and thats just the ones of the top of my head

    permisions is abandoned by its main developer
    group manager does everything permisions does but better theres no reason not to upgrade to it

    tell my players npctraders is not an option, no offense but bah, atleast try groupmanager before being so overdramatic
     
  27. Offline

    closer013

    MatCat your progress is amazing at this plug-in. However to the nay-sayers in the community: Some of us CAN'T run MySQL on our servers, and there are those that are strictly game players that do not want to learn MySQL despite how easy those make it out to be. So long story short, know that there are those that want SQLite support and keep up the good work and keep SQLite in mind.
     
  28. Offline

    Tomato

    Until groupmanager works fully with 2.1+, I say keep backwards support. Keep support as long as you can is the best way to go. If Windows dropped support for programs every version it would be a clusterfuck.
     
  29. Offline

    QQCucumber

    Permissions has been taken over by TheYeti, reaper. It's up to 2.5.1 now.
     
  30. Offline

    mrgreaper

    i feel were straying from the topic
    shall we merely agree to disagree as to which permission plugin is best as i feel neither of us are going to sway the other, what ever matcat decides we as server admins will deal with get intergrated. i would rather not bicker and i feel thats where were heading my apologies for calling you overdramitic that was uncalled for
     
    Tomato likes this.
  31. Offline

    crohakon

    CommandBook is a good alternative to essentials. It was created by the same guy that created WorldGuard/Edit and CraftBook.
    --- merged: Mar 3, 2011 1:45 AM ---
    No, not really. I was a bit over dramatic. But my point stands. =)
     

Share This Page