[INACTIVE][ECON] TradeCraft v0.7 - Chest/Gold Based Economy! [531]

Discussion in 'Inactive/Unsupported Plugins' started by mjmr89, Mar 11, 2011.

     
  1. Offline

    mjmr89

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    TradeCraft - Chest/Gold Based Economy
    Version: 0.7

    Features
    • Make infinite shops - place gold or items in the chest, right click the sign, and watch the magic happen!
    • Become entrepreneurs! Have a lot of extra goods? Create a shop to let people easily buy or sell!
    • Change the currency if you don't like gold
    Download and Source

    All credit for the core of this mod goes to the github user jdiamond (injektilo on the hey0 forums). All I'm doing is porting it at the moment, but I'll probably add more features down the road. I haven't been able to test it extensively so far, so expect problems! If you don't have Permissions, it will resort to only letting ops make or destroy shops, but all players can buy/sell at shops. The TradeCraft.txt and TradeCraft.properties files are IN the jar, open it up with a archive manager program and extract them to the same folder as your craftbukkit.jar. I know they should be in something like plugins/TradeCraft, and I'll change that soon.

    For the readme, please go to the source page and look there. It is also included in the jar file if you open it with an archive manager.

    Permissions:
    • TradeCraft.canBuy
    • TradeCraft.canSell
    • TradeCraft.canMakeInfShops
    • TradeCraft.canMakePlayerShops
    • TradeCraft.canDestroyShops
    Commands:
    • /setCurrency - use the id number, or the material name (using _ as spaces)
    • /displayCurrency - Shows the current currency
    • /canPlayer - debugging info if there are problems with permissions - outputs to the console.
    • /myShops - displays the personal shops you have and their current inventory/gold
    To Do:
    • Repair shops? Some basic structure is in the old hmod plugin, could probably get it working without too much trouble.
    • iConomy interaction? For example, back up iConomy $$$ with gold or something? Not sure how that would work out, or if people would find it useful.
    If theres any more comments or questions, please let me know!
    kenneth123, ydido and Digi like this.
  2.  
  3. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think there were a few normal items (so, plain ID, not using damage bits) that wouldn't work. Maybe records are one of those, but I can't quickly test that. They might not be working in TradeCraft because of their high ID).
  4. Offline

    yli

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    It seems that most of the permissions aren't working properly. Any player can buy, sell and create infinite and player owned shops.

    Another problem is the lack of support for dyes and dyed wool.

    Otherwise pretty much perfect.
  5. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Well, with the Permission plugin installed and setting the right permissions to the different groups according to the README in the .jar file, it works just fine here.

    True. But not until CraftBukkit #564+ are all Block API functions thread safe. The developer for MinecartMania waited for that to support wool colors (etc) too. Now we just need to wait for a new recommended build of CraftBukkit...
  6. Offline

    Digi

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This plugin is awesome but it lacks some features.

    - The wool, dye, log, etc sub-items (just re-mentioning, I understand it's gonna be possible in #564+)
    - Protection of chest contents while you're using it... or something, so other people don't just sit by and wait for you to buy and steal your stuff.
    - The sign labels would be better understood if they're: "Buy 5 for 1" and "Sell 5 for 1" and you should suppot texts like "Buy 5 for 1g" or "Buy5for1" etc.
    - The sign shouldn't require you to type your name since you can only make shops for yourself, it should overwrite the last line with your nickname.
    - Additional information about current amount of items and currency available when right clicking as client.

    Hope you release an updated version soon :} apart from that, everything is working right.
  7. Offline

    Xin_TiGeR

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    OMG!!! MAJOR BUG!!

    i gave my players abilities to create playershops, use buy shops and sell shops, and they can pretty much create an infinite chest with their own ratio!!

    plz fix this :(
  8. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I've thought about that and was about to play with the code (and github and stuff, for personal practice mostly) when it occurred to me that this shouldn't be possible. Unless there's a deeper underlying bug.

    With a player shop the one who setup the shop provides items in the chest. One item A is sold for X (let's assume gold ingots) and bought for Y.
    When an item is sold to another player, that player has to provide X. The seller loses one item A and gains X. The buyer loses X and gains item A. There's a balance here. Nothing disappears and nothing is created.
    When someone sells one A to the player shop, the shop gains one item A, but loses Y. The player selling the item at the shop loses the item A and gains Y. Again there is balance.

    Even if someone sells their items for no money, then they just give existing items away. Or when they setup to buy for nothing, then it's practically a drop box.

    Unless somewhere the plugin doesn't keep track of amounts correctly, there should be no possibility to create an infinite chest.

    If you manage to have two players, one starting with a certain amount of items, another with a certain amount of gold ingots. And by using one (ore multiple) new tradeshop-chests, they manage to gain more of the item and more of the gold ingots (between the two). Then please explain how they did so.

    Or maybe I'm oblivious and totally looked over something. But then also feel free to explain :)
  9. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    So I've poked around in GitHub and Eclipse and finally created a pull request that fixes the issue where one could destroy signs by breaking the block behind the signs (sorry for the one with a stupid bug which I cancelled).

    Then I went on to make TradeCraft support CB 602. But since I didn't branch right after forking your project I couldn't base that change on the initial fork anymore (I mean, it wouldn't have the block-break changes. Or maybe I need to learn more about github). And I didn't want to start over because that would probably break the pull request.

    So I can send a new pull request that includes both the block break and 602 support. Though the 602 support isn't that much work. I could just make that pull request so you could look at the diff and implement it all yourself of course.

    Btw, about the block-destroy fix. I'm not completely happy about me creating TradeCraft.getShopsFromBlock(). But that's more caused by the way these getshop methods are used in two different situations (sign interaction and object breaking). It works. But it's a little bit of a mangle. I'm not sure how else it should be done to keep the situation separate, or whether it really should. Maybe I'm over-analyzing it too much.

    Also, I see you're creating a new .properties file upon first use. But shouldn't it copy the file that's in the package? Perhaps do the same for the .txt file. That way the player has a working setup right away, by just installing the .jar file. I've done that for my own little (so far unpublished) plugin too and it isn't too hard. You just need some decent examples. And I guess when this is being changed it's time to move these files into a plugins/TradeCraft map (which will require converting/moving the old files I guess, at least the data file).

    Sigh, I've been thinking about this too much already. :)
  10. Offline

    FXStrato

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'm guessing this doesn't work with Build 602 yet.
  11. Offline

    Fralexxelarf

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    please update it! cause it's an awesome plugin! :D
  12. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    So I've been tinkering around (if you want the fill pull request, mjmr89, let me know, or look at https://github.com/ArmEagle/TradeCraft/tree/experimental):
    - CB 617 supported
    - Prevents breaking of block when signs are attached to it of shops you cannot destroy
    - Moved location of configuration files to plugins/TradeCraft/
    - If no config files are found, default config files (.properties, .txt) are copied over from the .jar

    Note:
    To keep your currently active shops, move the TradeCraft.data from the main path into "plugins/TradeCraft/" (create that last dir).

    Edit
    Also copy over your two other files, TradeCraft.properties and TradeCraft.txt
    /Edit

    Consider this a test build, so keep backups! I haven't seen any issues, but I haven't been using this on a busy server yet either. Of course you have to unzip this file and place it in your "plugins/" directory.

    Edit:
    Though nothing seems to have changed I decided to recompile for CraftBukkit #617:
    download TradeCraft.jar here
  13. Offline

    ronix

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks! The Tradecraft CB 602+ works perfect on my server running MC 1.4.
  14. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    There is an issue with sign placing in CB 612, though the plugin seems to be working just fine regardless. It's fixed in CB 613.

    Edit:
    Ah it was late last night when I noticed the issue.
    The issue occurs when a player places a sign, at which point an error was thrown. This happens in the place of the code where TradeCraft checks for permissions (place infinite shops, etc). So it would fail to apply permissions when the error was thrown and also wouldn't keep correct track of shop ownership.

    So, that's why you might want to upgrade CB to 613+.
  15. Offline

    ronix

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Ah, ok, I saw this popping up in one of the commits. Thanks, I will CB 613+.
  16. Offline

    megamix34

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hi !

    Doesn't work with CB 617

    Code:
    2011-04-01 15:01:33 [SEVERE] BLOCK_RIGHTCLICKED loading TradeCraft v0.7 (Is it up to date?)
    java.lang.NoSuchFieldError: BLOCK_RIGHTCLICKED
        at com.mjmr89.TradeCraft.TradeCraft.onEnable(TradeCraft.java:72)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:514)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:216)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:94)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:72)
        at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:215)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:202)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:142)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:257)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    is there a solution ?
  17. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Try downloading the jar I linked just 5 posts ago: http://forums.bukkit.org/threads/ec...old-based-economy-531.8071/page-5#post-168207
  18. Offline

    nawoki

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I have used TradeCraft CB617:ArmEagle's version since CB531:eek:riginal version.

    In my server, currency have changed to other materials. (by use "/setCurrncy")
    But, TradeCraft fix currency to GOLD_INGOT when server startup.

    Though unofficial, I believe that we can change the currency by "TradeCraft.properties" in "currency-id".
    Because "TradeCraftPropertiesFile.java" called "currency-id" in line 60. (original is 34)
    However, it was impossible to change after all.

    I am recompile "TradeCraftPropertiesFile.java" and am using it,
    But I want to use it without recompiling anything in reality.
    Please enable the change of the currency in "TradeCraft.properties" or let me preserve the currency setting.
    And... If it is permitted, please enable the change of the default currency name. (ex. change "GOLD" to "MONEY")

    I am sorry in poor English.
  19. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hi, when I have time I'll look into make that setting more permanent. From what I've seen the port from hMod left around some unused code (like the repair shops, which are mentioned in the properties file too, I think).

    I'm confused about your last point though. You only want to change the NAME of the set currency, unrelated to the actual used ID?
  20. Offline

    nawoki

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    As a matter of fact, I am ignorant for Java, so I do not know the operation of the repair shop well.
    I'll test by my server whether other settings (on TradeCraft.properties) are enabled.
    My recompilation serve my purpose, all right.
    And, please try slowly when there is time.

    I'm sorry to post vague explanation.
    Yes, I want to change the NAME of the set currency arbitrarily.
    ex.)
    (console message from TradeCraftItemShop.java)
    You can sell 1 CAKE for 2 $.
    But may be related to the actual used ID.
    ex.)
    (console message from TradeCraftItemShop.java)
    You can sell 1 CAKE for 2 COOKIE.
    I think that the latter is more better.
    This was my last point.
  21. Offline

    PowerSet

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Perhaps I messed a few things up since I'm still new at setting up a server, but the only permissions I see for this plugin are for buying selling making and destroying shops.

    I have just added this plugin, and have the permissions 2.5.5 plugin(the newer groups version) and without adding any permissions, by default it seems that although no players can do anything with shops, they can all set the currency.

    I don't know a think about java coding, or else I would attempt to add the permissions key myself, so I figured I would both let the community know about this(if it is in fact possible, and not some oversight of my own fault) and humbly request a small bit of help, either re-encoding the plugin or maybe pointing me in the direction of where I went wrong.

    Thanks.
  22. Offline

    Red_Pepper_rus

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    It does not work! :mad:
  23. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'll look into that.
  24. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yeah I've read a mention of that and I did see some code that made it less strict. But it was missing in other places.
    In the next update I've added a config setting (.properties file) "strict-playershop-owner-name" which defaults to true. But if you set it to false, the plugin should allow the sign to hold just the start of a player's name.

    I know there are some plugins that can give players aliases and I guess at some point I could look into using that.
    Red_Pepper_rus likes this.
  25. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Well, here's a new update, version 0.9AE (CB 617):

    Download it here (fyi, link didn't change, file was just updated).

    (And to mjmr89: all changes are in the experimental branch.)

    DELETE the plugins/TradeCraft/TradeCraft.properties file before starting the server again!

    Changelog:
    • Configuration/.properties file is reformatted and now successfully loaded (code was missing call to .load()).
    • Currency is saving and used correctly now.
    • All references to "gold" are replaced by the name of the current set currency.
    • setCurrency should now follow permissions, using TradeCraft.canSetCurrency permission entry.
    • Use bukkit functionality to get the max stack size for an item type.
    • Prevented invalid object type to be set as currency (not existing name/id).
    • Added properties setting "strict-playershop-owner-name" (default true). If true the player name on a shop sign has to match the actual player name. If set to false, the actual player's name only has to start with the name set on the sign.
    • Prevents the plugin to register event listeners multiple times when it is disable and then enabled.
    • Prevents event listeners from triggering when the plugin is disabled (really need to be able to unhook listeners).
    • Clears some memory use on disabling.
    • And probably some other small changes I already forgot about.

    These were a lot of changes and I did test most of them. But there could be some things I didn't think about. So please report any issues you have.
    Digi and Red_Pepper_rus like this.
  26. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Oh, I forgot to mention that you really want to remove the TradeCraft.properties file before you start the server. The old config is not compatible.

    Todo for the future:
    - repair shops
    - support player name aliasing plugin(s)
    - plugin priority stuff
    Red_Pepper_rus likes this.
  27. Offline

    Red_Pepper_rus

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    ArmEagle, Thank you SO much! You're the greatest!
  28. Offline

    happyknife

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hiya, I'm currently running a server on Bukkit, its upgraded to 1.4_01. Its managed by clanforge so I'm running the version of TradeCraft which is available, which is 0.81AE.

    I've been having problems setting my own items to be able to be sold. I have no problem with setting up shops with the items given in the TradeCraft.txt, but when I add extra ones, they don't seem to work in the game.

    When right clicking the sign above the chest, nothing happens!

    Is there something I'm doing wrong, or is there something I need to change?
    Thanks! :)
  29. Offline

    Digi

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You should also not require the player's name in the sign, just add the name of owner automatically to the sign :}
  30. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I've thought about that and thought that would cause issues. But just now I think I'm stupid for thinking that :).
    I guess I could look into that at some point yes. That part of the code is a bit tricky though.
  31. Offline

    ArmEagle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Are you using Permissions and then an admin, or a user with the permission TradeCraft.canMakePlayerShops (probably want .canBuy and .canSell too). Or if you're not using Permissions, are you an op or a normal user?

    Also, I just updated the plugin to 0.9AE today. Though that shouldn't fix any issues you're having, feel free to try it out.
  32. Offline

    marinc

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Infinite shops issue here as well, running 0.9AE on b617. Default permissions are
    - 'TradeCraft.canMakePlayerShops'
    - 'TradeCraft.canBuy'
    - 'TradeCraft.canSell'
    but anyone can make an infinite shop by simply omitting the name tag.
    Maybe you can add the name tag automatically (a la Lockette) if no permission for infinite shops exists?

    EDIT: Btw, just FYI so you can test this easier, I'm testing this locally with online-mode false and 2 Minecraft instances (1 with my online account as admin, 1 with play-offline Player account for default Permissions).

    EDIT 2: You can even make shops in other players' name.

Share This Page