[MECH/RPG] CraftGroup v0.3.1 - Prevent crafting of specific items and blocks [1000]

Discussion in 'Inactive/Unsupported Plugins' started by FrozenBrain, Jul 10, 2011.

  1. Offline

    FrozenBrain

    CraftGroup - Prevent crafting of specific items and blocks
    Version: v0.3.1
    CraftBukkit Build: 1000

    CraftGroup lets you assign so-called CraftGroups to the players of your server via Permissions. Those CraftGroups can be used to prevent crafting, smelting, using, placing or breaking of specific items and blocks. This is propably most useful for RPG servers.

    How to use:
    Show Spoiler

    Download the plugin and drop it in your plugins folder. After the first run, BukkitContrib will be downloaded (if it's not installed already) and a file called "config.yml" will be created inside the plugins/CraftGroup directory.

    You can now create new CraftGroups by simply adding a new node to this file.

    Example:
    Code:
    version: 13
    
    global-blacklist:
        break:
    # Don't break TNT
        - -TNT
        craft:
    # Don't craft orange wool
        - -WOOL:1
        use:
    # Don't use golden apples
        - -GOLDEN_APPLE
        place:
    Blaster:
        break:
        craft:
    # Even though the global-blacklist prevents everyone from crafting TNT,
    # we can whitelist it here again.
        - TNT
        use:
        place:
    Note: The 'use' rules are quite buggy. That's not my fault, CraftBukkit fails at this point. Maybe I'll find a workaround soon.

    As you can see, you can use either the name or the id of the item or block. If you want to prevent someone from crafting, placing, breaking or using something, put a "-" in front of the item (this blacklists the item). You can also whitelist an item by not putting a "-" there. This overwrites the blacklist rules.

    After setting up the CraftGroups, open up your Permissions configuration files and assign the CraftGroups to your groups or players by giving them the
    Code:
    craftgroup.group.GROUPNAME
    permission (replace GROUPNAME with the actual name of the CraftGroup).

    Remember that the CraftGroups and the "craftgroup.group.GROUPNAME" permission are case-sensitive!

    Permissions:
    PermissionNeeded to...
    craftgroup.addUse /cg add
    craftgroup.removeUse /cg remove
    craftgroup.listUse /cg list
    craftgroup.reloadUse /cg reload
    craftgroup.bypassBypass all restrictions
    craftgroup.group.GROUPNAMEAssign a CraftGroup (replace GROUPNAME with the name of the CraftGroup)


    Commands:
    CommandDescriptionUsage
    /cg addAdd an item or block to a group/cg add <list> <allow/deny> <type> <item>
    /cg remove <list> <allow/deny> <type> <item>Remove an item or block from a group/cg remove <list> <item>
    /cg listShow all lists or items in a group/cg list [list ] [type/*] [page]
    /cg reloadReload the configuration file/cg reload

    You can also use /craftgroup instead of /cg.

    Features:
    • Prevent crafting, smelting, using, placing or breaking of items and blocks
    • Assign CraftGroups to players and groups via Permissions
    • Multi-World (not with Permissions 2)
    • Ingame-Editing of CraftGroups
    • bypass-permission for Admins
    • Global Black-/Whitelist
    • Support for data values
    • Support for ItemCraft

    Download CraftGroup-dev (.jar; Minecraft 1.8; Spout)
    Download CraftGroup v0.3.1 (.jar)
    Source on GitHub
    [​IMG]

    Changelog:
    Version 0.3.1
    • Fixed 2 NPEs
    Version 0.3.0
    • Support for data values
    • Support for ItemCraft (requires testing)
    Show Spoiler
    Version 0.2.2
    • Fixed a problem with the different permission types
    Version 0.2.1
    • Fixed global-blacklist
    Version 0.2.0
    • Added support for permissions 2 and groupmanager (untested)
    • You can now prevent people from placing, destroying and using items/blocks
    Version 0.1.2
    • Forgot that HashMaps are case-sensitive
    Version 0.1.1
    • Never try casting an integer to a string!
    Version 0.1
    • Initial release
     
    Nomanoclass likes this.
  2. Offline

    Flenix


    Last I checked, it blocks item use for weapons and tools, but not armour. I think a plugin called SimpleArmorPermissions or something does though :)



    I just looked at the source and I think a fix would actually be relatively easy. I'll give it a go at getting a basic working version whilst FrozenBrain gets the full update going. Wish I thought of this a month ago...

    Right, got something that loads and plays nicely with Spout.
    Built for CB1160 - not tested with anything else but should work fine on most builds.

    ALL I'VE TESTED IS LOADING. It runs fine and the /cg command works - I've not done any more than this yet! I accidently lost my CraftGroup config at the dawn of 1.8, so I have nothing to test with right now - if it explodes, let me know.
    Also, I have no idea if it will work with new blocks or not. I didn't see anything in the source that looked like a block list so I assume it uses the official Bukkit enum (which is good!) so it should work with new blocks.

    I'll be testing myself over the next few hours but for now here is a new CraftGroup.
    @FrozenBrain - if you want this removed, or want the source or whatever, let me know :) Just trying to get something working until you can update properly, this only took around half an hour and thats coz I'm a java noob.

    www.silvaniamc.com/CraftGroup.jar

    EDIT: just tested, not sure if the global blacklist is working but making a new group and setting the permission for it DOES work. Also works with ID 98, Smooth Bricks, so I assume all new blocks work :) so I'll tag @Jakeob22 (now looking back in thread for anyone else who may be interested)

    Another edit:
    Saw someone on the previous page already did this... The only post I never read on that page -__- Oh well, I'll leave this up as its working fine with 1160 (that last one was built for 1060) and this uses the OLD permissions system/works with PEX. So it is still different :)

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

    Jakeob22

    :D
    Thanks so much @Flenix !!!

    I'll tell you how it works. I'll test it before I go to sleep. (Could be up to 2 hours before I do)
    You've just brightened the outlook of everybody in my server. :D

    EDIT: YOU ARE EPIC, MY FRIEND! It's working fine. No errors yet. I didn't try global blacklist because you said not to. If you get the up that would be great, but it's not that important, so don't bother if you are busy. :D
    (I'll just ban it from each group.)
     
  4. Offline

    Flenix


    Global blacklist will probably work fine - I think I forgot to set the global permission for it XD
    Anyway, glad I've helped someone other than myself :) It was a good learning curve fixing it up, my first experience with Spout and also auto-downloading. (I removed that by the way - Spout guidelines say don't make it download Spout so decided that was best)

    FrozenBrain, if you've not started yet I'm happy to send you the edited source to take away a few minutes work, but note I changed the package directory (I always do, sorry) so you'll have to just change it back.
     
  5. Offline

    Jakeob22

    @Flenix
    I found a glitch. It's pretty bad. :(
    Let's say I banned a wood sword from being crafted. I am holding a stack of 64 diamonds in my inventory hot bar and the cursor thing is over it. I attempt to craft the sword. I grab it and it goes back to it's original place. (blocking the group from crafting it as planned) But oh no! When it went back I picked up 64 diamonds instead! Successfully doubling items! :( It will give you whatever you are holding in your inventory and give it back to you when you try to craft something that you are not aloud to. :(
     
  6. Offline

    Flenix

    Sorry, I'm a little confused here. So when the sword is taken out of your "hand" (cursor) you are holding diamonds instead? If you have fraps or something could you take a real quick video of whats happening?
     
  7. Offline

    Jakeob22

  8. Offline

    Flenix


    OK, I see what you mean and this is happening on my server too. I'll look through the plugin and see what I find, I'm guessing its due to a change between bukkitcontrib and spout, meaning when it cancels the event I have to make the mouse hold nothing, and as its not set like that it defaults to the item you're holding in-game. I'll have a poke around :)
     
  9. Offline

    Jakeob22

    @Flenix You are one of the most helpful plugin developers I've ever seen! Why don't you have the purple plugin developer thing under your name?
     
  10. Offline

    Flenix


    I dunno, never got given it. I'm not too bothered, its only a tag... I've not actually made a useful plugin yet, just my CakeIsALie which doesn't really do all that much so in my mind I've not earnt it.

    Anyway, I cant see why its causing the bug but I think I can see a workaround, but it will take me a while. I'll try and have something for you tomorrow.. currently trying to calm my users after they hyped themselves up over
    this. (the date of release - clearly someone just edited it but they don't realize that...)
     
  11. Offline

    Jakeob22

    Yeah, I highly doubt that it would be updated in one day. But I'm happy that you are working on this for me. I also think that you should make a plugin just to get the title thing. :D

    Thank you!
     
  12. Offline

    Flenix


    I don't think Bukkit give them out anymore anyway. on BukkitDev there is a system which shows how many plugins you've made instead, I think that replaced the old purple tags :)


    Could you quickly test if you get the time: do you get the same bug with a furnace? Just had a thought that I might be looking in the wrong place :p
     
  13. Offline

    Jakeob22

    @Flenix I think we should take this up in private messages... We're kinda spamming this forum. xD
    Could you private message me how to set up a block for that. Do I just block crafting for an ingot or something? I'll try to block iron ingots and put one in. I'll see what happens.
     
  14. Offline

    FrozenBrain

  15. Offline

    Satros

    Is Spout required? Cause when I try the version on my main post CraftGroup crashes when clicking in inventory, then I use that dev version you posted it gives me a ton of spout related errors (I don't use spout).

    Edit: I didn't see that it auto downloaded spout, is there a version that doesnt need spout?
     
  16. Offline

    FrozenBrain

    Spout should get downloaded automatically. If not, please install it manually. CraftGroup does not update Spout, so maybe it's outdated.
     
  17. Offline

    Jakeob22

  18. Offline

    FrozenBrain

  19. Offline

    Flenix

    I shall in a moment

    Just thought I should point out, that Spout request that you don't make it auto download, its on their BukkitDev page. I think its so people have to read their page and understand their download stuff before they complain about things that don't work with it, like ItemCraft.
     
  20. Offline

    Jakeob22

    Here is my config:

    Show Spoiler


    I was set to citizen while filming. I think I was op as well, but that shouldn't be important.
     
  21. Offline

    Clintonxa

    Since DayJobs isn't working, this mod looks like a perfect alternative.

    Will it be tested fro 1185 soon? I'm installing it either way though.
     
  22. Offline

    Jakeob22

    @Flenix @FrozenBrain We were planning on releasing my server tonight or tomorrow. I need this plugin to fix, though. :(
    People are waiting! Let's move it! xD
    No, but seriously, we are waiting. :(
     
  23. Offline

    FrozenBrain

    I have no idea why you can dupe items, it doesn't make any sense. Could be a bug in Spout, I don't know yet :/
     
    Flenix likes this.
  24. Offline

    Jakeob22

    @FrozenBrain I would appreciate you trying to fix it. It's fine if you can't we have time. Thanks! :D

    (Best Plugin EVA)
     
  25. Offline

    Flenix

    Jakeob did you ever look at whether it worked in furnaces?

    +FrozenBrain I did come up with a basic rewrite which in theory would avoid it, where instead of blocking the item from being picked out if just blocks it from ever being crafted, but I can't remember what I did XD I hadn't actually done it due to being busy, just imagined it working in my mind... If you have a look at the Spout javadocs theres quite a few for various inventory and itemstack management now. (I'm guessing you had a similar bug in your attempt at updating the plugin?)
     
  26. Offline

    Jakeob22

    @Flenix I'll test it as soon as possible :D

    EDIT: I blocked one of the groups for crafting iron ingots and iron ore. I was still able to take the iron ingot out of the furnace. Was I doing it right if this is what the groups config looks like?

    Show Spoiler

    citizen:
    break:
    - -GOLD_ORE
    - -IRON_ORE
    - -COAL_ORE
    - -LOG
    - -LAPIS_ORE
    - -DIAMOND_ORE
    - -GLOWING_REDSTONE_ORE
    - -REDSTONE_ORE
    - -CACTUS
    - -SUGAR_CANE_BLOCK
    - -CROPS
    craft:
    - -WOOD_SWORD
    - -WOOD_SPADE
    - -WOOD_PICKAXE
    - -WOOD_AXE
    - -WOOD_HOE
    - -STONE_SWORD
    - -STONE_SPADE
    - -STONE_PICKAXE
    - -STONE_AXE
    - -STONE_HOE
    - -GOLD_SWORD
    - -GOLD_SPADE
    - -GOLD_PICKAXE
    - -GOLD_AXE
    - -GOLD_HOE
    - -DIAMOND_SWORD
    - -DIAMOND_SPADE
    - -DIAMOND_PICKAXE
    - -DIAMOND_AXE
    - -DIAMOND_HOE
    - -IRON_INGOT
    - -IRON_ORE
    use:
    place:

     
  27. Offline

    Flenix

    hmm that should have blocked it.


    Anyway, Incraftible has the same bug so it must be Bukkit not the plugin..
     
  28. Offline

    Jakeob22

    @Flenix I don't need to block smelting for now. Do you think you can please TRY your idea of it not even letting you craft it in the first place? I've seen plugins that could alter the outcome of a craft. You could possibly use cookbook to make a craft into nothing? :p
     
  29. Offline

    Quezax

    what is the easiest way to black list everything? so I can add them by permissions groups?
    It is easier for me to add what is allow instead of block everything else for each group (class) I have. or how do you swtich it over to be based on a white list?
     
  30. Offline

    Jakeob22

    @Quezax Uh... If you want to eliminate an entire group from breaking anything, just turn build to false in permissions?
    And for a whitelist, just add
    - (ID)
    instead of
    - -(ID)

    @Flenix and @FrozenBrain Here is a link to the development of my server. Just to show you how close we are to finishing. ;)
    http://www.minecraftforum.net/topic/636818-classcraft-indev-topic-ip-should-be-coming-soon/

    Quote:
    All that's left to do:

    1. Wait for Class plugin update (By class I meant group. We call them classes. ;) )
    2. Set up iConomy with Player Shops
    3. Configure "Buy-a-class" plugin, /help plugin, and Permissions
    4. Finish up some buildings and rules

    Then we're done! Could take anywhere up to Monday-Wednesday though. [​IMG] Going pretty smoothly for now. [​IMG] I'm not sure what we are doing about 1.9. We may just stay at 1.8 until we can establish everything for 1.9

    KEEP YOUR 1.8 JAR FILES!!!

    EDIT: We switched release date to Friday. I would appreciate it A TON if you could test your idea. We would all be happy. :p
     
  31. Offline

    Quezax

    here is my configs, but when I tested a commoner (the default group) had no restrictions at all. When they should only be able to do some basic tools, i was able to craft iron tools without restriction. if I specifically add a deny iron_pickaxe it blocks it, that is why I want to block everything then override with the allows configured below. a proper whitelist.

    Do I have to list all items individually in the blacklist to make this work? Is there any wild card (i.e. *, any, all,etc) that I can use instead? A configuration switch to default block all crafting?

    Thanks

    UPDATED:
    Afforess confirmed this is a bug fixed in Spout dev build 390+
     

Share This Page