[INACTIVE][MECH] AutoReplace is being split into separate plugins. AutoReplace has been dropped.

Discussion in 'Inactive/Unsupported Plugins' started by Valrix, Feb 16, 2011.

  1. Offline

    Valrix

    AutoReplace is splitting into two plugins called AutoBlock and AutoItem and will be "cousins" of AutoWeapon, AutoTool, and AutoFood that are being made by @marinating. All these together will make a suite of sorts and will all work together.

    AutoReplace - Moves items from inventory to hand when it runs out:
    Version: v1.9.1

    The plugin watches all of the "hand" slots to watch for when you run out of blocks while placing them or for when a tool breaks and will look in your inventory to see if you have any more to replace it with. If not, you will get a message saying you're out.

    To install just put AutoReplace.jar in the plugins folder and it handles the rest! Enjoy!

    Features:
    • Moves preset tool from inventory to hand when it breaks
    • Moves block stack from inventory to hand when stack runs out
    • Moves items like beds and redstone dust to your hand when you run out
    • Replaces food and empty buckets with full ones
    PLANNED UPDATES (open)

    • Global config to deny certain slots from being watched for everyone.

    DOWNLOADS:
    RB 860:
    Source Code: AutoReplace

    CHANGELOG (open)

    Version 1.9.1
    • Fixed the "always placing water" issue
    Version 1.9
    • Now replaces food when you eat it
    • Now replaces empty buckets with full ones
    Version 1.8
    • Fixes the problem with some items being replaced even though nothing was placed and tools being moved to your hand without being broken.
    Version 1.7
    • Fixes the problem with placing wool.
    Version 1.6
    • Now supports replacement of items like Redstone dust, doors, beds, signs, and paintings.
    • A few code improvements
    • Only a higher build like 600+ can support this since it was between 556 and 602 that interacting with these items was fixed/added.
    Version 1.5
    • Updated to work with RB 602.
    Version 1.4
    • Removed "No more X in inventory" message when you run out of something.
    Version 1.3
    • Removed use of /auto command
    • All "hand" slots are now watched automatically
    • No more .preset files are generated
    Version 1.2
    • Reworked it a bit to make sure it has less chances to break and uses a little less resources.
    Version 1.1
    • Updated the work with the newest plugin build method.
    Version 1.0
    • Release of AutoReplace
     
  2. Offline

    Dreadreaver

    If you could remove the need for this "/auto"-command - like just make it default - i would absolutly love this, as it would be great for all my players to use this. But as of now my servers is 100% command free for players and I want to keep it that way.

    Also what do you mean by "still see the stack"? Does it duplicate blocks or does it just look like it duplicates blocks? Little bit of explaining would be nice - or just fix the bug ^^ =)

    Anyway, if you implement the above request I would totaly love this for my 95% vanilla server ;)
     
  3. Offline

    Valrix

    Sadly this isn't possible yet because the INVENTORY_CHANGE event hasn't been added yet. However, once that is added I will make it where you just have to set auto=true in the config file (maybe in the server.properties since it's only one line) and if it finds it then nobody will need to use commands. So right now you have to use the command to set it each time you change what's in the slot. Though I do promise your suggestion will be done when possible. Sorry for the inconvenience.

    What I meant by "still see the stack" is that when a stack of say 38 sand get moved from inventory to your hand your inventory will still show it as being there but go away when you click on the slot or log out and back in. This is a problem with how Bukkit currently handles inventory updates and I have no control over it.
     
  4. Offline

    fullwall

    Although it is deprecated, in the meantime you can use inventory.update() to fix the mentioned issue.
     
  5. Offline

    Valrix

    For some reason I can't see that in the command list and it doesn't allow me to build with it. Everything works, it's just graphical. Besides when you run out it gives you an alert so you don't get confused when you can still see stuff yet it doesn't move it to your hand.
     
  6. Offline

    fullwall

    Are you using a PlayerInventory or Inventory object to manipulate player inventories? I can't check my code right now, but you could try downloading the source for superslots - it uses this method in the listen.java.
     
  7. Offline

    Valrix

    I use PlayerInventory.
     
  8. Offline

    Dreadreaver

    alright, just added this thread to my watchlist
    looking forward to version 1.1 or 1.0a or whatever :D
     
  9. Offline

    fullwall

    Looks like I don't have the source in superslots :S. I'll look it up at home then...
    --- merged: Feb 17, 2011 4:39 AM ---
    Or I could look it up on the javadocs XD. The updateInventory() method is in the player object.
     
  10. Offline

    Valrix

    Still doesn't come up for me when programming though.
    --- merged: Feb 17, 2011 4:46 AM ---
    Sweet :D
     
  11. Offline

    fullwall

    e.getPlayer().updateInventory().
    --- merged: Feb 17, 2011 7:55 AM ---
    Maybe it doesn't show up because the method is deprecated?
     
  12. Offline

    Valrix

    Ok it shows now, but I'll try adding it and see if it helps at all.

    EDIT: Ok, seems to do the trick so that'll have to do until they get inventory all patched up.
     
  13. Offline

    nossr50

    This is a very cool plugin idea, I approve
     
  14. Offline

    Valrix

    Why thank you.
     
  15. Offline

    Faust

    This is a very useful plugin
     
  16. Offline

    Valrix

    Thanks. It'll be better once the ability to check for when inventory changes gets added so you won't have to use commands.
     
  17. Offline

    weasel5i2

    Someone should write a plugin which makes it so that if you pick up a piece of armor of any kind, it will make you auto-wear it, unless the slot is currently filled with a better piece of armor, of course... Wouldn't be too hard to code up! You wanna do it, or should I? :)
     
  18. Offline

    Valrix

    Ooh, that's a nice idea. That does sound pretty easy except the part of checking if you're already wearing something better and you'd want to make sure it doesn't destroy the other armor, only moves it to inventory. Sounds interesting, I might want to do it. If you want to you're welcome to.
     
  19. Offline

    weasel5i2

    OK, you should try it since your plugin already shuffles items around, I imagine it wouldn't be much to fork from that.. No sense in me reinventing the wheel eh? :) But if you decide you don't want to just lemme know and I'll give it a shot..
     
  20. Offline

    Valrix

    Alright, sounds like something that'll be pretty fun to do. I think I'll do that after I do BackToBody.
     
    weasel5i2 likes this.
  21. Offline

    SavageCore

    Code:
    2011-02-24 13:39:27 [SEVERE] Could not pass event BLOCK_PLACED to AutoReplace
    java.lang.NullPointerException
            at com.sparkedia.valrix.AutoReplace.AutoBlockListener.onBlockPlace(AutoBlockListener.java:62)
            at org.bukkit.plugin.java.JavaPluginLoader$22.execute(JavaPluginLoader.java:237)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:225)
            at net.minecraft.server.ItemBlock.a(ItemBlock.java:107)
            at net.minecraft.server.ItemStack.a(ItemStack.java:56)
            at net.minecraft.server.ItemInWorldManager.a(ItemInWorldManager.java:160)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:497)
            at net.minecraft.server.Packet15Place.a(SourceFile:57)
            at net.minecraft.server.NetworkManager.a(SourceFile:230)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:70)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:338)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:253)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Latest AutoReplace and CB #432
     
  22. Offline

    Valrix

    Double-check that the version says "git-Bukkit-0.0.0-450-gd3c1ba4-b432jnks" when you start up the server. If it doesn't show that then you need to get the build again.
     
  23. Offline

    SavageCore

    As yes that's it must have had the wrong version, thanks a lot.
     
  24. Offline

    Valrix

    Welcome.
     
  25. Offline

    SimplisticBeing

    I really like this.. But wanted to maybe add something..

    Can you make it possible to work like gravity only.. So that any item above that hands column will drop straight down into the hands inventory slot right below it.. I have wanted this forever.. Gravity style inventory..and that is it.. Thank you..

    Stone-Wood-Pumpkin
    Wood-Pumpkin-Stone
    Pumpkin-Stone-Wood
    --------------------------
    Pickaxe-Apple-Sapling

    Once the pickaxe breaks..

    BLANK-Wood-Pumpkin
    Stone-Pumpkin-Stone
    Wood-Stone-Wood
    --------------------------
    Pumpkin-Apple-Sapling

    Sound good..
     
  26. Offline

    Dreadreaver

    and plz make it useable without any commands!
     
  27. Offline

    Valrix

    This is what I'm hoping for, but currently you can't watch for when something in your inventory changes. Once this is added and works I'll be able to get rid of needing to use a command to "register" an item to replace it. Don't worry, as soon as they add the hooks and have everything up to date I plan on updating the plugin to use this method instead of needing a command.

    This idea is what I based this plugin off of, but it also poses a few problems. First is the order that inventory slots are handled, it goes from left to right and starts at the first action-bar slot, then jumps to the top-left of your inventory. Adding "gravity" to inventory would also mean it would need to watch for changes, which currently isn't possible. However, I make another "helper" plugin to specifically add "gravity" to a player's inventory, or at least I'll try my best. The main issue is that inventory handling seems to be quite difficult and is only partially implemented, heck even updating inventory contents requires a hacky updateInventory() call that will be gone soon.
     
  28. Offline

    davr

    I have no idea how the mc/bukkit internals work, but maybe you could do something like this:

    When block is placed:
    Check user's currently selected slot
    If slot is empty:
    Look in inventory for more items of the same id as the block just placed
    If more found:
    move stack from inventory to slot

    Then you wouldn't need to manually enable it on a per slot/item basis, it could just be active for everything all the time.
     
  29. Offline

    Piercing Goblin

    Could you either make this so it can watch multiple slots, or watch whatever slot is currently selected?
     
  30. Offline

    Valrix

    @davr @Piercing Goblin
    When you use the command it watches that slot. The reason I made it where you had to use commands was so you wouldn't have it watch all the slots so when you ran out of something you only had a few of you'd get the message saying no more are left in your inventory. I could change it where it just watches all the hand slots by default and see if it turns out to be more annoying than useful. If so I'll change it back, but sure I'll just get rid of the need of using files and commands. I'll update it in a little bit since it won't take much work.
     

Share This Page