[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

    Shinfo

    They do VPS? I've got a webhost that's 100x better than prov tbh. It'd be nice to figure out how to set it up on there lol.

    Just had the support "install" this addon again for me... just placed the jars in plugins. *slow clap*. Crashed my server again.
     
  3. Offline

    add1ct3dd

    can't get it to connect to my mysql database at all!
    set it up on commandline (user, database + permissions) but i just get "database failure trying to add NPC" :(
     
  4. Offline

    Gene Myers

    Is there anyway i can set up a remote mysql database? if so how would i do it.. i know its possible to remote manage a mysql database.. i have a hosting package with full cpanel access to create unlimited number of mysql databases.. if you could walk me through how to do this.. i would not have any problem with supplying people remote mysql databases for everyone who would like to use this.
     
  5. Offline

    MatCat

    No there is no flatfile support.
    --- merged: Feb 17, 2011 9:41 PM ---
    In Cpanel there is a section called Databases or something similar to that, you click on it and there will be an option to add users, add databases, etc.
    --- merged: Feb 17, 2011 10:28 PM ---
    Official version 1.0.0 is out!
     
  6. Offline

    Daveyo

    can you update us if he replys, and if you guys can get the normal database working
     
  7. Offline

    NathanWolf

    He has replied, we may have a good solution- obviously will take time for him to implement/test/etc :)
     
  8. Offline

    jinrey

    Hi! I'm from Poland and my english is bad :p I have problem with your plugin. I was make everythink what you wrote, but i have errors when i run my serwer.

    [​IMG]

    If you can, answer me what I make wrong in simply language :p
     
  9. Offline

    Orcworm

    Yep, V1 seems to have broken it on #323, for me anyway:

    [​IMG]

    Causes similar error messages with MyHome, iConomy and Permissions, although the log was moving too fast for me to get anything useful, wish I got a better screenshot but the players are starting to get annoyed with my constant restarts.
     
  10. Offline

    MatCat

    I need to see the top of the first error to see whats causing it.

    ALSO PLEASE RE-DOWNLOAD I found a bug in my permissions checking code, it's fixed now.

    Also I have never tested yet officially on any build above 313, I will be doing that today.
    --- merged: Feb 18, 2011 1:03 AM ---
    Ok I just checked and it runs on B339 just fine with iConomy 2.2b and Permissions 2.0. I recommend you upgrade to b339 as I know somewhere between 314 and 32something that iConomy broke, then started working again.
    --- merged: Feb 18, 2011 1:05 AM ---
    Just out of curiosity I see your sig says you run a 75 slot server, how much ram you find your server using for that?
     
  11. Offline

    sumTard

    any news on the sqlite addition? hows it coming along?
     
  12. Offline

    MatCat

    I will be testing an idea I have to get SQLite to work later today or tomorrow.
     
  13. Offline

    supermaxman

    Hey so i get this error when i get it all set up. I have the database just normal, do I add something to it?


    2011-02-17 18:59:40 [INFO] Starting minecraft server version Beta 1.2_012011-02-17 18:59:40 [INFO] Loading properties2011-02-17 18:59:40 [INFO] Starting Minecraft server on *:255652011-02-17 18:59:40 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-382-g026d9db-b297 (MC: 1.2_01)
    2011-02-17 18:59:40 [INFO] Preparing level "world"2011-02-17 18:59:40 [INFO] Preparing start region2011-02-17 18:59:41 [INFO] Preparing spawn area: 56%2011-02-17 18:59:42 [INFO] [iChat] version [1.5] (Maria Holic) loaded
    2011-02-17 18:59:42 [INFO] [iConomy] version [2.2] (Aime) loaded2011-02-17 18:59:42 [INFO] [Permissions] version [2.0] (Handler) loaded2011-02-17 18:59:42 [INFO] Loaded Essentials build Dev284 by Zenexer, ementalo, Eris, and EggRoll
    NPCTrader version 0.94: Found iConomycom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'minecraft' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
    at com.mysql.jdbc.Util.getInstance(Util.java:382) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:931) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4031)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1296) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2371) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185) at com.MatCat.NPCTrader.NPCTraderMySQL.dbConnect(NPCTraderMySQL.java:1101)
    at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:142) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:410) 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:169) at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:156)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:108) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:207)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)Fatal Error on DBConnectcom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'minecraft'
    java.lang.NullPointerException at com.MatCat.NPCTrader.NPCTraderMySQL.CheckDB(NPCTraderMySQL.java:221) at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:144)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:410)
    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:169)
    at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:156) at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:108)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:207) at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Database Configuration ErrorNPCTrader version 0.94 is disabled!java.lang.NullPointerException at com.MatCat.NPCTrader.NPCTraderMySQL.SetupNPC(NPCTraderMySQL.java:865)
    at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:148) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:410) 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:169) at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:156)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:108) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:207)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)NPCTrader version 0.94 is enabled!Whitelist: Trying to load whitelist and settings...done.
    Whitelist version 1.9 is enabled!2011-02-17 18:59:43 [INFO] Done! For help, type "help" or "?"


    I think the error is with the database but idk plz help!
     
  14. Offline

    MatCat

    @Supermaxman:
    Code:
    NPCTrader version 0.94: Found iConomycom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'minecraft' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    Do you have a db called minecraft in your DB? --> Unknown database 'minecraft'
     
  15. Offline

    jinrey


    What is this B339? and where can i get this?
     
  16. Offline

    MatCat

    Build 339 of Craftbukkit, the .jar file that IS your server :).
     
  17. Offline

    jinrey

    but where can i find this wersion?
    I have installed Iconomy 2.02 and permissions 2.0
    and there is the first line this error [​IMG]
     
  18. Offline

    Orcworm

    I dedicate 6gb to the server and have had no problems as of yet, peaked at ~65.
     
  19. Offline

    supermaxman

    Honestly, idk,where is the DB on a mac? I have a folder in the data file called minecraft, which was created correctly, but is there more? I'm new to this, plz help, and thanks for the response!
     
  20. Offline

    Nykhola

    When I want to sell an item to a npc, the client crashed and in the server's console ;

    2011-02-18 02:24:19 [WARNING] Failed to handle packet: java.lang.NullPointerException
    java.lang.NullPointerException
    at com.MatCat.NPCTrader.NPCTrader.PlayerItemCount(NPCTrader.java:444)
    at com.MatCat.NPCTrader.Commands.npcSellCommand.Run(npcSellCommand.java:59)
    at com.MatCat.NPCTrader.NPCTrader.onCommand(NPCTrader.java:338)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:17)
    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:628)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:597)
    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)
     
  21. Offline

    MatCat

    I need to know your minecraft build number and the exact command you typed /npc sell ? ?, also tell me what item ID and data ID is set for that slot
     
  22. Offline

    supermaxman

    @MatCat
    I used the terminal script to generate a database called minecraft, but it still gives me this error, that's what im trying to say.
     
  23. Offline

    SSA

    Code:
    2011-02-17 19:43:55 [WARNING] Failed to handle packet: java.lang.NullPointerExce
    ption
    java.lang.NullPointerException
            at com.MatCat.NPCTrader.NPCTrader.PlayerItemCount(NPCTrader.java:444)
            at com.MatCat.NPCTrader.Commands.npcStockCommand.Run(npcStockCommand.jav
    a:41)
            at com.MatCat.NPCTrader.NPCTrader.onCommand(NPCTrader.java:329)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:17)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:77
    )
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:1
    71)
            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)
    2011-02-17 19:43:57 [INFO] Freed 34.23174285888672 MB.
    
    2011-02-17 19:41:25 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-409-gcb2bced (MC: 1.2_01)


    This happens when I try to stock my npc (slot 1) with item type: 1 - any amount
     
  24. Offline

    Nykhola

    Madcat ->
    CB 339
    /npc sell 1 1

    in Mysql Database
    item ID 1
    data iD is itemdata ?
    Because this value equal 0
     
  25. Offline

    Meteo

    .... Sorry to say, this ruined my whole server. I left my server on, and a friend txts me,a sking why everyone is spaming broadcasts, and generating items. I took npctrader out and no one could do any of it. I already had many problems setting this up, and i dont plan to later on unfortunetly. It's a great plugin, but it screwed my server.
     
  26. Offline

    MatCat

    What Version is it? The line you quoted doesn't state the build number.

    So you get this error doing /npc setup 1 1 .... ?
    --- merged: Feb 18, 2011 2:26 AM ---
    I don't understand what your saying here...
    --- merged: Feb 18, 2011 2:27 AM ---
    I don't quite understand what your saying it did... My plugin touches no other plugins and only accesses it's config file and the MySQL database.
     
  27. Offline

    Nykhola

    as Ssa, when I type /npc stock... or /npc sell, i've an error
     
  28. Offline

    MatCat

    You have to have MySQL running for it to work, I don't even know if Mac has a MySQL port, probably does but I don't know anything about running MySQL on mac.
    --- merged: Feb 18, 2011 2:29 AM ---
    I need to know the exact sequence of events you did to set things up, what did you type for /npc setup? Then what exactly are you typing for /npc stock or /npc sell, I cannot reproduce this error.
     
  29. Offline

    Meteo

    I have no idea truthfully how to add the mysql database, but when i put the plugin with the mysql connecter installed, it made it so that everyoen had admin commands.
     
  30. Offline

    MatCat

    I can assure you that is not my plugin doing it, check your Permissions configuration.
     
  31. Offline

    Meteo

    I have, and the moment i took out npc trader it went fine, i think the error from it did something, it didnt permenatly change anything tho.
     

Share This Page