VirtualPlayers
VirtualPlayers
This is a lightweight plugin for 1) debugging plugins or 2) doing commands for plugins that need players.
The virtualPlayers can take actions via commands and print out the events that are happening to them on the console. These players don't show up in game, but are just used for performing actions as if a player was there. Very useful if you don't even want to load up Minecraft, you just boot the server and debug as if you were players without even running the game.
The virtual players respond to the following commands.
Commands as Players
Commands: dc = do command, <virtual player> = the name of virtual player
- dc <virtual player> any command you would normally do as a player
- dc <virtual player> op : op virtual player
- dc <virtual player> deop : deop virtual player
- dc <virtual player> respawn : respawn the virtual player
- dc <virtual player> disconnect
- dc <virtual player> connect
- dc <virtual player> reconnect
- dc <virtual player> health <amount> : give the virtual player some health ( or kill them if 0 )
- dc <virtual player> inv : print out their inventory
- dc <virtual player> giveinv <item> : give them an item
- dc <virtual player> tp <location> : teleport them to the given location ( "world,3,3,3" )
- dc <virtual player> chat my message : have the virtual player talk in chat
- dc <virtual player> hit <player2> [damage] : attack other players, defaults to 5 damage
- dc <virtual player> interact <left | right> <location> : do a PlayerInteractEvent on the specified block location
- /dc <virtual player> bpe <block> <location> : do a BlockPlaceEvent of the given material at the given location
- /dc <virtual player> bbe <location> : do a BlockBreakEvent at the given location
Other Commands
- /virtualplayers hideMessages : hide messages from players
- /virtualplayers showMessages : show messages from players
Examples:
- dc p1 spawn
- dc p2 disconnect
- dc p1 chat Hello Server!
- dc p3 bpe iron_block world,310,65,700 : Place an iron_block at world,310,65,700
hideMessages
Virtual Players will print out to the console if they teleport, receive a message or tell, respawn, connect/reconnect
I usually have a text file where I type out the commands I want to do with the players then just paste all of the actions into the console
No compatible with Authme 1.4.6 ... -_-
@Feaelin
cool :)
@alkarinv: Thanks for the github update, Alkarinv! No worries if you don't have time to put in the event changes, I can probably do them myself. Thanks for the great plugin!
@Feaelin
is it behind already? and it is and is now updated. I can try to put it those changes, but it might be a bit since this is a hectic time , so you might want to do it yourself.
@Lildirt
Yeah, I wish I could add myself into the online players but not add it to the online count... if anyone knows how I would love to do that, would make things easier.
Excellent plugin! I think it will be very helpful to me in testing other plugins...:)
I've a request. Could you add code to the connect command to trigger the PlayerLoginEvent and PlayerPreLoginEvent* events? I was going to add it myself to a fork on GitHub, but it looks like the GitHub is a few revisions behind...:)
* Or rather, AsyncPlayerPreLoginEvent. PlayerPreLoginEvent has been deprecated in favor of the Async event.
Alright, cool. I could use this, most definitely. :)
I'll experiment a bit and report back if I found any issues :)
EDIT: Really cool, pretty awkward when it throws a NoCheatPlus violation, though. (Player trying to damage me from 1000 blocks away)
@Mhjort
So it did, I'll have a new release today.
Just letting you know the plugin, broke in 1.4.6 :)
@alkarinv
The status says that they are in the correct world. It's just other commands don't recognize it? I found another way to accomplish what I want, but if you want more info I can keep going.
@bugeye999
try doing
to see what world they are in. I've done multiworld teleports with them before and it's seemed to work. Maybe though I need to call an extra event for the mv command to work. Im surprised the mv command even sees them actually.
Hey, so I am having some trouble with teleporting the players around. So I want to have a virtual player perform a command in a given world, but after I do a "dc p1 tp" if I do "mv info" to get information on the world that they're in, they are still in the original world. I get a message saying that they teleported. Am I missing something?
@Anglican333
Depends on what you mean by executor on Anglican. Usually you can use Virtualplayers to do commands, but other plugins can't affect them directly because they don't show up in the minecraft server list. If you want to get around this for debugging check out comment #72.
@alkarinv
Haha yeah I hear ya. Keep up the good work
@alkarinv
Does this mean that commands should still execute on Virtual Players?
@Anglican333
It makes a new Player class that extends CraftPlayer, the internal craftbukkit implementation of Player.
This way I can add the virtualplayer into craftbukkit directly.
How is this done? Does this create a new EntityPlayerMP or whatever Bukkit uses? Or does it use a custom player class?
@App1eGenius93
Yeah, exactly why I made it, I just got sick of asking if anyone could help me. It's probably the most useful plugin I've made to be honest, at least if you are a developer or a server admin testing out things. I use it constantly.
@alkarinv
Ooh, I figured it out. It was a problem on my end, my script to send commands to the server is faulty. It was just sending "dc" without any arguments. Sorry about that.
Hey great idea and love the plugin and I've only read this page!
I often find I'm the only one that can login and test a plugin, this will make me less dependent on friends for testing! :D
@levisn1
Alright, I think I'm an idiot. So the problem is this.. bukkit has moved to a new versioning scheme for plugins that use CraftBukkit code, something VirtualPlayers needs to do. They are currently on 1.4.5-R0.3, which is what I built the newest VirtualPlayers for. But for some reason there is no option to select R0.3 for the version compatibility for the plugin, so I had to select R0.2 (its really not, it's really R0.3).
You need VirtualPlayers 1.3.1. That should work fine for your server.
In the future (hopefully soon) I can make the newest version of VirtualPlayers work with all previous CraftBukkits as well.
Sorry about this levisn!