[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

    sumTard

    Ownership works fine for me. Both me as the admin, and the npc's owner can remove it. In fact, there have been some accidental removals along with all the items the npc contained, so it would be nice to have a confirmation message for deletion in the future :p No biggie though.

    I could not reproduce that error with 1.0.7. When i try to do that it correctly says i dont have enough of that item. You sure you have the latest version?
     
  3. Offline

    Springrolls

    Nope still not working.. still says You are not an owner..
    EDIT: Worked for some reason
     
  4. Everytime I try to set up my NPC it tells me I have to be an owner or manager and I have given myself all the permissions is there somewhere else I need to set myself as owner or manager?
     
  5. Offline

    sumTard

    Did you right click the npc before attempting any command?
     
  6. I had the same problem. Delete your config file, run the server, stop it, then run it again. that should fix it.
     
  7. Offline

    moonjokes

    I would appreciate it if there was a way to either A. create alternate names and mask the real name of the character or B. not display names at all

    I ask this because you can use peoples usernames to skin the npcs different ways but I dont like having a bread vendor named Hobo101 or something. Thanks!
     
  8. Offline

    MatCat

    Unfortunately there is no way to mask it and make skins work, I can look into turning names off but I am not too sure how.

    However on a side note, I would like to inform everyone of my plans for this plugin.

    My next major update is to add Plot slots (WorldEdit regions), so that NPC's can sell predefined worldedit regions. I also will be adding infinite slot types. Now because of the soon coming WorldEdit upgrade, various bukkit changes, and the upcoming Minecraft update, I cannot give a good time frame on this. I am really trying to wait out everything to sync together so I can get it done.
     
  9. MatCat, this might not be possible, but it's a request several of my players agree would be awesome :)
    Would it be possible to set the NPC's to be an animal, or monster... since its not player skins, you could have a zombie NPC town :D
     
  10. Offline

    radarwolf

    I cant use this 100%! If players want to stock the NPC it says there is an internal error:

    Code:
    21-feb-2011 18:21:23 net.minecraft.server.NetServerHandler c
    SEVERE: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'npc'
     in plugin NPCTrader v1.0.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:21)
            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:634)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:600)
    
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:592)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:77)
            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)
    Caused by: 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:19)
            ... 12 more
    I am using craft bukkit build 345
     
  11. Offline

    CSlander

    my npc trader works but it always says i cnat create npc trader cux i dont have enough money.... help
    --- merged: Feb 21, 2011 5:54 PM ---
    where do i right click? i dont c any npc in game and i cant create one either
    --- merged: Feb 21, 2011 6:07 PM ---
    what do i have to change in config file?
     
  12. Offline

    MatCat

    That is version 1.0.0, use 1.0.7
    --- merged: Feb 21, 2011 6:21 PM ---
    Give yourself money, /money deposit <yourname> 9999999
     
  13. Offline

    samsoccerboyz

    Best idea ever i think so
     
  14. database failure trying to add npc someone please help i put the file into my lib folder but still get this
     
  15. Offline

    sumTard

    any possibility of getting infinite stocks before the other additions? It looks like sk89q is further delaying any updates to his plugins as he no longer has the time, so any "synch-up" will probably take a while :(

    As for the poster above me... read the thread, there is more to it than dropping a file in the folder.
     
  16. Offline

    Dere011

    And for my problem ? :(

    I explained again my problem:

    NPCTrader load before my multi-worlds plugin.
    It is therefore impossible for NPCtrader to spawn npcs on other worlds (Not yet create during loading NPCtrader).

    You can add a small delay before loading the npcs? Time than other plugins load?

    Thank you.
     
  17. Offline

    zajacmp3

    An idea... I see your todolist is quite empty for now :)

    Could you add to this plugin a command that would repair items? Like on repair shop plugin. Would be nice to have some blacksmith on my half RP server ;)
     
  18. Offline

    Bronski

    You could use the repair plugin and put an iron block (anvil) down next to an NPC named blacksmith or whatever. I know, maybe not exactly what you're asking but just throwing up ideas :D
     
  19. Offline

    zajacmp3

    Way too much work in java ;) This plugin already have a system that focus you to npc when you right click on them :) Developer only would need to figure out how to check and restore with what cost armor etc. :) Also... Is it even possible that someday npc would have own skins?
     
  20. Offline

    Anarchaotic

    Linux users (Ubuntu) look no further:

    I am running Ubuntu 10.10 and was able to get mysql installed and this plugin running.

    Open up terminal and follow the instructions below (This is assuming you have not set up MySQL):

    Commands are formatted as such. You may copy and paste in terminal as they are, except take care to look over them and fill in needed information (YOURACCOUNT, YOURPASSWORD)


    1. sudo apt-get install mysql-server


    2. You will be asked for a password. I entered my local password. When it finished you should be at the terminal window again.


    3. mysql -u root -p

    4. Enter your local password. You will now see mysql> prefix the command line instead of $.

    *** Note: From here on you should know that look for QUERY OK after each mysql command.***

    5. create database minecraft;

    6. grant usage to *.* to YOURACCOUNT@localhost identified by 'YOURPASSWORD'

    7. grant all privileges on minecraft.* to YOURACCOUNT@localhost ;

    You have now setup a MySQL and a new database on linux through CLI!

    I have used the following sites to compile these instructions:

    https://help.ubuntu.com/10.04/serverguide/C/mysql.html
    http://www.debuntu.org/how-to-create-a-mysql-database-and-set-privileges-to-a-user

    Furthermore I take no responsibility for whatever you do to your server by using these instructions. ;)
     
  21. Offline

    Charles Harvey

    So we've been using this for a while and we upgraded to craftbukkit 435 for a new server and we're getting the following:

    [SEVERE] Feb 21, 2011 5:27:22 PM org.bukkit.craftbukkit.CraftServer loadPlugins
    SEVERE: ENTITY_DAMAGEDBY_ENTITY (Is it up to date?)
    java.lang.NoSuchFieldError: ENTITY_DAMAGEDBY_ENTITY
    at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:266)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:140)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:426)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:187)
    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:179)
    at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:166)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:118)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:217)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)

    Causes craftbukkit to stop loading plugins after this point though NPCTrader appears to work.

    EDIT: not sure if that is the correct build. that is what essentials returns.
     
  22. Offline

    Liger_XT5

    I use HotSwap and I had the same issues. I am using the version of bukkit stated in the post for last tested version.
     
  23. Offline

    Anarchaotic

    @charles - Ah, yes... that is why my /home stopped working. Thanks for the detective work Charles...
    I get this as well,
    Im probably not running the correct build, but I will deal with it for now until Notch's update comes out.
     
  24. Offline

    bandit6789

    Same problem here, Craftbukkit build #360
     
  25. Offline

    averad

  26. Offline

    radarwolf

    Please wait with updating to new version and update it in once to MC version 1.3
     
  27. Offline

    MatCat

    Yeah I will update once Bukkit is updated for 1.3
    --- merged: Feb 22, 2011 9:51 PM ---
    There are some good ideas I need to review, I am a bit busy with my real job but as soon as the dust settles with everything I will get to atleast updating the plugin to work with the newest bukkit builds as soon as they are working with 1.3.
     
  28. Offline

    turtlelink2

    its already out (unofficialy i think) but its there on the support page.
     
  29. Offline

    Liger_XT5

    I just recently re-added npctrader to my server and I still got the issue of most of my plugins not working, but npctrader is.
    Currently on the newest craftbukkit that came out after MC 1.3. I also got the following error:

    Figured giving the whole server bootup and shutdown would give you all that is needed.
     
  30. Offline

    captainbinary

    a banker would be awesome =)
     
  31. Offline

    MatCat

    Just did a quick update for it to work on b421+. No new features yet.
     

Share This Page