ContainerDedication

Players can make containers dedicated to only allow approved items.

ContainerDedication

Container Dedication

With this plugin, a player can decide to make a chosen container (chest, furnace, hopper, etc) become dedicated to only a limited list of item types. That container will reject attempts to put unapproved items into it, and if it's a hopper, it will also refuse to "suck" entities out of the world into it if they're not approved item types. The filtering can be controlled on a whitelist basis ( reject everything not explicitly approved) or on a blacklist basis (allow everything not explicitly disapproved).

This plugin is something I wanted on a server I run and I didn't find anything like it so I decided to learn a bit of the Bukkit API and make my own plugin to do it.

The original intent of this plugin was to make donation hoppers triggering redstone comparator mechanisms only when the material being thrown in the hopper is the right type of item. It has a few other uses as well, including making complex sorting machines that push out material into boxes along the way as they fall down a cascade of chests and hoppers.

Examples of use:

A player wants to make a chest that refuses to hold anything other than diamond tools.

  1. Player types: /dedicate next disallow
  2. Player places a chest.
  3. Player holds a diamond pick in hand and looks at chest.
  4. Player types: /dedicate allow
  5. Player holds a diamond sword in hand and looks at chest.
  6. Player types: /dedicate allow
  7. Player holds a diamond axe in hand and looks at chest.
  8. Player types: /dedicate allow
  9. Player holds a diamond shovel in hand and looks at chest.
  10. Player types: /dedicate allow
  11. Player wants to verify that it's set up right, so player types: /dedicate info while still looking at chest, giving the information shown in the image below:

Resulting chat window

A player wants to make a hopper that allows anything in it other than sand:

  1. Player types /dedicate next allow
  2. Player places the hopper.
  3. Player holds sand in hand and looks at hopper.
  4. Player types: /dedicate disallow
  5. Player types :/dedicate info and gets the information shown in the screenshot below:

screenshot of chat window after /dedicate info

Command list

This main page is getting too long, so go here for the full command-line usage on its own separate page:

Permissions

  • containerdedication.next - Player is allowed to use the /dedicate next command. Note that players are only allowed to change the filter list for containers that they have previously placed with /dedicate next (can't change other people's containers), so denying this permission also effectively stops the use of the other commands as well.
  • containerdedication.reload - Player can use the /dedicate reload command.

Security and anti-griefing

If you are using a zone protection or anti-grief plugin of some sort, permission to place blocks does effectively become a prerequisite to editing a container's filter rules because of how ContainerDedication requires a container be placed by the same player as the player who's trying to alter its filter rules. If there's a zone of the world map in which you cannot build or destroy blocks, then you can't mess with a container's dedication filter there either since doing so would require breaking and re-placing it the container block. So while this plugin has no specific block protection or anti-grief capabilities, it works well in partnership with plugins that do.

Known behaviors and quirks

This main page is getting too long, so this list has been moved to a separate page here:

Please be aware that if you want to make any redstone mechanisms using the features of this plugin you should read that page and understand it.

IDEAS FOR MECHANISMS YOU CAN BUILD USING THIS

  • Make a donation chute that requires putting a diamond in the chute to trigger a redstone mechanism: You make a dedicated hopper that only sucks up diamonds and nothing else, then put a redstone comparator against it that will send a brief pulse when the hopper has inventory in it for a moment.
  • Make an item sorter out of a chain of hoppers and doublechests: Put two Dedicated hoppers underneath a doublechest such that their spigots dump in opposite directions. Put a chest on each destination spigot. If you configure the dedicated hoppers such that they have exactly the opposite filtering rules from each other (for example, hopper 1 allows everything except redstone, while hopper 2 DISallows everything except redstone) then this arrangement makes it so that items you put in the doublechest get sorted into the two boxes according to the rules of the hoppers. If the destination chests are themselves doublechests, you can build more hoppers under them to do the same thing again, chaining this process along to make a thing that works like a coin sorter at a bank.

Config YAML file

If you want to risk editing the config.yml file directly to create your own dedicated rules behind the scenes without having to fiddle with items in your inventory, or if you want to write software to automatically produce the configurations, you may find this description of the confg.yml file handy:

TO-DO list and known bugs

  • Maybe some people would like to have a furnace that refuses to smelt into a disallowed output item. Can this be controlled by a setting the player chooses?
  • There is no current way to change ownership of a chest other than to break it and have someone else place it. Perhaps there needs to be some type of 'give ownership to other' command.
  • Maybe a container should be checked when its whitelist/blacklist changes, and if it has existing items in it that have become disallowed by the change, it should eject them out into the world as floating entities? I'm not sure if this is good or bad behavior.
  • Put source on GitHub.

Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members