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
I have used this on my public server and found out it was being exploited from no permissions set. Are there in fact any permissions, and if not, would you mind to much if I added some?
@Mhjort
Mhjort, here is a version for the new craftbukkit build.
http://dev.bukkit.org/media/files/655/360/VirtualPlayers.jar
@alkarinv
Sounds good, thanks.
@Mhjort
VirtualPlayers uses internals of craftbukkit, and they must have changed something. Ill download that version and put up a link for a new virtualplayers for it.
I'm getting the following error with build #2515
Awesome! Thanks, I'll come back with my AutoTest results :D
@krisdestruction
I have clicks, I just call them "interact" since that is the event that is fired.
virtualplayers also have a tp command
I have an automated plugin test script that I run before I do a plugin update. It's a Bash script. I'd like to use this with PluginUpdater. Can you add support for simulated clicks? Essentials has tp and pitch allowing the virtual player to move and look around easily.
@mig4ng
They don't use slots and shouldn't appear in the tabs. Really they should be nearly invisible to everyone but you.
Does this players use Slots or apear on the TAB? Thx...
Thanks for the Update. The BlockPlacement works like a Charm. Love this Plugin. :)
You Uploaded the Right Version. The Error was on my Side. :) Hoped nobody saw it.
There was the FileUpload Popup lost behind my Browsers wich Asked me to Replace the Old file. Started working after the Correct file was on my Server.
<- Sometimes Really Really Stupid.
@Q2Lummox
So it turns out it's deceptively simple. The problem is I don't think bukkit allows you to change how long you stay in the bed. So bukkit hides all of that code from coders. So with one person you might be stuck getting into bed multiple times to heal up. :(
@LanToaster
Strange, I must have uploaded an old version to Bukkit. I just pasted your command in and it works fine.
I'll update it now.
Until it clears you can find it here.
https://github.com/downloads/alkarinv/VirtualPlayers/VirtualPlayers.jar
@alkarinv
I'll explain better what I need.
I have installed the plugin "BedHealth" which allows you to regenerate your health if you stay in bed some time (you can set how much time you have to stay in bed, to heal, I have set to 2 minutes.)
The problem is that if someone goes to bed, when passing a few seconds, time changes, and changes from night to day. So that's why I they made this plugin "SleepDisable". Cancels the transition from night to day, and also prevents you to be automatically ejected from the bed to take a few seconds.
The problem is that the plugin "SleepDisable" only works if there is more than one player online. I explain better:
2 Players Online (Player1 and Player2). Is night. Player1 goes into the bed (have only 3 hearts of health), stays in bed 2 minutes and their health regenerates. If Player2 decides to enter his bed while he happens at just like Player1, without changing the time.
So it works perfect. Now, the problem is when there is only one player. I explain better:
1 Player Online (Player1). Is night, Player1 enters the bed (have only 3 hearts of health), a few seconds of entering the bed, it is automatically ejected (the time has not changed), and has not had time to regenerate health. You should stay in bed until the player decides to get up, as happens in the previous case, but having a single player online, the plugin "SleepDisable" malfunctioned.
I have no idea of programming, do not know how to modify a plugin: (
You think that can be solved?.
A greeting.
PS: Sorry for my English: P
@Q2Lummox
That is a bit tricky. The problem there is adding them to the online player list (which is what you would need). Adding them to the online player list makes the server appear as if many more people are online than should be, which would be abused many people.
A better solution would be to fix the code itself. I've checked the code out, it's super simple, only 1 file with almost no lines of code.
https://github.com/TrungLam/SleepDisable/blob/master/src/com/github/TrungLam/SleepDisable.java
I've never used beds in a multi player server, so I'm a bit unclear as to what you want, but i think even if you don't know code you could modify this.
I'm using a plugin called "SleepDisable" which allows you to use the bed at night, without changing the time to use it. It works well when there are several players online, but when there is only one player, do not change the time, but you strip the bed within seconds.
http://forums.bukkit.org/threads/plugin-really-simple-disable-change-the-time-when-sleeping.112170/
I need a plugin to "lie" about online players to make a player always active. I tested your plugin, but the server does not recognize it as a real player, just as shown in the "Tab-List". Need to know if there is any way to make the server believe that the player "Fake" interpret it as a real player in all respects.
Greetings :)
@levisn1
It looks like the problem is the /pos1 command. Does it allow you to specify a world? like /pos1 world2,-110,49,579?
b/c if you use
@levisn1
I have question, i tried to execute command dc p1 /pos1 -110,49,579 and p1 /pos2 -136,49,561 and p1 /set 20 to have a simple wall of glass, and i want this in my second world.
Now where i do this commands, it create this wall in my main world..i tried to teleport p1 in that world, but nothin, the wall still appear in my first main world. solutions?
EPIC PLUGIN! THANKS TO EXIST!!!!!!! now in my server i can do automatic events :D:D:D
For the person who reported this not working for Heroes and eventually causing crashes. So I looked into making the VirtualPlayers "more real" by hooking them into the online code of bukkit.. Unfortunately this gets too close to spoofing players and I backed off. So turns out there is not much I can do.
I do run VirtualPlayers with Heroes to debug a lot of plugins with Heroes classes, but they are on my test server which is never up for more than a couple of hours. So it seems like whatever the issue is, its the accumulation of many Heroes things that eventually causes the problem.
So a warning for anyone that is using this on a live server with Heroes, consider removing VirtualPlayers.