Allow players to place unmodified command blocks?

Discussion in 'Spigot Plugin Help' started by NomadMC, Apr 23, 2017.

  1. So by default in Minecraft, only ops can place/use command blocks.

    However, on my server, command blocks have a double use: they are also used as a decoration item, as seen below.


    In this example, the command block (right side, below the redstone torch) opens the Vault door and is also designed to look like a Terminal.

    Thus the question being: Is it possible for a plugin to be made that can allow players to place these blocks?

    Of course, for security reasons, the plugin would have to also block players from placing NBT-altered comm blocks with potentially dangerous commands loaded already.

    If this isn't possible with a plugin because it's hard-wired into the MC server code, I can really just add another block textured like a Terminal, but I'm curious if this would be a possible concept.

    Edit note: This would not be a plugin to use command blocks; just to place them, as long as no modified NBT data is detected.
    #1 NomadMC, Apr 23, 2017
    Last edited: Apr 25, 2017
  2. Is there a method that the players can recive the Command block yet?
  3. Just give them dummy blocks and when placed, turn into a command block. No one gets any command blocks.
  4. If you want i can create the custom plugin contact me in PM
  5. skript code no problem:
    Code (Text):
    on place of commandblock:
        set {commandblockplacing.%player%} to location of player
        setblock at {commandblockplacing.%player%} to commandblock
        cancel event
    is for the placing i dont know how to open them
  6. Since it's a mod, it's going to be in Java. Skript won't help.

    So let me get this straight, you want to make it so a player can right click a command block without OP and access it, right? Slightly confused.
    • Funny Funny x 1
  7. its on a server not a mod <3
    • Agree Agree x 1
  8. No, that's what I don't want. My apologies if I worded that oddly. What I would like is a way that non-OPs can place (but not use) CBs.

    And it would definitely be a plugin for a server, not a mod.

    I've got a pretty busy week, so I won't be able to test out your Skript for placing CBs, Larsjarred, but I'll let you know on the weekend. Thanks
  9. np mate!, you can always pm me on spigot if you need me!
    • Like Like x 1
  10. Will do. I'll contact you via conversation PM from here.
    • Like Like x 1
  11. I'll check yours out as well, more options are always helpful :)
  12. btw at my place you get lifetime support like if the plugin stops working you need to pm me or email me and i will recode the plugin to get it working again :)
  13. Oh I see.

    I'm pretty sure there's a simple way to make it so non-OP's can do it through spigot's config or something, but if you can't then I guess you could use a BlockPlaceEvent, check if the event is cancelled and if the block is a command block and set it cancelled to false.

    Code (Text):
    public void onCmdPlace(BlockPlaceEvent event) {
    Player player = event.getPlayer();
    if (event.isCancelled() && event.getBlock().getType() == Material.COMMAND && !player.isOp()) {
    I can make this into a plugin for you if you like, won't be too hard and you can even use that code yourself if you want to put it into an existing plugin if you want (I haven't tested it but it should work)