BlockCommand - Run commands during block interactions

This is a discussion topic for the Ore project, BlockCommand. View the full project on Ore for downloads and more information.


BlockCommand

Description

BlockCommand is a plugin similiar to the ServerSigns bukkit plugin which allows to add commands to blocks which get executed when the player interacts with the block.

Features

  • Run any command as player or server
  • Send or broadcast a message
  • Supports all blocks and pressure plates (Configurable, default is signs)

Commands

  • /bcmd add <command> - Adds a command to the block you are looking at
  • /bcmd list - Lists the commands of the block you are looking at

Permissions

  • blockcommand.command.use - Allows command usage
  • blockcommand.admin - Allows breaking blocks with commands

Placeholders

Placeholder Description
<player|name> Name of the interacting player
<uuid> UUID of the interacting player
<server|srv|s> Defines the command to be run as server/console
<message|msg|m> Defines it to be a message send to the player
<broadcast|bcast|b> Defines it to be a message send to all players

Examples

/bcmd add <srv> give <player> stone
Runs the give command as server and replaces <player> with the name of the interacting player.

/bcmd add help
Runs the help command as player.

/bcmd add <msg> Hello <player>
Sends a message to the interacting player.

1 Like

How many commands can I add to a block?

There is no limit atm.

/bcmd add
[21:12:43] [Server thread/INFO] [nucleus]: Server 执行指令: /bcmd add
[21:12:43] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Error occurred while executing command: No value present
[21:12:43] [Server thread/ERROR] [Sponge]: Error occurred while executing command ‘bcmd add’ for source DedicatedServer: No value present
java.util.NoSuchElementException: No value present
at java.util.Optional.get(Unknown Source) ~[?:1.8.0_172]
at net.mineyourmind.blockcommand.commands.AddCommand.execute(AddCommand.java:23) ~[AddCommand.class:?]
at org.spongepowered.api.command.args.ChildCommandElementExecutor.execute(ChildCommandElementExecutor.java:255) ~[ChildCommandElementExecutor.class:1.12.2-2705-7.1.0-BETA-3206]
at org.spongepowered.api.command.spec.CommandSpec.process(CommandSpec.java:388) ~[CommandSpec.class:1.12.2-2705-7.1.0-BETA-3206]
at org.spongepowered.api.command.dispatcher.SimpleDispatcher.process(SimpleDispatcher.java:341) ~[SimpleDispatcher.class:1.12.2-2705-7.1.0-BETA-3206]
at org.spongepowered.common.command.SpongeCommandManager.process(SpongeCommandManager.java:328) [SpongeCommandManager.class:1.12.2-2705-7.1.0-BETA-3206]
at net.minecraft.command.ServerCommandManager.func_71556_a(SourceFile:1083) [dh.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71333_ah(DedicatedServer.java:432) [nz.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_172]
/bcmd add

You didn’t specific any command.

/bcmd add
I am using this

Did you read the examples above? You have to write a command behind add.

[BlockCommand] The block White wool is not listed in the config!

Add the block to the config.

The plugin works fine.
Good job, seriously sponge deserve more plugin like this.

1 Like

Any chance of adding Mod support?
When i try to add a modded block to the .conf it errors out on me

Which command are you trying to run and whats the error?

/bcmd add
error is a null exicution error from sponge
Sponge Log: https://pastebin.com/cL5G96va

The plugin works great without modded blocks.

Looks like the log is missing. You need to actually specify a command for the command to work.

How close in terms of usability is this to server signs? Can i set item costs to it like server signs? like items with custom enchants, etc.?

No you can’t. If you read the post it clearly lists it’s features there. Not sure if there is an alternative for sponge that has these features

on my server i am running:
Pixelmon
Pixelextras
BlockCommand
command-utils-2.4.0
(for the main ones involved)
what im wanting to do is when right clicking on a sign execute this command
cu execute if “cu has in hand pixelmon:poke_ball” “pokeedit 1 ball:poke”

so as to change the pokeball the user’s first pokemon is in. with your plugin however this does not work as i assume its using " to figure out what the command it is supposed to run is. however, the command-utils-2.4.0 also uses " and requires it to be in to find out what argument is what. is there a way to either make " work inside of the blockcommand.conf or is it possible to add conditionals directly through commands and not through something like command-utils-2.4.0. ive tried even using a scoreboard method but pokeedit doesnt recognize @p in the command blocks.

Is there a way to limit it to once a MC day?

Is there a way to make a block disappear after clicking? Currently I am using a custom head in my server and I want it to disappear after being used. I have tried adding world edit commands that would replace the head with air but I can’t figure it out. Thanks in advance