[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

    pudd1nG

    no chance of sqllite?
     
  3. Offline

    sumTard

    yeah, some sqlite would be much appreciated :)
     
  4. Offline

    iSushi

    sqlLite is nice indeed. :)
    Grawr, I hope you added this:
    Player steps into shop, NPC says "Hi, We got tons of stuff for sale, so please don't rob my storage-room :)", Player moves into Storage-room, NPC says "What are you doing?, get out of there!":
    if Jail plugin support: NPC says "Or I'll get the guards"
    else "You got five seconds to get out of there or I'll get you myself!",
    player doesn't move.
    if Jail plugin support: player gets teleported to the jail if touched by the NPC, and sits there for 10 minutes before release. And gets a -550 iConomy money PENALITY.
    if BountyHero plugin support: player gets a bounty on his head, and shop-owner NPC drags out diamond sword and kills the player.
    else, Shop-owner NPC drags out a diamond sword and kills the player (if killed the player get a pentality on 551 iConomy money), if player kills the shop-owner he can rob the store.
     
  5. Offline

    Schmogel

    Great =) But I think I'll need some help with MySQL... I've got a MySQL server running, but how do i connect to the database? What do I have to enter in the config.yml MySQL settings at "jdbc:mysql://localhost:3306/minecraft"? Do I have to create the minecraft database manually? I just don't get it.. At the moment I get "Database failure trying to add NPC." when I try the in-game command "/npc create NPC 1 1".
    Links with some instructions would be ok, too :)
    edit: Ok, I think I got it, didn't know I need to rename the MySQL Java Connector too "mysql-connector-java-bin.jar".
     
  6. Offline

    AntonyDream

    Is it possible to set up show npc's list for right click on them?
    And how about permissions?
     
  7. Offline

    QQCucumber

    sqlLite please. :(
     
  8. Offline

    uncovery

    • /npc move removes the suffix from the name. also it gives the npc your skin, which is not the case when you create it. I would rather have a special skin for all NPCs
    • /list interferes with the essential plugin. I think there should be a special command instead of /list /buy and /sell. maybe /tlist /tbuy /tsell or /npct list or whatever.
    I think this is great and very sophisticated. I will write a manual for my website on how to do this. Feel free to copy it once its done. Until /list stops interfering with the essential plugin and lists the people online i cannot use it.
     
  9. Offline

    Runelynx

    mmm when creating an NPC it just stopped my server...
    --- merged: Feb 13, 2011 6:53 PM ---
    Code:
    2011-02-13 21:54:59 [INFO] Stopping server
    2011-02-13 21:54:59 [INFO] MCBans: Waiting for thread to close!
    2011-02-13 21:54:59 [INFO] MCBans: Threads closed!
    Goodbye world!
    Goodbye world!
    NPCTrader version 0.7 is disabled!
    2011-02-13 21:54:59 [INFO] Stopping map renderer...
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:29 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:30 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    2011-02-13 21:55:30 [SEVERE] [iConomy]: Could not check balance for mysql: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
    java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(SocketInputStream.java:185)
            at java.net.SocketInputStream.read(SocketInputStream.java:199)
            at java.io.FilterInputStream.read(FilterInputStream.java:83)
            at net.minecraft.server.Packet.b(SourceFile:102)
            at net.minecraft.server.NetworkManager.f(SourceFile:157)
            at net.minecraft.server.NetworkManager.c(SourceFile:15)
            at net.minecraft.server.NetworkReaderThread.run(SourceFile:68)
    
    --- merged: Feb 13, 2011 6:56 PM ---
    Ok the server came back up it works now
     
  10. Offline

    KrisEike

    Sqlite support would be very nice. This plugin looks amazing and i was hoping to try it, but i got an error.. "Database failure" thingy.. been looking for a plugin like this for over 3 weeks now, i hope someone can make it work with sqlite..

    Kris
     
  11. Offline

    EvilSeph Retired Staff

  12. Offline

    MatCat

    Yeah there are things I have to do yet, permissions is one of them, I wanted to release a preview release because 1: It is badly needed :), 2: Best way to get your code tested ;).

    I might look into SQLlite but it is not a high priority at the moment, sorry.
    It is not /list or /buy its /npc list, /npc buy, etc.
    Also on the move problem I will fix that and have it up in a few minutes. The skin thing only happens if it has the same name as a real player, there is nothing that can be done to control the skinning as that is done by the client not the server.


    That is an iConomy database configuration error, not from my plugin.

    Good idea for the list, I will do that next release.
     
  13. Offline

    QQCucumber

    It's honestly the best thing you can do to get more testers, MySQL takes a lot of memory that most people who runs servers can't afford to spare, given how memory hungry minecraft already is.
     
  14. Offline

    KrisEike

    No idea what this guy just said but.. sqlite please? xD
     
  15. Offline

    Runelynx

    I already run mysql for iconomy and worldguard alerts (which I then publish for my mods http://runicparadise.info/admin/index.php?p=warps)

    I say stay with mysql! Its way easier to go in and fiddle with values if people need hel p correcting things
     
  16. Offline

    QQCucumber

    It's not a matter of preference, it's the fact that with the memory allotments we have access to, we simply CAN'T run it if we wanted to, or it'd hurt overall server performance.
     
  17. Offline

    fugue2005

    that's unfortunate, as i like most people running bukkit won't touch this without sqlite
     
  18. Offline

    MatCat

    Reformatted page to meet guidelines.
     
  19. Offline

    Ben Bestvater

    I found that MPC's disappear when the chunk they are located in despawns.. anyone else having this problem?
     
  20. Offline

    MatCat

    I updated the jar file to fix the move issue with removing suffix and prefix. Just re-download.
     
  21. Offline

    kronflux

    Please add SQLite to this!
     
  22. Offline

    MinehubGaming

    I'm getting an error saying that Iconomy and NPCtrader are out of sync when i try to create one.

    Using CB build 302 atm
     
  23. Offline

    Daveyo

    it says 313
     
  24. Offline

    bentech

    Cool but need permissions

    It also sends the messages to everyone!
     
  25. Offline

    MatCat

    Actually it should work on 302. The iConomy and NPC out of sync error happens when the code to add or subtract money using iConomy API causes an error, or the arguments for slot and unit numbers are not proper, I am going to do a quick code fix now to seperate them in error checking so it can work properly.
     
  26. Offline

    PrivateAlpha

    @MatCat Any good developer listens to what his/her users wants..

    get github or post source please.
     
  27. Offline

    MatCat

    Fixed, re-dl
     
  28. Offline

    LucidLethargy

    sqlite please! I can't do much of anything with full on mysql (I know how to, but I simply don't want to muddle the simplicity of things with it due to how much time I currently have)
     
  29. Offline

    Michael Murphy

    please release the source!! There's many things I would like to modify for a custom RP server.
     
  30. Offline

    Runelynx

    Pls see post above where SQLite was already commented on. So use what's available now or be patient (quietly).
     

Share This Page