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
Thanks you very much. This plugin is very good idea. Thanks you :D
I like the direction you are taking, the -o will make it much easier for me to design my events. I'm getting an error with the CraftBook compatibility version:
[09:33:35 ERROR]: Could not load 'plugins\CBWrapper.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: name 'CBWrapper <CraftBook compat
' contains invalid characters.
Looks like it just doesn't like the special characters in the description?
EDIT: Just tried out the non-craftbook compatible one. This is great! I'd buy you a drink if you had a donate button! :)
@Rosgrim25
I'm no WorldGuard expert, but looking at the command references, /region only has one slash. If you remove the slash and just put "/cb region addowner [id] [name]" it should work
@Loraxe42
@TadeasKohoutek
I'll try to get it out a bit later today after I test it and stuff
This mod has been very useful for me, but it would be awesome if we could turn off the console spam. Either a command line option, or a config.yml setting, or anything. Thanks, and keep up the good work!
I have a problem.
when i use /cb say hello, it work. but don't work with other cmds.
customNPC mod use the same way than a command bloc for commands.
for exemple i use customNPC mod, and i want my npc use one command. It work with my cmd PEX,that's good. exemple : /pex user group set [member] [id]
But i want cuboid an area with this npc, and WorldGuard doesn't work with cmd bloc.
for try i write /cb /region addowner [id] [name] and it doesn't work, with command bloc, but when i write this command manualy it works.
sory for my english :D i hope my message is good.
This is very good plugin but i need more dummny player please uptade. :(
When will be new verzion?? I want more dummy player.
@AlexSmith49
That's a pretty good idea. I'll try to implement that in the next version of CBWrapper, as well as adding some support to make it compatible with CraftBook.
Any chance you could set the dummy player a few blocks above the command block? For example if I run "cb 2 [cmd]' it would spawn a dummy player 2 blocks above the command block, thus allowing for it to be hidden.
Ok, I have this mostly figured out, but one annoying problem remains. When I name the commandblock with the anvil, that does work and I can have a name other than "@". However, it seems it creates a new "dummyplayer" object every time cbwrapper is called. Would it be possible to change it so that it re-uses the same dummyplayer object? Or, better yet, make it so that it only makes a new object if it is using a name that was not used previously?
Hello, I've been working on trying to get the plugin Movecraft compatible with CBWrapper. I'm hoping you can give me some insight into how your plugin works so I can figure out what went wrong. In my plugin I have a "onCommand" method that checks for various commands. It works great when I type the command in as a player, say if I type:
/release
the command executes (specifically it says I have no craft to release). However, if I use CBWrapper with a commandblock set to:
cb release
Then I get the "Unknown command" error message on my server console. Does CBWrapper not send "onCommand" events? Am I missing something? Thank you very much for any help you can offer, I'm excited at the prospect of being able to use your plugin to automate tasks.
EDIT: I think I see the problem. For some reason, when I run player.getName() I'm getting a name of "@". That doesn't sound right.
@misson20000
/cw would be great, but I get what you mean with changing the command completely. Maybe just add /cbw or /cbwrapper as aliases?
Sweet, the plugin is working now!
Unfortunately I can't launch Minecraft anymore :( I get a core dump error.EDIT: For anyone else getting this core dump error, you need to apply memory flags in the launcher. Unfortunately memory is not automatically allocated with Java 7 Update 51 64-bit.
@aaronfranke
Update your java! Most recent builds are for Java 7, but if absolutely necessary I can make a Java 6 build, but people should have their java updated anyway
Help, I put CBWrapper-java7-bukkit1843.jar in my /plugins folder and it does not show up in the /pl menu. Other plugins in the same directory such as Essentials are working fine. Placing the command "cb /remove arrow 100" does not do anything ( //remove arrow 100 removes arrows in worldedit). Other plugins are Essentials, Vault, WorldEdit, & LagMeter.
EDIT: The same thing occurs with the 1.7 build linked at the side.
EDIT 2: Logs revealed this error:
[15:00:42] [Server thread/ERROR]: 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
@misson20000 @misson20000 What about just /cw? And an alias is fine provided it can work without conflicting with CraftBook.
@sharqman
I want to stay backwards compatible, so that might be a bit difficult. I've been told in the past that it interferes with CraftBook, but if I changed the command, server admins would be forced to change every single command block that uses CBWrapper. What would you recommend I change it to? I usually prefer shorter names, but do you want the command changed, or do you want an alias that you can also use?
Can change the command from /cb to something else? /cb interferes with craftbook D:
@flexstoll
Example: If you wanted to run the "/say Hi" command with CBWrapper, you could put "/cb say Hi" into the command block. You can just remove the slash from the command and put /cb at the start
@broLa123
The reason it is working with only WorldEdit commands is because they have two slashes. If you want to run /spawnmob Chicken 1, you should remove the slash. Your command block should say "/cb spawnmob chicken 1". If you do "/cb /spawnmob Chicken 1", it is trying to run the command
"//spawnmob Chicken 1"
because of how Bukkit handles commands.What means this: /cb [-u <username>] cb [args] ????? I dont know what I must write in when I will say that a command block does WorldEdit- commands. Please help me