[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

    MatCat

    If you do not already have MySQL setup it is a bit complicated to explain, if you are on windows you can just go to mysql.org and download it for windows and be good to go, if you are on linux it is much more complicated. Suffice it to say this plugin REQUIRES MySQL
     
  3. Offline

    FXStrato

    So what you are saying is that it doesn't work with iConomy right now?
     
  4. Offline

    Quz

    yep, i just installed Mysql. im on windows.
     
  5. Offline

    LucidLethargy

    I've used MySQL before with Joomla, Concrete5, Phpbb3, and other various methods, but I can't wrap my mind around where to start with this one (namely the connector and all...) can someone please give a quick informational post on this?

    It seems sqlite wont be around anytime soon, so this would be a huge help to many of us who are a bit confused.

    Edit: I'm on a Linux server that I access remotely with ssh and ftp, so this is what I'm dealing with.
     
  6. Offline

    Quz

    MatCat, do you have teamviewer? Im not exactly sure how to do this :/ and it'd be nice if you could help.
     
  7. Offline

    QQCucumber

    Was the SQLite thing abandoned?
     
  8. Offline

    MatCat

    Explaining how to install MySQL is beyond the scope of what I am willing to help with, it's just too complicated to explain. As far as the connector goes it is just a driver to let java understand how to communicate with MySQL, it needs to be placed in the same location as your craftbukkit.jar, I.E. /minecraft/

    If you use a host you should have a cpanel or something that lets you manage your website/databases/etc, there you should find a MySQL option to configure a database. The database: field in config.yml needs to be adjusted to match your setup. Generally you should only have to change the /minecraft part to be whatever your database name is. If your DB name is matcat_minecraft then you would change /minecraft to /matcat_minecraft, and of course also set the user and password options too!

    On Windows if you do a basic install your username will be root and the password will be whatever password you setup when installing MySQL. Alternatively if you go in search of any free website hosting companies that offer free MySQL database and allow remote connections you could replace localhost in the database setting with the IP or web address of the MySQL server on another computer entirely and just piggy back off of someone elses MySQL, however doing this will also introduce a small amount of lag as the SQL Queries have to go across the internet, but it is a good option for those of you who just can't do MySQL on your host machine.
     
  9. Offline

    Quz

    is it MySQL community 5.5.9 that i need to download? cause that's the one that i downloaded. In the MySQL server instance Configuration I dont see anything to configure a database..
     
  10. Offline

    MatCat

    It's not abandoned I am just going to try again once I properly organize the code into a better structure.
     
  11. Offline

    FXStrato

    Please tell me when you get SQLite to work. That would be great on all of us. Thank u once again. And btw, i still can't get it to work. I don't understand how to work MySQL with Windows.
     
  12. Offline

    turtlelink2

    I noticed that if you name it Guard it gets a custom skin, do any others do this? is this intended?
     
  13. Offline

    QQCucumber

    Skins are derived from the name you give them. If you name an npc after yourself, it will have your skin.
     
  14. Offline

    Quz

    Finally got it working :D
     
  15. Offline

    MatCat

    On Windows MySQL is easy, download it, install it and follow the instructions. By the time you are done it will have created an initial database (Best to name it minecraft so you don't have to change the database: field in the config.yml) with a username of root and password of whatever you set.
     
  16. Offline

    Meteo

    This would be the BEST OF THE BEST. IF U COULD COMBINE IT WITH A MYSQL THAT IS ALSO FROM ICONOMY. When i replace my mysql.jar file from yoru download, and replace the one from iconomy, iconomy doesnt work at all, and the database failed to even amke it's self....... i have no idea how to configure the config, so some advice please? XD
     
  17. Offline

    Schmogel

    I don't know if your problem still exists, but it says jdbc4 in your error message, and your connector.jar is smaller than mine. So I guess you downloaded an outdated version. MatCat has the link to the right connector.jar in the opening post.
     
  18. Offline

    MatCat

    I use the same connector for all the plugins I run on my server not just mine, Big Brother, iConomy, and a host of others.
     
  19. Offline

    Nathan C

    Massive errors on the latest version of CraftBukkit. Here is what I could catch of it.

    Code:
                    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:74)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:317)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:232)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Feb 15, 2011 8:13:01 AM org.bukkit.craftbukkit.CraftServer loadPlugins
    SEVERE: tried to access class com.MatCat.NPCTrader.NPCTrader$1 from class com.MatCat.NPCTrader.NPCTrader (Is it up to date?)
    java.lang.IllegalAccessError: tried to access class com.MatCat.NPCTrader.NPCTrader$1 from class com.MatCat.NPCTrader.NPCTrader
            at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:161)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:425)
            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 org.bukkit.craftbukkit.CraftServer.reload(CraftServer.java:193)
            at org.bukkit.command.SimpleCommandMap$ReloadCommand.execute(SimpleCommandMap.java:184)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:77)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:171)
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:610)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:589)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:74)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:317)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:232)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    The version of CraftBukkit specified in this thread, is way to unstable to even run.
     
  20. Offline

    MatCat

    I actually have not had any stability issues with 313... iConomy is due to be updated soon and my plugin should chug along just fine on the newest build once iConomy is updated for it too.
     
  21. Sorry to be ignorant about this, but is there any way to NOT allow users to create/destroy/edit NPC's?
    (and i'm assuming since admin powers aren't in place for this, i cannot delete someone else's NPC in-game? I can go into the DB and manually delete though? )
    Thx
     
  22. Offline

    MatCat

    Permissions will be in the next release. I coded this to the specs of what I wanted on my server and didn't really consider releasing it as a full fledged plugin to the community until I started working on it. Rest assured permissions are coming soon.
     
  23. Offline

    ToitagL

    Disappearing NPCs fixed brillantely. Thank you SO MUCH.
     
  24. Offline

    ledhead900

    Can we get a feature added so these NPCS can wear armor to spice them up a little bit, Maybe also add quest text for those who want to use these little guys as introductions to servers ect.

    Oh and a REALLY BIG thing I would like added is GLOBAL Prices, Maybe a items list containing item ID and price and have all traders shops go by that list.
    --- merged: Feb 15, 2011 10:00 AM ---
    Possibly an option for admins to make traders that DO not go by that list for servers that want to reward players for going exploring there server and finding these "Bargin Npcs"
     
  25. Offline

    Brack

    For anyone having issues installing mysql on windows take a look at this video: http://www.youtube.com/watch?v=nsToIwl0wxs

    In the video he installs Permissions and Jail plugins. You don't necessarily need these, but permissions isn't a bad idea.

    This video advocates installing WAMP. This stands for Windows Apache Mysql PHP. Apache is just a web server. PHP is useful for accessing mysql databases. phpMyAdmin is a good tool for doing this. On Windows it is set up so you can basically download it all, and it will just work.
     
  26. Offline

    Plyz

    appearently i set the NPC with this command /npc setup 1 4 64 2 2 true true

    That should mean 1 stack of cobble can be sold for 2 iconomy coins.

    But appearently it sells 4096 cobble even though i dont have so many ? Tested with 2 person. Is this a bug ?

    Edit: Running CB: 325

    Edit2: Appearently this made my Iconomy and Essential plugins f@ck up on 325, not being able to use some sql databases on BigBrother, and couldnt pass Player_Join to iconomy errors. After deleting all works.
     
  27. Offline

    zeiser

    will this work if i use mysql on iconomy ?
    Edit: it works, nvm my stupid question :p
     
  28. Offline

    moonmike

    I love this plug-in and it works great Thanks
     
  29. Offline

    Plyz

    Would u mind stating ure CB build ?
     
  30. Offline

    denace

    Just a short question. Only OPs can use the /npc commands?
     
  31. Offline

    moonmike

    313
     

Share This Page