[MISC] InfiniteItems v0.5.1 - Infinite Items [1.1-R4]

Discussion in 'Inactive/Unsupported Plugins' started by gablank, Sep 12, 2011.

  1. Offline

    gablank

    Infinite Items
    Version 0.5.1

    Tested with Minecraft 1.1 and CraftBukkit 1.1-R4.

    0.5.x don't need to be updated for R4.



    BukkitDev link



    About 1.2: I will not be able to update the plugin over this weekend, but if CB1.2 / R5 is released before I'm back versions 0.5.x should work fine with those builds. I can't say anything certainly as I have not been able to test it.


    Features:
    * Dropping items will remove them from the world (changeable by command).
    * If you try to pick up something that's already present in your inventory it will not get picked up, and the item will despawn.
    * Every time you place a block it sets the stack of that item to 64.
    * Permissions support.

    Upcoming features:
    * Only by request.



    Notice:
    In version 0.5 I accidentally forgot to remove some debug information, I have released a new version to remove that information. If you're okay with that information being displayed, there's no need to update.
    Sorry about that!

    Download link (newest): <Edit by Moderator: Redacted mediafire url>
    WGET friendly: http://wenhaug.no/bukkitplugins/InfiniteItems-0.5.1.jar


    If you test it and got feedback for me then please let me know what I can do better/what worked well! :)

    Source code is in the .jar.


    Permissions (default in bold):
    * infiniteitems.regen: (false/true) -- Allows player to use the plugin.

    Commands:
    * /inf: Toggles whether you drop items or not.

    Changelog:

    Version 0.5.1
    * Removed some debug information.

    Version 0.5
    * Added /inf command.

    Version 0.4
    * Added permissions support.

    Version 0.3
    * Fixed the same bug with damage values not copying, which caused red wool to become white wool etc.
    * Updated event listeners to the new bukkit standard (http://wiki.bukkit.org/Introduction_to_the_New_Event_System)

    Version 0.2
    * Fixed not copying the damage value (Thanks to Wooks for reporting this bug)

    Version 0.1
    * Initial release

    Old version downloads:
    * Version 0.5: <Edit by Moderator: Redacted mediafire url>
    * Version 0.4: <Edit by Moderator: Redacted mediafire url>
    * Version 0.3: <Edit by Moderator: Redacted mediafire url>
    * Version 0.2: <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 12, 2016
  2. Offline

    Grammar Troll

  3. Offline

    gablank

    Thank you!
     
  4. Offline

    Plague

    you need some other way to download apart from an attachment
     
  5. Offline

    gablank

    Fixed!
     
  6. Offline

    Wooks

    I encountered a bug where when I tried using for example 44:1 Sandstone Slab, it would reconvert the infinite pile into regular Stone Slab, so I can only ever use 1 Sandstone Slab in a pile. Kind of annoying :D

    Apart from that loving it.
     
  7. Offline

    jycs

    1337 ?

    it seems to work, strange.

    Edit : ID confusion as I thought. really sad

    I don't understand why:
    Code:
    package no.wenhaug;
    import org.bukkit.block.Block; // Detecting what block were used
    import org.bukkit.entity.Player; // Getting player
    import org.bukkit.event.block.BlockListener; // Obvious..
    import org.bukkit.event.block.BlockPlaceEvent; // Obvious
    import org.bukkit.inventory.ItemStack; // Creating a stack of the actual block
    import org.bukkit.inventory.PlayerInventory; // Inventory
    
    public class InfiniteItemsBlockListener extends BlockListener
    {
        private InfiniteItems plugin;
    
        public InfiniteItemsBlockListener(InfiniteItems instance)
        {
            this.plugin = instance;
        }
    
        public void onBlockPlace(BlockPlaceEvent event)
        {
            if(event.isCancelled()) return;
    
            // Get block and player
            Block block = event.getBlock();
            Player player = event.getPlayer();
    
            // Fetch players inventory
            PlayerInventory inv = player.getInventory();
            // Current amount of the used block
            //int amount = inv.getItemInHand().getAmount();
            int amount = 64; // So that you always have full
            // DO NOT INCREASE BY ONE, just set it to what it was!
            ItemStack stack = new ItemStack(block.getTypeId(), amount);
            // And update the inv
            inv.setItemInHand(stack);
        }
    }
    
    I think the problem is general, when I use an item like 44:1 or 44:2, it always replace this ID by 44:0

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

    gablank

    Hey guys.
    This was my very first plugin for Bukkit, so it was some kind of a test I guess. Didn't realize people actually used it. I'll have a look at the bug and fix it if there is any interest. Do you still use it after creative mode came out?
     
  9. Offline

    jycs

    Great thanks, this mod is very usefull with /give.
     
  10. Offline

    jycs

  11. Offline

    gablank

    Fixed the issue where the data value didn't get copied.
    Sorry for taking so long to fix it, I've been kinda busy doing other stuff ;)
    Oh and if you have a request for a feature I might just add it, just let me know!

    Thanks to Wooks for reporting it!
     
  12. Offline

    KaLul

    Awesome!!! Thank you so much! Works great with 1.1.0 on my creative server. Keep it up to date or make some configs for it ;)

    EDIT: Wool always changes back to standart subID. Can you please fix that?
     
  13. Offline

    gablank

    Weird, thought I fixed that bug in the last update.

    I'll have a look at it!
     
  14. Offline

    katbc

    well..... add perms to it idk how but try becuse my players keep gettine infinite diamonds and just abusing the mod it makes me sad
     
  15. Offline

    gablank

    katbc
    Do you want an option to only allow OPs to use the plugin? Or do you want to manually add everyone that can use it?
    Like:
    /inf add gablank
    and
    /inf remove gablank
     
  16. Offline

    Rexel

    It sounds like the thing I want, using creative sux, and I use other plugins for inventory aswel, not to mention client mods offer better flying support than creative anyway, the only thing lacking is regeneration of blocks so I don't have to keep multiple stacks in my inventory.

    Plugin needs permissions though...

    "Like:
    /inf add gablank
    and
    /inf remove gablank"

    nah just add permission support, so it can be done through a permission manager, otherwise its just more commands.
     
  17. Offline

    gablank

    Sure, I'll look into it ;)

    Edit: Added permissions support now. Only one permission though, "infiniteitems.regen"

    Edit2: Question for you:
    Is there any interest in separate permissions for item drops etc? As it is right now, if the player does not have permission to use the plugin, the plugin won't do anything at all.
     
  18. Offline

    Rexel

    The permission support is great, finally tried the plugin just what I needed.

    "Edit2: Question for you:
    Is there any interest in separate permissions for item drops etc? As it is right now, if the player does not have permission to use the plugin, the plugin won't do anything at all."

    Hmm I just realized you can't actually drop anything ...which for fulls my other request I was gonna ask about being able to drop delete already... only I wanted that with a command to enable/disable.. so I guess my request now is still a command switch to actually enable dropping of items when needed. And also a perm to force item dropping on.
     
  19. Offline

    gablank

    Okay, thanks for the feedback! I'll implement that tomorrow if I get time to do it ;)
     
  20. Offline

    Rexel

    any updates? I'm missing not being able to drop items now :D
     
  21. Offline

    gablank

    Yeah, sorry, I've been busy with school lately. I'll have a look at it (hopefully) tomorrow.

    In any case I'll have it done by sunday!
     
  22. Offline

    Rexel

    just noticed this one/...

    Code:
    2012-02-16 16:13:18 [SEVERE] Could not pass event org.bukkit.event.block.BlockPlaceEvent to InfiniteItems
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1026)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:61)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:460)
        at com.miykeal.showCaseStandalone.ShowCaseStandalonePlayerListener.onPlayerInteract(ShowCaseStandalonePlayerListener.java:99)
        at org.bukkit.plugin.java.JavaPluginLoader$11.execute(JavaPluginLoader.java:340)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:61)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:460)
        at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:187)
        at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:283)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:609)
        at net.minecraft.server.Packet15Place.handle(SourceFile:39)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:100)
        at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:537)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:435)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:465)
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1024)
        ... 16 more
    Caused by: java.lang.NullPointerException
        at org.bukkit.craftbukkit.inventory.CraftItemStack.setAmount(CraftItemStack.java:112)
        at no.wenhaug.InfiniteItemsBlockListener.onBlockPlace(InfiniteItemsBlockListener.java:34)
        ... 20 more
     
  23. Offline

    gablank

    Added /inf command now, so you can select whether or not you drop items. Please note that this is not saved, so after a server restart your setting will NOT be remembered.

    Rexel: I haven't had the chance to look at that bug, do you think you can reproduce it?
     
  24. Offline

    Rexel

    sweet thanks for update, about the bug.. no idea I just noticed it in the server log a few days ago.. it didn't seem to have done anything serious.
     
  25. Offline

    gablank

    Okay, just keep me updated if it happens a lot :)

    Oh and btw, if you want any new commands just let me know ;)
     
  26. Offline

    gablank

    I've updated the original post with this, but I'll post it here as well so I'm sure most people will see it:
    About 1.2: I will not be able to update the plugin over this weekend, but if CB1.2 / R5 is released before I'm back versions 0.5.x should work fine with those builds. I can't say anything certainly as I have not been able to test it.
     
  27. Offline

    gablank

    Rexel
    I must've missed that line, sorry about that.

    As for the functionality, I'm unsure if I understand you correctly.
    Do you want a permission that, if set, makes you drop items no matter what?
     
  28. Offline

    Wiinick

    Does it work with dispensors
     
  29. Offline

    Rexel

    Code:
    ... 16 more
    >06:31:51 [INFO] [PLAYER_COMMAND] Koolio: /item 47:0 64 
    >06:32:25 [SEVERE] Could not pass event PlayerPickupItemEvent to InfiniteItems
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:441)
    at net.minecraft.server.EntityItem.a_(EntityItem.java:150)
    at net.minecraft.server.EntityHuman.l(EntityHuman.java:359)
    at net.minecraft.server.EntityHuman.e(EntityHuman.java:351)
    at net.minecraft.server.EntityLiving.G_(EntityLiving.java:446)
    at net.minecraft.server.EntityHuman.G_(EntityHuman.java:164)
    at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:228)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:340)
    at net.minecraft.server.Packet10Flying.handle(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:112)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    Caused by: java.lang.NullPointerException
    at no.wenhaug.InfiniteItemsPlayerListener.onPlayerPickupItem(InfiniteItemsPlayerListener.java:75)
    at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
    ... 16 more
    >06:32:41 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:32:48 [INFO] GroupManager - INFO - Data files refreshed.
    >06:32:57 [INFO] bluedudex2 lost connection: disconnect.quitting
    06:32:57 [INFO] Connection reset
    >>06:33:58 [INFO] [PLAYER_COMMAND] Koolio: /god 
    >06:34:15 [INFO] [PLAYER_COMMAND] Koolio: /time day 
    >06:35:28 [SEVERE] Could not pass event PlayerPickupItemEvent to InfiniteItems
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:441)
    at net.minecraft.server.EntityItem.a_(EntityItem.java:150)
    at net.minecraft.server.EntityHuman.l(EntityHuman.java:359)
    at net.minecraft.server.EntityHuman.e(EntityHuman.java:351)
    at net.minecraft.server.EntityLiving.G_(EntityLiving.java:446)
    at net.minecraft.server.EntityHuman.G_(EntityHuman.java:164)
    at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:228)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:340)
    at net.minecraft.server.Packet10Flying.handle(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:112)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    Caused by: java.lang.NullPointerException
    at no.wenhaug.InfiniteItemsPlayerListener.onPlayerPickupItem(InfiniteItemsPlayerListener.java:75)
    at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
    ... 16 more
    >06:36:53 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:53 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:54 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:55 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:55 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:55 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:55 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:57 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:57 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:57 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:59 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:59 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:36:59 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:01 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:01 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:01 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:03 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:03 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:03 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:05 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:05 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:05 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:07 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:07 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:07 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:09 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:09 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:09 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:11 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:11 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:11 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:13 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:13 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:13 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:15 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:15 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:15 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:17 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:17 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:17 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:19 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:19 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:19 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:21 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:21 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:21 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:23 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:23 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:23 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:25 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:25 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:25 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:27 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:27 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:27 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:29 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:29 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:29 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:31 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:31 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:31 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:33 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:37:33 [INFO] Fetching addPacket for removed entity: CraftItem
    >06:41:45 [SEVERE] Could not pass event PlayerPickupItemEvent to InfiniteItems
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:441)
    at net.minecraft.server.EntityItem.a_(EntityItem.java:150)
    at net.minecraft.server.EntityHuman.l(EntityHuman.java:359)
    at net.minecraft.server.EntityHuman.e(EntityHuman.java:351)
    at net.minecraft.server.EntityLiving.G_(EntityLiving.java:446)
    at net.minecraft.server.EntityHuman.G_(EntityHuman.java:164)
    at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:228)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:340)
    at net.minecraft.server.Packet10Flying.handle(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:112)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    Caused by: java.lang.NullPointerException
    at no.wenhaug.InfiniteItemsPlayerListener.onPlayerPickupItem(InfiniteItemsPlayerListener.java:75)
    at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
    ... 16 more
    still seems to work though 1.2.3 beta bukkit build
     
  30. Offline

    gablank

    Wiinick: No, not atm. I don't think I'll add it to this plugin either, as it will effectively override the permissions so anyone can duplicate items using dispensers. I can not think of an easy way to implement that and still denying players without permissions to regenerate items. I could, though, make it a separate plugin if you want?

    Rexel: Thanks for providing that info, it's gonna be helpful! I'll have a look at ASAP.

    About these lines: >06:37:33 [INFO] Fetching addPacket for removed entity: CraftItem

    For some reason the console gets spammed by it when the plugin removes the item, I have no idea why. I'll try to get rid of that as well ;)
     

Share This Page