[INACTIVE][ECON] DynamicMarket v.0.4.8.1 - Versatile Shop Plugin [440-480+?]

Discussion in 'Inactive/Unsupported Plugins' started by HaloInverse, Feb 2, 2011.

  1. Offline

    HaloInverse

    DynamicMarket - Dynamic Global Shop Plugin

    Version: 0.4.8
    Built against: Bukkit 0.0.1 build #412
    Works with: CraftBukkit 0.0.1 builds #440-480 or thereabouts.

    Requires:
    • Permissions 2.5
      • Very recommended, but now optional! See "DynamicMarket.settings" below.
    • iConomy 4.1
    • Either of:
      • SQLite (easiest to set up, reccomended)
      • MySQL (more troublesome, more powerful)
    Buy items, sell items, admins set prices, et cetera. However, there's a lot going on under the hood...

    READ THIS BEFORE PROCEEDING.
    Seriously. (open)

    This plugin has a great deal of flexibility, but the price of more flexibility is more command options to control that flexibility. Computers just aren't very psychic.

    While in-game help exists for commands, the output from /shop help (<topic>) is intended to be a quick reference, not exhaustive documentation. Full instructions simply won't fit on the MineCraft client's tiny text display.

    You should read and understand the following sections before installing this plugin and setting up your shop. If not, you should at least read and understand the following sections while you are setting up your shop items.


    The big feature: Dynamic pricing. Items can be set to increase in price as they are purchased from the shop, and decrease in price as they are sold back, simulating open market conditions. The initial prices of items are just considered a starting point - user transactions will eventually adjust an item's price to a near-ideal level, based on actual value vs. rarity.

    However, as of 0.4.5, the configuration fields are now flexible enough to allow a range of behaviours, from fixed pricing with no stock limits, to fully-dynamic pricing with finite stock levels.

    This is by no means "complete" in the sense of "finished adding features", but it is complete enough to be functional and usable.

    Current Features (open)

    New & Current Features:
    • Buying and selling of items:
      • Item prices can be set to dynamically adjust according to supply and demand. This is highly adjustable, including the rate of price increase/decrease per transaction, optional hard overstock/understock limits, price ceilings/floors, etc. Leaving all the extra features turned off makes an item's price fixed and always-in-stock, like a basic "flat rate" shop.
      • Subtypes of items are fully supported.
      • List of items in the shop is broken into pages, accessible by number.
        • Partial-name searching! "/shop list wood" shows everything with "wood" in the name.
      • Item names for buy/sell/info also use partial substring matches.
      • A dynamically-priced item might cost more for 10 items than the cost of 1 item multiplied by 10, due to stock depletion. So, the "/shop <id>" command now takes an optional ":<count>" parameter, so you can get a quote for the actual buy/sell price of larger numbers of items.
    • Administration:
      • Shop items are edited via a "tag" system, so you don't have to re-enter every field for each small change. Plus there's a few utility tags which do other things to an item's record...
      • Item names are now editable, and will persist (independent of items.db) until the item's record is deleted.
        • This also makes items.db a convenience instead of a necessity, since items can be added by ID and then immediately renamed.
      • A "Default" item exists in the shop, which cannot be bought or sold, but serves as the base data for any new items you add to the shop. Any tags not supplied when you add an item will be copied from whatever you put into "Default".
      • Basic sanity-checking on input data has been added. Also, adjusting an item's bundle-size will rescale its price automatically.
      • Items can be set to be purchasable but not sellable, or vice versa. (Set either price to -1 to disable that transaction type for that item.)
        • Tags like "canbuy:n" and "nosell" can now be used.
      • An extended in-game help system. "/shop help" lists available commands and help topics. "/shop help <topic>" gives help on a shop command or other shop-related topic listed in the main help.
      • The list of commands displayed is filtered by the user's current permission level.
      • Shortcuts for all commands (except for database reset).
      • All commands except for "/shop buy" and "/shop sell" can be accessed through the Bukkit console. No need to log in to add or update items!
      • Access to the entire shop is now restrictable by permission.
      • Highly informative error messages, to help reveal why your database exploded. (Which really shouldn't happen, but you never know...)
      • The shop DB can now be exported to a .csv file, edited in your favorite spreadsheet, and re-imported back into the database, making large-scale changes easier.
      • NEW: The revenue/cost of transactions can now be transferred to another account. With the basic plugin, this can be an admin's iConomy account, or a dummy "GovernmentBank" account. (Don't use that name, or some bright spark will register that username and exploit you.) With a wrapper plugin, this can be set to link a shop's funds directly to an owning player's iConomy balance.
      • NEW: Transaction logging to a comma-delimited file, ready to import into a spreadsheet for nefarious financial analysis!

    Market Mechanics (open)

    Quick Market Mechanics Description:
    • Instead of a "buy price" and a "sell price", items now have a "base price" and a "sales tax". The "buy price" is based on the base price (adjusted by stock, if set to do so), and the "sell price" is based on (<buy price> - <sales tax%>). So if the sales tax is set to 25, then an item's selling price will be 75% of its purchase price. (The sales tax is entered as a number from 0 to 100, representing 0% to 100% tax.)
      • Using the old "/shop add <id> <buyprice> <sellprice>" format still works - the plugin just calculates the base price and sales tax, so that the buying and selling prices come out right.
    • Shop items have a "stock level", which is not necessarily a literal count of items in stock. By default, the stock level is considered an offset from baseline, rather than an absolute count.
      • Items with stock near zero are considered to be in "average" supply, and will be priced at their base price.
      • Items with a positive stock are considered "in surplus", and will be priced below their base price.
      • Items with a negative stock are considered "understocked", and will be priced above their base price.
      • This interpretation of stock levels can be made to behave like literal counted stock, by setting an item's StockFloor to zero, which prohibits negative stock.
    • Items have a "volatility", which indicates how quickly the price changes based on changes in stock level. It represents the percent increase in an item's price per item purchased, multiplied by 10000. V=1 (the lowest level) means that 100 items would have to be purchased to raise the price by 1%. V=10000 (the highest level) means that 1 item purchased would raise the price by 100% (doubling the price). (More examples in tags.txt)
      • There is also "inverse volatility", which represents the number of items needed to be bought in order to double the buying price (or halve it, if selling). This is more convenient for some people's mindsets, and is converted into volatility when entered.
    • The "sell price" is actually calculated from the buy price at the current stock level + 1, rather than the current stock level. This is to prevent gaining endless money by buying an item (driving the price up) then immediately selling it back (dropping the price) - if <sales tax> = 0, then buying-then-selling like this produces zero net gain/loss (as it should).
    • The tag presets "fixed", "float", "finite", and "flat" allow you to quickly set up common options. If used with the "Default" item before adding items to your shop, this will allow you to set the overall behaviour of the shop easily. See Tag Reference for further details.

    Commands (open)

    Commands:

    <Angle Brackets> denote parameters.
    (Round Brackets) denote optional sections.
    The brackets themselves are not part of the command; they are just used to describe syntax. Brackets should not be typed.
    If executing shop commands through the Bukkit console, leave off the initial slash.

    /shop - Shows the main help page. Lists commands and shortcuts.
    /shop help - Ditto.
    /shop help <topic> - Shows help on the given command or subject.
    /shop help tag <tagName> - Shows help on the given item tag.
    /shop <id>( :<count>) - Shows current buy/sell information on the given item.
    <id> can be an item name or a type number with an optional subtype:
    <id> = <itemName> | <itemID> | <itemID>,<subtypeID> | Default
    If <count> is used, shows the total price for the given number of items/bundles.
    /shop list (<partname>) (<pageNum>) - Lists a page of items in the shop. Default page = 1.
    If <partname> is used, lists only items with <partname> as part of their name.
    /shop buy <id>( :<quantity>) - Purchases an item. Default quantity is 1 bundle.
    /shop sell <id>( :<quantity>) - Sells an item. Default quantity is 1 bundle.
    /shop add <id>( :<bundleSize>) (<buyPrice> (<sellPrice>)) <tagList> - Adds an item to the shop list.
    <buyPrice> and <sellPrice> are accepted for convenience, and are internally converted to BasePrice and SalesTax.
    Unused tags will have their data copied from the Default item.
    Transactions will be in multiples of <bundleSize>. Default quantity is 1 item per bundle (unless overriden with the Default record)
    /shop info <id> - Shows much more detailed information about an item in the shop, such as stock level, volatility, etc.
    /shop update <id>( :<bundleSize>) (<buyPrice> (<sellPrice>)) <tagList> - Edits an item's shop data record.
    Data is first copied from the old record, then tags are applied in order of entry.
    NEW! <id> can be "all", applying changes to all items in the shop list.
    /shop remove <id>- Removes an item from the shop list.
    /shop reload - Reboots the plugin, reloading the configuration file and items.db.
    /shop reset - Deletes and recreates the shop database from scratch. Asks for an extra confirmation before doing so.
    /shop exportdb - Exports the shop database to a .csv file. The name and location are configured in SimpleMarket.settings. (Default: Plugins/DynamicMarket/shopDB.csv)
    /shop importdb - Imports a .csv file into the shop database. Same file location as used by the exportdb command. Note that the previous contents of the database are NOT cleared out before importing, so you may want to do a "/shop reset" before importing. The file's format MUST match the format of the exported file (except for quote marks, which are stripped out on import).

    Tag Reference
    Tag Usage Examples
    Permissions (open)

    Permissions:

    'dynamicmarket.access' : Grants basic access to the root /shop command.
    'dynamicmarket.buy' : Grants purchase rights.
    'dynamicmarket.sell' : Grants selling rights.
    'dynamicmarket.items.add' : Grants the ability to add new items to the shop.
    'dynamicmarket.items.update' : Grants the ability to edit items in the shop.
    'dynamicmarket.items.remove' : Grants the ability to remove items from the shop.
    'dynamicmarket.admin' : Grants the ability to delete-and-rebuild the shop database, and to reboot the plugin.

    Installation/Setup (open)

    Installation/Setup:
    • If you haven't already done so, install Permissions and iConomy, and ensure they work.
    • Copy DynamicMarket.jar into your Plugins/ folder.
    • NEW: Copy items.db into Plugins/DynamicMarket/ (or whichever directory you specify in DynamicMarket.settings) (DynamicMarket will work with other plugins' items.db files, but not all plugins will handle the extra subtype data in the items.db linked below.)
    • NEW: Copy either the SQLite connector or the MySQL connector into your main MineServer/Bukkit folder.
      • Or, if you have a MySQL server running, edit DynamicMarket.settings to specify the MySQL server, login, and password.
    • Edit plugins/Permissions/config.yml, and give everybody the appropriate permissions.
      • Most users would get 'dynamicmarket.access', 'dynamicmarket.buy', and 'dynamicmarket.sell', unless you want to restrict such commands to registered/VIP users.
      • Mods would probably get 'dynamicmarket.items.*'
      • Admins should get 'dynamicmarket.admin', if they don't already have '*'.
    • (Re)Start your MineCraft server. Errors may be thrown to the console, but the file Plugins/DynamicMarket/DynamicMarket.settings should be created.
    • Edit DynamicMarket.settings. Particularly, the setting "database-type".
      • "database-type=sqlite" : Use the SQLite connector. This is the simpler option. No further database access configuration should be needed.
      • "database-type=mysql" : Use the MySQL connector. You will need to set the options "mysql-user", "mysql-pass", and "mysql-db", as well as having a working MySQL server installation set up already.
    • NEW: Log in to MineCraft as someone with 'simpleMarket.admin' permission, or use the Bukkit console. Use "/shop reload" to load the edited config file.
    • Use /shop add to fill the market with tasty blocks at scandalous prices.
      • You WILL want to use "/shop update default" to set up some sensible default values for the items you will be adding, so you don't have to do so much typing for every item. (Or at least inspect the Default entry, to be sure you agree with it.)
      • If you want to make all of the items in the shop use dynamic pricing, set up the parameters in the Default item FIRST, so you don't have to go back and modify 100+ items to support variable pricing.

    DynamicMarket.settings Reference

    Downloads:
    • DynamicMarket 0.4.8.1 (.jar) (.7z) (iConomy 4.1, Permissions 2.5)
    • DynamicMarket 0.4.8 (.jar) (.7z) (iConomy 3.0, Permissions 2.1)
    • DynamicMarket 0.4.6.1 (.jar) (.7z) (iConomy 2.1 / Cookies+iConomy Wrapper)
    • DynamicMarket Source on GitHub
    • items.db <-- Contains subtypes. Put this in /Plugins/DynamicMarket/.
    • SQLite Connector (reccomended) Put this in your MineCraft server/Bukkit root.
    • MySQL Installation Guide (not so easy, probably not recommended for SQL server beginners)
    • Sample shopDB.csv Many (but not all) items, set up for floating-stock+floating-prices. Edit it if you like, then put this in your Plugins/DynamicMarket folder and use /shop importdb to load the items into your shop.
    DynamicMarket Wrapper Plugins:
    • DMWrapper: Restricts shop access to specific regions. Outdated.
    Want to integrate DynamicMarket's shop functions into your own plugin? Read this!
    To Do List(s) (open)


    To Do for v.0.5:
    • Logging of transactions. Done.
      • Global messages to alert to price changes.
    • Item classes: Use Permissions to control access to certain types of items, i.e. make safe items (gravel, stone, iron) available to anyone, but limit traffic in dangerous items (TNT, lava buckets, monster spawners) to VIPs. (For example.)
    • Customizable interface/highlight colours. Done.
    • Clean up the d*** out-of-date comments in the code. (Working on it.)
    To Do before 1.0:
    • Optional auto-transactions triggered by price disparities in raw/processed materials.
    • Possible migration of the new help system to a separate plugin, unless the expanded features needed become available in MCDocs or Bukkit.
    • Migrate config file handler to Yaml.
    • Random fluctuations of stock levels (would make the market more lively on a low-population server)
    • Stock levels drift back to rolling averages (smoothes out short-term price spikes, allows for long-term price drifting)

    Recent Changes:

    0.4.8.1:
    • Migrated to Permissions 2.5, iConomy 4.1.
    0.4.8:
    • shopLabel moved from a table name suffix to a table field.
    • Using "all" as the item name now applies the given tags to all items with the current shopLabel.
    • Altering an item's bundleSize now changes its stock level, as well as its basePrice.
      • New stock level is rounded down, to stave off future item duplication issues.
    • Sanity-check behaviour changed to make database queries more efficient and fend off future exploits:
      • stockHighest/stockLowest set to stock if lower/higher than stock.
      • stockCeil/stockFloor is set to stockFloor if lower/higher than stock.
      • priceCeil is raised to priceFloor if priceCeil<priceFloor.
        • Previous behaviours: Swap if order wrong, range-crop stock if outside highest/lowest/floor/ceil.
    • Fixed bug: Adding items without specifying count did not import count from default record.
    0.4.7:
    • Upgraded to iConomy 3.0.
    0.4.6.1:
    • Rolled back iConomy calls to 2.x style, to be compatible with Cookies' iConomy wrapper.
    0.4.6:
    • Support for transaction funds to be backed by an iConomy account.
      • Account link parameters added to wrapper-call messages.
    • Wrapper calls streamlined.
    • Added basic transaction logging.
    0.4.5:
    • Volatility can now go as low as 0.
      • In this way, stock can still be counted without affecting price.
    • CSV import/export now uses +INF / -INF as shorthand for min/max values in applicable fields.
    • Message colours now customizable in DynamicMarket.settings.
    • Expanded help on tags/presets.
    • Changed "fixed" tag, splitting its function with "flat".
    • Added tag presets "flat" and "finite".
    • Updated tag "renorm" to accept an optional new stock level other than 0.
    Full Changelog

    Credits:
    • Nijikokun: SimpleShop v.1.1, on which this was based. (And for Permissions and iConomy, on which this relies.)
    • AtomicAcidBath: Assistance with tracking down a hard-to-see MySQL syntax error.
     
    SoapFlakes and Mahngiel like this.
  2. Offline

    dslip

    Would it be possible to get a forked version that uses a different command? I would like to run both LocalShops & Dynamic Market. Dynamic market as a global shop (only available to players in a certain group) and Local shops available to all players.

    Thus I would really appreciate being able to have /shop for localshop, and /gshop (or dshop) for DynamicMarket.
     
  3. Offline

    Magik

    I was gonna take a look at @Andreas Brisner 's source later with a diff utility. Did you start from Halo's 4.8.3 release or ninjokun's 4.8.3.1 release?

    My version just updated Halo's 4.8.3 release to be compatible with iconomy 4.4.5 - and I also have a handful of sqlite bugfixes in there. SQLite doesn't seem to like it when a connection to the DB is left open ( it locks the whole table!? wtf ). And Java's garbage collection isn't happening quickly enough after Halo forgot to close out the connection a couple of places ( he does have the close() being called in the finalize() - the closest thing to a destructor Java has ). So basically wherever he creates a new SQLHandler object, he must ensure it gets closed() before another one gets created.

    Really SQLHandler should be a singleton - that would alleviate a LOT of these problems.... and it's more efficient - it's always better to keep the old connection open than to create a new connection to the DB every time you want to run a DB operation.....

    @Oscarius - I believe there are multiple forks out there for this plugin in lieu of HaloInverse updating it - use whatever version works for you.... I'm not trying to fight with anyone else here on this plugin - we're all just trying to get it to a point where it's usable on our own servers.... ( at least that's my goal - I have a plugin that adds on top of this one, and I need this plugin to work first before I start working on that one )

    odd.... I do my testing on windows 7 and my version seemed to work fine - no PluginEnabled errors in console or anything... and the version I forked from HaloInverse's 4.8.3 already has a check in onPluginEnabled to look for pluginname of "iConomy" .... maybe you forked from his source earlier before he added that?

    When I researched this, it appears as if SQLite SHOULD handle a LIMIT clause in an UPDATE statement ( it works in SELECT statements ) - but as far as I can tell, it does not like UPDATE's with LIMIT's in them ( it throws an error/exception ).....
     
  4. Offline

    Andreas Brisner

    Magik:
    Mine is from before Halo updated to 4.0

    My source doesnt close the connection, it keeps it open..

    heh.. My first edition was useable for me, but noone else :p

    Yours doesnt hook in to iConomy correctly afaik(Didnt look that closely). When I showed it to niji what halo did he went "NO NO NO" And it used onpluginenabled when I forked it..

    And btw, I cant even find where you updated the SQLite thingy..
    [MERGETIME="1299683760"][/MERGETIME]
    That is weird, it was the opposite for mike guy.. :p (Or maybe I didnt update the jar *check*)
    [MERGETIME="1299683851"][/MERGETIME]
    Update! Seems to have been my mistake.. .jar updated
     
  5. Offline

    Magik

    I wonder... do you run your server with aggressive garbage collection options? Or do you use just default options? ( i.e. java -jar craftbukkit.jar, or something more complex with a handful of CLI switches? )

    Halo did code a connection closer in the "destructor" - the finalize() method of the SQLHandler object - I wonder if with aggressive garbage collection, that the SQLHandler object gets this method called before the next SQLHandler is created with aggressive GC.... that might be an answer as to another difference in execution environments - and why we are all seeing different things happening with similar codesets...


    https://github.com/magik/DynamicMarket/commit/7e6d6f3848654f9966dbcb1d62e33357a2e96f2d
    - src/com/gmail/haloinverse/DynamicMarket/DatabaseMarket.java
    - ~line 352 - added a myQuery.close(); there

    https://github.com/magik/DynamicMarket/commit/4098fd104c9ffcb2831383b2e2a8d19c37618467
    - src/com/gmail/haloinverse/DynamicMarket/DatabaseMarket.java
    - ~line 63 - added myQuer.close() before the return

    not too familiar with git/github commits/diffs?
     
  6. Offline

    Niels

    Hi,

    Love the plugin, I think its really great.
    But I cant get it working
    I did as you said and read it multiple times.
    I get the same error over and over.
    After it tries to create the database it fails.
    Can someone help me with this, what am I doing wrong?
    Because I would love to use this plugin ! :)
    Thanks in advance everyone!
    Untitled.png
     
  7. Offline

    Magik

    try Andreas' or my version posted in the last couple pages of this thread? Short of that, we need more info to be able to diagnosis this properly. What build of craftbukkit/iConomy/Permissions are you using?
     
  8. Offline

    Niels

    Thanks for your reply Magik.
    I tried your version you posted and now its all working.
    Thanks mate !!! love the plugin :D
     
  9. Offline

    Beaverbeliever

    I just read through the thread. Perhaps Magik and Andreas can work together, since they seem to be more active than Halo on this project :p

    There seems to be a handful of errors that can be fixed if there were two minds designated on it. Also, it would be cool to see Magik's DMWrapper to be fixed as well, that would be great [​IMG]
     
  10. Offline

    Magik

    yeah I wouldn't mind working together... it's just I don't know how much time I have to dedicate to developing... It's kinda slow at work right now so I have some time to dick around ;) But I can't guarantee I'll be around - that's why I post my source on github, so anyone can pick it up if need be.

    But also, I don't want to waste too much time collaborating either, or setting it all up. I think I would need at the minimum some git + github version control....
     
  11. Offline

    Hoddie54

    Code:
    rg.bukkit.command.CommandException: Unhandled exception executing command 'shop' in plugin DynamicMarket v0.4.8.7
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:33)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:80)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:183)
    at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:619)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:582)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:576)
    at net.minecraft.server.Packet3Chat.a(SourceFile:24)
    at net.minecraft.server.NetworkManager.a(SourceFile:230)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:357)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:272)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.lang.NullPointerException
    at com.gmail.haloinverse.DynamicMarket.DatabaseMarket.data(DatabaseMarket.java:335)
    at com.gmail.haloinverse.DynamicMarket.DatabaseMarket.getDefault(DatabaseMarket.java:427)
    at com.gmail.haloinverse.DynamicMarket.iListen.shopAddItem(iListen.java:746)
    at com.gmail.haloinverse.DynamicMarket.iListen.parseCommand(iListen.java:1075)
    at com.gmail.haloinverse.DynamicMarket.DynamicMarket.onCommand(DynamicMarket.java:148)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:31)
    ... 12 more
    Using iConomy 4.4.5 and CB 493. CentOS.
     
  12. Offline

    Andreas Brisner

    @Magik: My startup code
    Code:
    screen -dmS server1 java -server -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=250 -XX:+UseGCOverheadLimit -Xnoclassgc -XX:UseSSE=3 -XX:ParallelGCThreads=2 -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -d64 -Xincgc -Xmx5G -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
    Databasemarket.jar Line 352 =
    return fetchedData;

    Line 63 == Inbetween protected void checkNewFields() {} and protected boolean createTable(String shopLabel) {}

    Look at my github, the code I have is not the same as the one you have. And yes I can read diffs on github :p But when the code isnt the same it gets a little harder.
    [MERGETIME="1299693096"][/MERGETIME]
    SQLite or MySQL? For some reason this happens when SQL doesnt have the new field it should have.
    Only way I could reproduce this was to manually delete the field from MySQL :-/
    [MERGETIME="1299693173"][/MERGETIME]
    What would be the purpose of this wrapper? I still dont get it.. :S
     
  13. Offline

    Hoddie54

    Yes MySQL. Hm.... Should I use SQlite instead?
     
  14. Offline

    Andreas Brisner

    God no! I use MySQL myself.. Can you make sure you have a field called shoplabel?
    If you dont
    ALTER TABLE Market ADD shoplabel CHAR(20) NOT NULL DEFAULT ''

    the '' is part of the SQL
     
  15. Offline

    Beaverbeliever

    Magik can probably give a more detailed answer than I can, but basically it only allows DM to be used in specified regions. I like it because in my server, it makes Town's significant.

    The plugin by Magik can be found here.
     
  16. Offline

    Andreas Brisner

    Well, thats not very realistic, is it? Today you can order anything anywhere irl
     
  17. Offline

    Hoddie54

    Soz. I'm a MySQL n00b. I found it hard enough to install it. I've logged into MySQL. What do I type from there?
     
  18. Offline

    Magik

    I see having a global shop as cheating in some respects - it all matters on what the global shop sells.

    For example, if tools are sold ( picks and whatnot ) then one could be at the bottom of a mineshaft and just /shop buy ipick to get more tools.

    I like playing as true to the original minecraft view as possible. I used to play Dwarf Fortress a lot too - part of the fun of this game is the challenge and effort taken to build/make/dig something.

    DMWrapper was initially released like that back when Halo just started this plugin. I wanted to re-use his code, but also restrict command usage, so I wrote a wrapper around his plugin that dealt with commands - it would intercept and handle player commands and pass them to DynamicMarket if allowed. It also had tools to setup multiple shop locations.

    It's basically just adding location-restricted shop usage and tools to modify/add/delete shop locations.
    [MERGETIME="1299695090"][/MERGETIME]
    it matters what databases/tables you have setup.

    For example, my database is called iconomy with the table called Market.

    I would do this:
    use iconomy;
    ALTER TABLE Market ADD shoplabel CHAR(20) NOT NULL DEFAULT '';
     
    Beaverbeliever likes this.
  19. Offline

    Andreas Brisner

    Actually I would check if it exists first.. :p
    [MERGETIME="1299695222"][/MERGETIME]
    Magik, do you have skype ?
     
  20. Offline

    Magik

    interesting.... on my development station I don't use any of the garbage collection switches.... maybe I'll try adding some of these.... On my server I use similar switches, not the same though:
    Code:
    java -server -Xms1024M -Xmx1024M -cp mysql-connector-java-5.1.14-bin.jar:craftbukkit.jar  -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts org.bukkit.craftbukkit.Main
    you know you could use a diff tool to compare the two source files... you'll see when I say line 353 of my code, it aligns with line 380 of your code....

    and the line 63 i spoke of is inside the if() on your line 67
    [MERGETIME="1299695420"][/MERGETIME]
    I do, but I'm at work right now ;) so no skyping for me here
     
  21. Offline

    Hoddie54

    it matters what databases/tables you have setup.

    For example, my database is called iconomy with the table called Market.

    I would do this:
    use iconomy;
    ALTER TABLE Market ADD shoplabel CHAR(20) NOT NULL DEFAULT '';[/quote]

    Code:
    ERROR 1060 (42S21): Duplicate column name 'shoplabel'
    
     
  22. Offline

    Andreas Brisner

    Ok, so it already exists, but you still get the error.. Funny :3
     
  23. Offline

    Hoddie54

    I'll try with SQlite? Should I see?

    Edit: I'm running 493. CentOS.
     
  24. Offline

    Andreas Brisner

    Magik, this looks kinda weird doesnt it?
    " fetchedData.shopLabel = shopLabel;"
    If anything it should be the other way around :-/
    Do you know what the purpose of the shopLabel is?
    [MERGETIME="1299696386"][/MERGETIME]
    And no, there shouldnt be a reason for you to change to sqlite
    [MERGETIME="1299696496"][/MERGETIME]
    Hmm, do you have the default line in sql?
    select * from Market limit 1; should show you a row with name Default.. Does it do that?
     
  25. Offline

    Magik

    where is that code?
     
  26. Offline

    Andreas Brisner

    Databasemarket.java line 330
     
  27. Offline

    Hoddie54

    mysql> SELECT * from Market limit 1;
    Empty set (0.00 sec)
     
  28. Offline

    Andreas Brisner

    INSERT INTO `Market` (`item`, `subtype`, `name`, `count`, `baseprice`, `stock`, `canbuy`, `cansell`, `volatility`, `salestax`, `stocklowest`, `stockhighest`, `stockfloor`, `stockceil`, `pricefloor`, `priceceil`, `jitterperc`, `driftout`, `driftin`, `avgstock`, `class`, `shoplabel`) VALUES
    (-1, -1, 'Default', 1, 0, 0, 1, 1, 1, 0, -2147483648, 2147483647, 0, 0, 0, 2147483647, 0, 0, 0, 0, 0, '');
     
  29. Offline

    Hoddie54

    Query OK, 1 row affected (0.13 sec)

    Will test now and edit in the result.

    Edit: seems to work fine. Havn't tested thourougly.

    Edit 2:
    Code:
    org.bukkit.command.CommandException: Unhandled exception executing command 'shop' in plugin DynamicMarket v0.4.8.7
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:33)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:80)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:183)
    at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:619)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:582)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:576)
    at net.minecraft.server.Packet3Chat.a(SourceFile:24)
    at net.minecraft.server.NetworkManager.a(SourceFile:230)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:357)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:272)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.lang.NullPointerException
    at com.gmail.haloinverse.DynamicMarket.DatabaseMarket.data(DatabaseMarket.java:335)
    at com.gmail.haloinverse.DynamicMarket.iListen.shopUpdateItem(iListen.java:795)
    at com.gmail.haloinverse.DynamicMarket.iListen.parseCommand(iListen.java:1088)
    at com.gmail.haloinverse.DynamicMarket.DynamicMarket.onCommand(DynamicMarket.java:148)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:31)
    ... 12 more
    Edit 3: Only happens when I use "wood" instead of "5"

    Edit 4: /shop -b wood 2
    Does not work

    /shop -b 5 5
    Only gives me one woodenplank
     
  30. Offline

    Andreas Brisner

    On line 335 I have a } :p
    [MERGETIME="1299698397"][/MERGETIME]
    What version are you using? Original, Magik's or mine?
     
  31. Offline

    Hoddie54

    I think it's yours.
     

Share This Page