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

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

  1. Offline

    mjmr89

    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. Offline

    ArmEagle

    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. :)
     
  3. Offline

    FXStrato

    I'm guessing this doesn't work with Build 602 yet.
     
  4. Offline

    Fralexxelarf

    please update it! cause it's an awesome plugin! :D
     
  5. Offline

    ArmEagle

    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
     
  6. Offline

    ronix

    Thanks! The Tradecraft CB 602+ works perfect on my server running MC 1.4.
     
  7. Offline

    ArmEagle

    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+.
     
  8. Offline

    ronix

    Ah, ok, I saw this popping up in one of the commits. Thanks, I will CB 613+.
     
  9. Offline

    megamix34

    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 ?
     
  10. Offline

    ArmEagle

    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
     
  11. Offline

    nawoki

    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.
     
  12. Offline

    ArmEagle

    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?
     
  13. Offline

    nawoki

    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.
     
  14. Offline

    PowerSet

    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.
     
  15. Offline

    Red_Pepper_rus

    It does not work! :mad:
     
  16. Offline

    ArmEagle

    I'll look into that.

    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.

    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.

    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

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 11, 2016
  17. Offline

    Red_Pepper_rus

    ArmEagle, Thank you SO much! You're the greatest!
     
  18. Offline

    happyknife

    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! :)
     
  19. You should also not require the player's name in the sign, just add the name of owner automatically to the sign :}
     
  20. Offline

    ArmEagle

    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.

    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.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 11, 2016
  21. Offline

    marinc

    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.
     
  22. Offline

    ArmEagle

    Thanks, the code was still using the old way of reading a sign's text during event handling. But events can now be canceled, so the lines have to be taken from the event.

    Well, here's a new update, version 0.91AE (CB 617):

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

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

    Changelog:
    • Fixed permission checking on placing of sign and now cancels the event (empty sign) when the player doesn't have the right permissions.
    • Playershop strict player name check was wrong way around on placing of a sign.
    • Prevents blocks from being placed when right-clicking a shop sign (server-side, so if you place a sign the client will still let you enter text, but there will be no sign at the end).

    That still leaves the automation of setting the player name. But I need to think that one through and these were some bugs that had to be fixed.

    Edit:
    I don't think anyone was so quick to be faster than my thinking. But the .jar is actually uploaded now :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 11, 2016
  23. Offline

    happyknife

    Well I only have two files I can edit on here

    tradecraft.properties
    Code:
    infinite-shops-enabled = true
    player-owned-shops-enabled = true
    repair-shops-enabled = true
    group-required-to-create-infinite-shops = *
    group-required-to-create-player-owned-shops = *
    group-required-to-create-repair-shops = *
    group-required-to-buy-from-shops = *
    group-required-to-sell-to-shops = *
    group-required-to-use-repair-shops = *
    repair-cost = 10
    enable-debug-messages = true
    and

    tradecraft.txt
    Code:
    # Item name, data value, buy exchange rate (item to gold), sell exchange rate (optional)
    # http://www.minecraftwiki.net/wiki/Data_values
    
    Cobblestone,  4,  64:1
    Gravel,      13,  32:1,   0:0
    Sand,        12,  32:1,  48:1
    Dirt,         3,  32:1
    Redstone,   331,  16:1
    Log,         17,   8:1
    Coal,       263,   4:1
    Clay,       337,   2:1
    Iron,       265,   1:4
    Obsidian,    49,   1:32
    Diamond,    264,   1:64
    Bread,      297,   4:1
    Glass,       20,  

    This is what comes on the clanforge installed mod. (I have a multiplay server)

    The problem occurs when I add the other items to tradecraft.txt I can't seem to add the shop ingame :/

    And 0.81AE is the only one available for us presently
     
  24. Offline

    ArmEagle

    I assume you're editing these in the main directory of the gameserver installation.
    The 0.81AE version has it's config files located inside plugins/TradeCraft/
    the .proprties file also slightly changed formatting, so just edit that one. You can move over your TradeCraft.txt though.
     
  25. Offline

    game_stailer94

    can you update it to #670??

    everytime i rightclick the sign I get this error, but only with the craftbukkit #670 build.

    Code:
    16:44:19 [SCHWERWIEGEND] Could not pass event PLAYER_INTERACT to TradeCraft
    java.lang.NullPointerException
            at com.mjmr89.TradeCraft.TradeCraftChest.<init>(TradeCraftChest.java:24)
            at com.mjmr89.TradeCraft.TradeCraftShop.<init>(TradeCraftShop.java:15)
            at com.mjmr89.TradeCraft.TradeCraftItemShop.<init>(TradeCraftItemShop.java:10)
            at com.mjmr89.TradeCraft.TradeCraftInfiniteShop.<init>(TradeCraftInfiniteShop.java:11)
            at com.mjmr89.TradeCraft.TradeCraft.getShopFromSignBlock(TradeCraft.java:279)
            at com.mjmr89.TradeCraft.TradeCraftPlayerListener.onPlayerInteract(TradeCraftPlayerListener.java:27)
            at org.bukkit.plugin.java.JavaPluginLoader$9.execute(JavaPluginLoader.java:252)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
            at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:162)
            at net.minecraft.server.ItemInWorldManager.a(ItemInWorldManager.java:208)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:447)
            at net.minecraft.server.Packet15Place.a(SourceFile:57)
            at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    
     
  26. Offline

    ArmEagle

    Hmm I'll look into that. From reading the changelog I thought it should simply have worked. I didn't get any warnings when i linked it to the new bukkit version. But I guess I should have actually tried it.

    Updated to version 0.92AE

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

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

    Changelog:
    • CraftBukkit 670 supported. Do not upgrade if you're still running 617!
    • Fixed a Null Pointer Exception when a new shop was created (was checking for AIR but that changed, now checking for null).

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 11, 2016
  27. The name should be only as info tough, because long names don't fit in signs and partial matching could get bad, mostly on offline mode servers. You should just enter the full name of the owner in the save file :}

    Oh, and if you're coding this from now on, see some of my older posts:

     
  28. Offline

    ArmEagle

    Written down those suggestions in my TODO list. I haven't thought about 'damage bit' items for some time, but yes it shouldn't be a big hassle anymore now.

    I'm not sure about inventory/chest protection though. I think it's possible, but tricky. I think CraftBukkit still has some inventory handling issues. Though those might not be of influence.

    And yes, true. The full name should probably be used everywhere. The funny thing is that right now the plugin doesn't parse a sign until you click on it. It only does some basic checks when you place it. I think I know why that was done. But I also think that's not such a big deal (you could lose the .data file and chests would be added automatically again).
     
  29. Offline

    CHIKINS!!!

    Can you update this and make this link with iConomy? please
     
  30. Offline

    Xin_TiGeR

    i used to love this plugin, but since i noticed the infinite shop issue it scared the hell of me instaling it again..

    is it already fixed? can normal players now be prohibited from creating infinite shops?
     
  31. Offline

    ArmEagle

    How would you see that work?

    Yes I fixed that. Hmm, didn't I mention that in one of the changelists?
     

Share This Page