Safe Command Block
Safe Command Block
What is Safe Command Block?
Safe Command Block makes the management of command blocks easier and safer. There are some problems what command blocks have:
- Command blocks cannot be used from a player who doesn't is a op.
- Command blocks can execute nearly every command (except kick, ban, op, deop, stop), so they aren't safe.
- You can only set a name of a command block only with a anvil.
If you have a public server you won't be able to build a adventure map with other players with this problems. Safe Command Block solves these problems with these features:
- Whitelist or Blacklist Commands
- World Whitelist (optional)
- Commands can be set from players even if they not op and in creative mode
- Set the name of a command block
- Reset the command of a command block
- With permission limitation
- Extra Color Codes
With this plugin you are now able to build a adventure map without worries!
What do I need to run Safe Command Block?
You will need a plugin called ProtocolLib and you need the bukkit build #2685 or higher. Install it and run it together with Safe Command Block. If anythig goes wrong just write a comment.
You may install some other plugins for more safety!
List of Commands/Permissions
Permission | Command | Description |
---|---|---|
SafeCommandBlock.access | Nothing | If someone has access to command blocks (modify the command) |
SafeCommandBlock.bypass | Nothing | If someone can bypass whitelist, blacklist and worldwhitelist |
SafeCommandBlock.color | Nothing | If someone can write the command with color codes to command blocks |
SafeCommandBlock.resetCommand | /resetcommand | If someone can reset the command of a command block (admin command) |
SafeCommandBlock.setCommandName | /setCommandName | If someone can set the name of a command block (admin command) |
SafeCommandBlock.setCommand | /setCommand | If someone can set the command of a command block |
SafeCommandBlock.reload | /scbreload | If someone can reload the config file of Safe Command Block |
Formatting Codes can be found here - Note: You'll use a & instead of a $.
Note: Admin commands won't check for other permissions like blacklist or whitelist!
For config sample click here.
How to use
If you want to modify the command of the command block or use a command from Safe Command Block, please be sure to target the command block directly. If you do so, nothing should go wrong!
Having Problems?
If it is a small problem, just write a comment. If it is a big/heavy problem, then please use the ticket function. Thank you!
@spetznack
Well, the point is that my plugin is not blocking the execution of command blocks, it only blocks what you are writing in the command block.
@KevinW1998
Well, kindof.. Hmm, this is getting complex.. I can probably live without it, but be aware that if you allow someone to /setblock and /summon, they can use those commands to create command blocks with whatever command in it without any problem. I assume it's very complicated for the plugin to identify arguments without any tags to it, which is why I figured it would probably be easier to NOT allow command blocks to execute without the " / " in front of it if that's possible.. Then the plugin would check if any of the words starting with " / " is allowed or not.
I'm no programmer so I don't know how practical this is :s It's just a idea for how to get around it. Information about this issue is kinda critical to get out early though, before it becomes a problem :P
@spetznack
So to put it simple: You want a system, where you can block arguments too....
@nicholosophy
I see what the problem is.... I'll think about it
Is it possible to use the command block gui when editing command block commands?
Using /setCommand limits the length of the command which is less than the limit in the gui. Alternatively, having a way when you could continue the command line (/setCommand -a blah blah)
So /setCommand first part of command
/setCommand -a second part of command
@KevinW1998
One possible issue could be that you can actually /summon commandblock-minecarts and add any command to that x)
I wonder, is it possible to use the blacklist\whitelist on the summon cmd-minecart command? :s
Maybe (if possible) as a workaround: Force commands executed from command blocks to require adding the "/". This would mean the cmdblockminecart wouldn't work if entering something like this: "/summon (blabla cmdminecart with command)
> "kill_the_server"You would have to add the "/" like this: "/summon (blabla cmdminecart with command:) "/kill_the_server"
Then Safe Command Block would see "/kill_the_server" and since it's not allowed through the blacklist or whitelist, it will be denied!
Food for thoughts.. What do you think?
EDIT: Because in cmd blocks you don't have to use "/" before the command and the command still works if you use "/".
@spetznack
Yup, it is checking the first word of the command and the plugin can prevent commanfs from other plugin aswell. Currently it is beta, because the whole packet system changed.
@KevinW1998
That's good news :D
I thought you had to be op and in creative even to place them. Tested it and I see now that everyone can place command blocks, makes sense now :D
The whitelist\blacklist is directly checking the first word you enter in the command block? Your plugin will prevent commands from other plugins as well right?
Thanks :)
@spetznack
Well SafeCommandBlock.access is the basic access permission. If the player doesn't have it he cannot use the commandblocks anyway. Every other permission is optional.
So if the player has the access permission and the command is whitelisted or not blacklisted then he can use this commanf for the command block. I hope you understand...
@All I will begin to update the plugins, because I've done all my test!
Interesting plugin, specifically I need a plugin to allow some builders to use specific commands in commandblocks without giving them OP.
From what I understand with this plugin though, if you allow someone to be able to place and set commands ... then you can't allow only certain commands?
@Slippery_Pete
Nope! Please use the v1.0.2.1 for 1.6!
Does the 1.7 Beta work on 1.6? I really need this on my mcpc+ server, so people can use commands blocks in my redstoning world with multiverse.
Thanks for any help.
@FlashLight32
Thank you! So I probably need some more time. School started again and I have ton of exams I have to work on.
Happy new year either!
@KevinW1998
Oh yeah good point beta :P so continu your good work, we really need a stable release version happy new year :D
@FlashLight32
I normally do :) But since the whole packet-system changed I needed so rewrite the text-scanner.... so it might throws errors.
I only use try... catch, where I know that a error can happen. Thats why I released a beta and not a full release.
just write say allo in commandblock :P
so why you dont use try catch method to reduce error ? ;)
@FlashLight32
It seems somebody tries to change the command of an commandblock all the time, with an invalide command. Do you know how I could repuduce the error?
[13:11:15 ERROR]: [SafeCommandBlock] Unhandled exception occured in onPacketRece iving(PacketEvent) for SafeCommandBlock java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(Unknown Source) [?:1.7.0_45] at me.KevinW1998.SafeCommandBlock.SafeCommandBlock.getRootCmd(SafeComman dBlock.java:340) [SafeCommandBlock.jar:?] at me.KevinW1998.SafeCommandBlock.SafeCommandBlock$1.onPacketReceiving(S afeCommandBlock.java:61) [SafeCommandBlock.jar:?] at com.comphenix.protocol.injector.SortedPacketListenerList.invokeReceiv ingListener(SortedPacketListenerList.java:114) [ProtocolLib-3.1.0.jar:?] at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacket Recieving(SortedPacketListenerList.java:67) [ProtocolLib-3.1.0.jar:?] at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(Pack etFilterManager.java:577) [ProtocolLib-3.1.0.jar:?] at com.comphenix.protocol.injector.PacketFilterManager.invokePacketRecie ving(PacketFilterManager.java:544) [ProtocolLib-3.1.0.jar:?] at com.comphenix.protocol.injector.netty.NettyProtocolInjector.packetRec eived(NettyProtocolInjector.java:277) [ProtocolLib-3.1.0.jar:?] at com.comphenix.protocol.injector.netty.NettyProtocolInjector.onPacketR eceiving(NettyProtocolInjector.java:237) [ProtocolLib-3.1.0.jar:?] at com.comphenix.protocol.injector.netty.ChannelInjector.decode(ChannelI njector.java:296) [ProtocolLib-3.1.0.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.callDe code(ByteToMessageDecoder.java:232) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukkit- 1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channe lRead(ByteToMessageDecoder.java:131) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukkit -1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invo keChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit-1.7.2-R0.3-297 8.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fire ChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit-1.7.2-R0.3-2978. jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channe lRead(ByteToMessageDecoder.java:173) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukkit -1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invo keChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit-1.7.2-R0.3-297 8.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fire ChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit-1.7.2-R0.3-2978. jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler.channe lRead(ReadTimeoutHandler.java:149) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukkit-1 .7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invo keChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit-1.7.2-R0.3-297 8.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fire ChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit-1.7.2-R0.3-2978. jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.DefaultChannelPipeline.fireChanne lRead(DefaultChannelPipeline.java:785) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukk it-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.nio.AbstractNioByteChannel$NioByt eUnsafe.read(AbstractNioByteChannel.java:100) [craftbukkit-1.7.2-R0.3-2978.jar:g it-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedK ey(NioEventLoop.java:480) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukkit-1.7.2-R0.2 -3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedK eysOptimized(NioEventLoop.java:447) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukkit- 1.7.2-R0.2-3-g530fcb7-b2978jnks] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.run(NioEventLoop .java:341) [craftbukkit-1.7.2-R0.3-2978.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b29 78jnks] at net.minecraft.util.io.netty.util.concurrent.SingleThreadEventExecutor $2.run(SingleThreadEventExecutor.java:101) [craftbukkit-1.7.2-R0.3-2978.jar:git- Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks] at java.lang.Thread.run(Unknown Source) [?:1.7.0_45] [13:11:15 ERROR]: Parameters: net.minecraft.server.v1_7_R1.PacketPlayInCustomPayload@74c9fc32[ tag=MC|AdvCdm length=256 data={0,0,0,0,42,0,0,0,63,-1,-1,-5,88,8,115,97,121,32,97,108,108,111,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} timestamp=1388945475349 ]
@FlashLight32
maybe you could tell me these errors?
woah this plugin send error in the log all time :(