[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. mysql is a database system that you would have to have installed on a server.
    You cant just 'give' a mysql.
    http://dev.mysql.com/downloads/

    if you setup a mysql server, and make a database, all you have to do is give the plugin your name, password, and the address (usually localhost if its on your own machine). The plugin will make everything else for you!

    However, it would be a good idea to get a working knowledge of mysql first
     
  3. Offline

    Shinfo

    Don't even bother. It's too much work, and others have said it's not a worthwhile plugin anyway. Oh well it was a good idea, hopefully someone else can implement it better.
     
    Daveyo likes this.
  4. Offline

    Nakou

    Hello guys, we work this day on an amelioration of another plugin (http://forums.bukkit.org/threads/econ-signtrader-0-7-1-trading-with-signs-328-tested.3322/page-5) and we see something strange.

    On our modified plugin, we trying to make a element in inventory can be remove, without the condition when it's necesseraly being in the hand.

    But in our plugin, after the selling, the inventory was not update at this time, and we need to deplace the stack to see the changements.

    In your plugin, the items are delete properly after the sell, like a fuction "InventoryUpdate".

    So, how you do this?
    If you don't want to tell us, no problem, i understand xD.
     
  5. Offline

    inkwriter

    I found another abuse bug, though this might be minecraft itself because of the data values...

    if I set up a shop to buy/sell wood logs (/npc setup 1 17 1 5 4 true true)
    and I have a redwood or birch log in my inventory, the shop will buy it from me, but not remove the item from my inventory.

    The same thing applies for colored wools if you have an npc that buys/sells cloth as well as any other meta data value items like dyes.
    if you sell him a red cloth, he'll buy it but not remove it from your inventory unless it's a white cloth (or a normal log in the last example)

    Note that I tried creating slots with the meta values, for example,
    /npc setup 1 17:3 1 6 5 true true
    and while the slot did correctly appear, it was impossible to sell the redwood in my inventory to that slot.

    (I couldn't verify buying from it since I couldn't stock it in the first place)

    I've no idea if this is possible to fix, considering it might actually be the lack of values for the colored wool and wood blocks from Minecraft itself, but it's definitely making a wood/cloth shop impossible currently.
     
  6. The plugin is actually working REALLY well... its just not great if you are too lazy to install mysql XD (sql lite will come soon :p)
     
  7. Offline

    jinrey


    Ok, I downloaded one mysql, how now create datebase? there is a many files, and i dont know what can i make with this!!??

    I downloaded mysql-cluster-gpl-7.1.10
     
  8. Offline

    rockNme2349

    So I can't get dyes to work correctly now. It looks like it is trying to read the metadata now but it still isn't working correctly for me:

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    It should read Lapis Lazuli and allow me to stock them.

    Thanks
     
  9. Offline

    MatCat

    IT appears you set it up for Yellow dye and are trying to stock it with lapis luzi? I don't see yellow dye in your inv on that screen shot.
    --- merged: Feb 19, 2011 5:03 AM ---
    I think you are running an older version, because the current version does not do this, however I did just discover it is not working properly at all if metavalue is set, I.E. it wont buy sell stock or take or give to you... I am going to fix here in a second.
    --- merged: Feb 19, 2011 6:58 AM ---
    Updated to Version 1.0.6
    --- merged: Feb 19, 2011 8:07 AM ---
    How are things going on 1.0.6? If we are stable I will start working on other features, I want to do a worldguard/edit integration for NPC's that can sell/manage regions to be included in NPC Trader. I also want to do infinite stock feature for those that want it. I am also going to start working on a Basic NPC plugin that will cover those of you that want simple interaction and RPG like features.

    Now is the time for anyone to voice their ideas that you would like in the basic NPC plugin.
     
  10. Offline

    sumTard

    I hadnt thought of worldguard region integration, that would be brilliant :D Would definitely love to have a landlord that assigns predefined plots of land to buyers (with a limit on how many they can buy), that way we dont have to assign them all manually D:

    Infinite stock would be very useful as well.. I take it its a simple addition? Maybe you can sneak this one in before the more elaborate region feature :p

    Oh and sorry that we keep buggin you with this, but is sqlite out of the question now? I might just have to suck it up and install mysql. I have plenty of overhead, its just that its a pain in the butt to configure in linux :/
     
  11. Offline

    MatCat

    Well the problem with SQLite is the queries need to be completely redesigned to work with it properly, for now I have given up on it. I tried many times to get it to work and I just can't get it to work properly. I will take a look at some other plugins code and try to figure out what I am missing...
     
  12. Offline

    Shinfo

    Call me lazy? Fuck off buddy. Considering I spent the better part of 8 hours, and my host trying to help as well, trying to get this working, don't call me lazy. Idiot.
     
  13. Offline

    MatCat

    Please keep it civilized. This is not the place, nor is it within the scope of the topic.

    I am sorry that I am only offering MySQL, this project was intended for my server and my needs, but I put it out there for anyone to use because it was desperately needed. Either use it with mysql or do not use it if you cannot get mysql setup. I am working on getting sqlite or another alternative for those that can't or do not have the technical knowledge to setup MySQL, however please understand I just got a new job so I am very busy too. I spent 3 days without sleeping to get this plugin out there. And I will continue to improve it and make it the best plugin of it's functionality. But give me time :).
     
  14. Offline

    sumTard

    Well I finally gave in and got mysql up and running, it wasnt all that hard as they made it out to be for linux lol. Anyhow, is there any way you could implement a configurable limit on the amount of npcs a group may spawn? I dont want them to abuse this and hog up memory like no other :/

    Also, what exactly is the difference between the Manager and Owner permissions? Is there a way for me as an admin to create the npcs for other people and then transfer ownership to them? (again, to prevent abuse). Thanks!
     
  15. Offline

    MatCat

    Managers can be configured to do price changes, stocking and unstocking, change messages, move the npc etc. Owner's can add or remove other owners or managers, owners can remove the npc, owners can change whom the banker is (Must be an owner). the create command was purposely not put on owner so that you could restrict it to admins.

    As far as limits per groups I can put that on my list of features to implement, but I cannot guarantee it will be quickly.
     
  16. Offline

    rockNme2349

    OK, I think I see the issue here. In 1.0.6 it is now letting me stock but it is still displaying the wrong name.

    http://www.minecraftwiki.net/wiki/Data_values#Wool

    I used the metadata value 4 for lapis lazuli, but it is displaying Dandelion Yellow, which would be the Wool color for value 4.

    Thanks for your help so far.
     
  17. Offline

    MatCat

    I will check that out... I also need to add naming for logs too. Can anyone think of any other item besides logs dyes and wools that use metadata and has different names?
     
  18. Offline

    Nachocuban

    coal and charcoal
     
  19. Offline

    MatCat

    Hrm didn't know they used same item id
     
  20. Offline

    Jath

    Yeahhhh. I really wanted to try this plugin out, but the MySQL tutorial was too confusing in the sense that not all the installations were in the correct place it was saying. Oh wells.

    If possible, is there an updated guide than the one in the first post? First post one didn't give proper links to installation files for MySQL and it seemed very odd. Iunno. Maybe it's just me.
     
  21. Offline

    LokeDK

    This list differs from http://www.minecraftwiki.net/wiki/Wool_Dyes
    Maybe that's part of the problem.

    We've been playing with this plugin on my server the last day, and apart from having a blast with it, we have found the same problem with dyes. They seem to display the wrong text.

    We do have a suggestion or feature request though. It would be nice if you could configure a max distance at which the NPC works. Some of my more creative users have already begun using NPC's as a long distance personal warehouse, which wasn't exactly my idea. But the real shops that has surfaced on my server the last 24 hours, price wars, spawn-advertising, badmouthing of the competition and what not, has made it more than worth it.
     
  22. Offline

    MatCat

    ROFL! Yeah it really spawns a realistic economic situation. As far as distance goes yeah I already had planned on implementing limits. I will work on this soon. As far as that wiki page goes, it is wrong. The ItemData values are literally the exact opposite of wool, I.E. Wool:0 is white, where is dye:0 is black (ink sac), 11 on wool is blue, but 11 on dye is yellow, whereis 4 on wool is yellow and 4 on dye is lapis luzi. I just figured this out mucking with the code, I have implemented a fix, when the itemid is 351 (dyes) it just does absolute of itemdata - 15 (This reverses it to match). It will be fixed in 1.0.7, along with log names too.
     
  23. Offline

    sumTard

    Im having trouble with players getting a permission denied message when right clicking the npc to use it. The console outputs:

    Checking Permissions
    Failed user permission check for permissions.npc.user.list
    Failed user and admin permission check for permissions.npc.user.list

    but i have all the proper permission nodes set. I gave a tester every node except the admin ones, and he still got the message. It works fine for me as an admin though. v1.0.6 (cb339)
     
  24. Offline

    xCode

    I keep getting disconnected when creating a npc..
    I type /npc create xcode 6 10
    then i get an error Disconnected by server. Internal server error.
     
  25. Offline

    mrgreaper

    we restarted the server this time on windows xp

    to any one needing mysql

    grab wamp it makes it easy

    just be sure to look into phpmyadmin and add passwords to root (not hard)

    its working a treat for us

    great plugin THANKYOU
     
  26. Offline

    AtomicAcidbath

    I have and have had a working MySQL database server, and get the same error.
    The plugin was working until a recent update of Bukkit and the latest version of this plugin.
    Testing with minimal components (Permissions, iConomy, NPCTrader) on a fresh MySQL database still generates errors, and the plugin does not function correctly. The MySQL driver used is the one linked in original post.

    Code:
    NPCTrader version 1.0.6: Found iConomy
    NPC Trader is Using Permissions
    java.sql.SQLException: No suitable driver found for
            at java.sql.DriverManager.getConnection(DriverManager.java:602)
            at java.sql.DriverManager.getConnection(DriverManager.java:185)
            at com.MatCat.NPCTrader.NPCTraderMySQL.dbConnect(NPCTraderMySQL.java:1211)
            at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:181)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:430)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:175)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:74)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:55)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:171)
            at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:158)
            at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:110)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:209)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Datbase configuration Error: java.sql.SQLException: No suitable driver found for
    java.lang.NullPointerException
            at com.MatCat.NPCTrader.NPCTraderMySQL.CheckDB(NPCTraderMySQL.java:226)
            at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:183)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:430)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:175)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:74)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:55)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:171)
            at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:158)
            at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:110)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:209)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Database Configuration Error
    NPCTrader version 1.0.6 is disabled!
    
    After another series of errors, NPC Trader displays "NPCTrader version 1.0.6 is enabled!"
    In-game, executing /npc create test 6 2 generates "Database failure trying to add NPC".
    Prior to the update, a functioning NPC had been created near that location.

    There is a problem.
     
  27. Offline

    MatCat

    Check your config file, make sure it says DB: not MySQL:, that is generally what causes the error you get.
     
  28. Offline

    inkwriter

    Different types of wood blocks as well as colored cloth blocks work perfectly now in the npc shops! :D
    however I'm still unable to sell dyes to the npcs :0 (as a result I can't test buying them either :p)
     
  29. Offline

    MatCat

    I will be fixing dyes soon, as well as adding names to logs. I am actually in the middle of it right now.
     
  30. Offline

    orange1309

    forgive me, but how do you set it so that right-clicking the npc shows you the list of items the npc sells?
     

Share This Page