CBWrapper
CBWrapper
Concept
Have you ever wanted to be able to use WorldEdit from command blocks? Or other plugins, too, whose commands won't work from command blocks. Well, this is the plugin for you! When the command /cw is run from a command block, it will create a dummy player where the command block is and run the command specified in the command parameters!
News
Some people (everybody) were getting issues between CBW 1.8_alpha, Essentials, and a few other plugins. These conflicts are a side effect of how CBW 1.8_alpha works and is what I hoped wouldn't happen. Avyge1l came up with a solution, which I have now implemented. The plugin now works almost exactly the same way it did in 1.7, but it works for 1.8 still.
Installation
Standard bukkit plugin installation; download the CBWrapper.jar and stick it in your plugins folder
Source Code
Version | Source Link |
Development Version | https://github.com/misson20000/CBWrapper |
Version 1.8.3 (current) | https://github.com/misson20000/CBWrapper/tree/v1.8.3 |
Version 1.8 | https://github.com/misson20000/CBWrapper/tree/v1.8 |
Version 1.8_alpha | https://github.com/misson20000/CBWrapper/tree/v1.8-playerlist |
Usage
If anything doesn't make sense, you might want to consult this page, which I think is a bit more friendly but less clear.
Just tell me how to use the plugin as fast as you can
Put /cw
in front of your commands and remove the first slash. WorldEdit commands will have one slash left and other commands will have no slashes left. Use commands just like you would as a player. Look at the examples for complicated things
That was great but didn't make much sense
That's what this section is for. Here I'll explain everything in more detail
CBWrapper adds one command, /cw for use in command blocks. The general usage is as follows:
/cw [-u username] [-w world] [ -o x y z] <command> [arguments]
For many purposes, however, simply
/cw <command> [arguments]
is sufficient.
The /cw command create a fake player and runs the command as it. This allows you to use commands from plugins that would usually only work for players. The best example of this would be WorldEdit. WorldEdit is usually meant for only players to use, and has no support for command blocks. Using the /cw command, you can trick WorldEdit into thinking that a player is using it and allow the operation.
Say you wanted a command block system to reset a spleef arena every time a new round starts.
You could put a command block at each corner to run the WorldEdit selection commands //pos1
and //pos2
and another
command block to replace the empty blocks with snow or whatever material you are using.
What if I want to have the command blocks far away? No problem. Use the -o option. -o originally stood for offset, but now it would make more sense as -p for position. Oh well. You give it 3 numbers, which are interpreted as coordinates. And numbers starting with a ~
will be interpreted as relative, so -o 5 ~0 -4
would mean run the command at X coordinate 5, use the command block's Y coordinate, and Z coordinate -4.
How about selecting regions in different worlds? Use the -w for world option. It takes one parameter: the name of the world to run the command in. Usually this would be "world", "world_nether", or "world_the_end." If you have Multiverse or something installed, the name of the multiverse world should work too. The -w option is best used with -o, because otherwise your command will be run in the same position, but in the nether or whatever world you specify.
That's great, but how can I prevent my selections from colliding? Pretend to be different players with the -u option. It takes one parameter: the username it pretends to have. WorldEdit thinks it's different players, but it actually isn't any players at all. It's just command blocks.
Examples
Select corner 1 of a WorldEdit selection: /cw /pos1
Select corner 2 of a WorldEdit selection: /cw /pos2
Replace blocks in selection: /cw /replace air snow
Make sure you don't use /set or /wall, as those might delete your command blocks!
Ban whoever dares approach the command block and pretend that someone else did it: /cw -u @r ban @p
Select a corner 2 blocks above the command block /cw -o ~0 ~2 ~0 /pos1
Select the coordinates (0, 0, 0) in the nether: /cw -w world_nether -o 0 0 0 /pos1
Stop the server: /cw stop
Help me it still doesn't make sense!
Leave a comment below. Post the commands you tried, what you're trying to do, and anything else you think would be helpful.
Be careful with the wiki formatting, it can mess things up. Usually putting {{{
and }}}
around your commands helps
Permissions
There is only one permission node, "cbwrapper.cb", for the /cw command
Other Notes
- The dummy player's username, by default, is "@"
- The dummy player's position is the position of the command block it was run from, unless you use the -o flag
- The dummy players isn't actually registered as a player, so you can't teleport people to it or anything
- The dummy player is an op with all permissions. The only bit of security is that the dummy player is only created by command blocks, which can only be edited by ops in creative mode
If you comment anywhere other than this page, I probably won't see it for at least a few months. PMs are fine, too
I've personally do not understand how this plugin works = (Can ktonibut Video sang for Russian =))
@Ranaakamarth
There's a slight problem in your recompilation, you forgot to add the newly implemented player methods. Really easily noticeable, if any plugin is actively retrieving any of those methods, you're gonna crash.
@Ranaakamarth
Here's a link to my recompiled .jar, for anyone that wants it. https://www.dropbox.com/s/952mqsb6dywq02v/cbwrapper.jar
I also fixed the problem where you had to include a garbage parameter after /cb.
Running on Minecraft 1.6.1 and cbwrapper 1.3, nothing happens when I use the /cb command. I placed the plugin in the server's plugins folder and enabled command blocks as well. I tried to follow the usage instructions and nothing happened.
EDIT:
I did get this message, just missed it. I downloaded the source and recompiled and that error went away. Now CBWrapper works perfectly with MC 1.6.2
[SEVERE] Could not load 'plugins\cbwrapper.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: misson20000/plugins/cbwrapper/CBWrapper : Unsupported major.minor version 51.0 at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230) at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.java:239) at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:217) at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56) at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11) at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:106) at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:391) at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582) Caused by: java.lang.UnsupportedClassVersionError: misson20000/plugins/cbwrapper/CBWrapper : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173) ... 9 more
@pookshuman
Hrm... let me poke around a bit... are you using CBWrapper v1.3?
This is no longer functioning for me. All I get is this message in the console over and over:
12:18:03 AM CBWrapper: Something tried to send a dummy player the message 'Unknown command. Type "help" for help.'
example command I tried: cb /replace 0 dirt
The command blocks worked fine before, and I haven't changed any of the command lines. The only thing that is different is updating /cb version.
CB shows up in /plugins and responds to the /cb command.
Any ideas?
@deleted_9420568
Are you running Java 6? I haven't put out a build of CBWrapper 1.2 for Java 6. Can you send me the server log?
@Daykunz
Not the most helpful reply, but can you look through your logfiles and tell me if you see any crash? Maybe it's the bug that MarioG1 pointed out. Does my plugin show up under /plugins? I'm gonna release another build today that should fix that bug and see if it works with that. The new build might take a while to be approved, though.
@MarioG1
I've been programming in lua... forgot that arrays start at 0 in java. Thanks! I'll fix this in the next build
I jumped through every hoop I could to get this plugin to work. I deleted all my plugins and downgraded the plugin and bukkit, and I cant even get the plugin to show up on /plugins.
Please hurry out with an update, I need this plugin bad
Cant get it to work at all. Better Instruction maybe a video please
@misson20000
I think i found an bug.
If i try to execute and command through an command block i have to write /cb # /pos1. You can replace the # with any string you want. I think this is caused by
I think i should start at 0 not at 1 to get also the first argument.
thx! great plugin! but is it possible to have multiple dummy players? there're lots of situations where more than one pair of position info is needed at the same time. Thanks again of creating such a helpful plugin and sorry for my bad english.
@trainphreak
Oh, yeah. I've been programming in LUA lately, and I keep forgetting that java gives an exception instead of null
@WhitePhoenix0
I don't think that you can directly pass coordinates to any WorldEdit selection commands. (Correct me if I'm wrong) What I would do is I would put 2 command blocks at 2 corners of the spleef arena, put "/cb /pos1" in one and "/cb /pos2" in the other. I would wire them together, put a repeater, and a third command block with "/cb /replace 0 glowstone". Make sure you use /replace, because /set will wipe out the command blocks. The command block with "/cb /replace" needs to happen at least 1 tick later then the other two, so that you get predictable results. You can do the command blocks with "/cb /pos1" and "/cb /pos2" at the same time, however.
Alright, so I installed and launched it with no errors, but then when I tried to make a regen button for spleef by doing the following:
I get this in the console:
I love the idea of this plugin though!
@misson20000
Wouldn't it make more sense to test if args.length is equal to 0?
@misson20000
Wait a minute... I do check for an argument! Can you post all of what the server puts out?
"if(args[0] != null) { ... } else { sender.sendMessage("Error: The /cb command requires at least one parameter"); return false; }"
@pookshuman
It is updated! At least, for 1.5.1 It should work for 1.5.2, though. Now, normally I would ask for a complete java stacktrace, but I think I know what the problem is. Thanks for saying the command you typed :) The problem is that /cb expects an argument and it doesn't check for one! I'll go and fix that
Great plugin, do you plan on updating it for a while?
The only problem I have is I get this error when typing "/cb"
6:35:24 AM CONSOLE: [SEVERE] null 6:35:24 AM CONSOLE: exception executing command 'cb' in plugin CBWrapper v1.1 6:35:24 AM CONSOLE: java.lang.ArrayIndexOutOfBoundsException: 0
Now that it works, I gotta say, I love it. Thanks to it, I've managed to make a simple spleef arena reset that doesn't require some big and messy plugin, just cb wrapper and worldedit. I love it!
Lovely plugin, just made command blocks on servers 1000 times better. I just wished they'd behave like this by default :D