VirtualPlayers2
VirtualPlayers
This is a lightweight plugin for 1) debugging plugins or 2) doing commands for plugins that need players.
The virtual players 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, <vp> = the name of virtual player
- dc <vp> <cmd>
- dc <vp> <any command you would normally do as a player>
- dc <vp> op : op virtual player
- dc <vp> deop : deop virtual player
- dc <vp> respawn : respawn the virtual player
- dc <vp> connect
- dc <vp> disconnect
- dc <vp> reconnect
- dc <vp> health <amount> : give the virtual player some health ( or kill them if 0 )
- dc <vp> inv : print out their inventory
- dc <vp> giveinv <item> : give them an item
- dc <vp> tp <location> : teleport them to the given location ( "world,3,3,3" )
- dc <vp> chat my message : have the virtual player talk in chat
- dc <vp> hit <player2> [damage] : attack other players, defaults to 5 damage
- dc <vp> interact <left | right> <location> : do a PlayerInteractEvent on the specified block location
- dc <vp> bpe <block> <location> : do a BlockPlaceEvent of the given material at the given location
- dc <vp> 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 p1 chat Hello Server!
- dc p1 bpe iron_block world,311,75,400 : Place an iron_block at world,311,75,400
Virtual Players will print out to the console if they teleport, speak, receive a message, 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
Source
Credits
VirtualPlayers was originally developed by alkarinv. All credits for the original plugin goes to him. :)
WorldEdit Compatibility
VirtualPlayers2 is fully compatible with WorldEdit v5.x but unfortunately, it is NOT compatible with WorldEdit v6.x. However if you're running WorldEdit v7.x (1.13+), you have nothing to worry about. But if you're still using v6.x, there is a special version of WorldEdit v6 that works with VirtualPlayers:
Quote:These builds have not been approved by the BukkitDev staff. Use them at your own risk. http://rainbowcraft.sytes.net/download/plugins/WorldEdit/v6.1.1-SNAPSHOT/
If anyone wants to use VirtualPlayers to execute WorldEdit & WorldGuard commands, then you can download the above WorldEdit. Or you can use any v5.x or v7.x version.
Here is the source code (& changes) if you wish to compile it yourself:
https://github.com/Europia79/WorldEdit/tree/vpcmdfix
https://github.com/Europia79/WorldEdit/commit/eb43018ae2211b4257e418209fef1b922a03cf91
@Unpluggeddk
thanks for letting me know
Cant place redstone, or anything you want to face a way.
ex /dc bobby bpe redstonetorch:1 test,176,58,334
(facing east)
You cant place redstone, it will just replace an existing block with air.
Cheers :)
Please update to support the latest spigot.
@Europia79
I really encourage you to do this! This plugin is great for testing but it can be even better for redstone freaks, especially with simulation of mob spawning like around real players. Toggle is of course necessary (performance of the server). Though I'm not sure if loaded chunks allow mobs to spawn like real players do. It suerly keeps redstone alive. But I'm no expert.
Than you for your time and motivation.
@UnpleasantPL
i guess i could listen for ChunkUnloadEvent and cancel it if there's a VirutalPlayer at that location... And also add a config option to toggle this feature on/off.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/world/ChunkUnloadEvent.html
Hello there!
Is there any way to keep mobs and redstone clocks active around fake player the same way they are active around real ones? :-) It would me a neat feature for keeping the villager farms and other complicated machines based on clock alive with chunks fully loaded. It's something I've been waiting for years!
i have a few questions and i found a bug
will there ever a config file is it possible to change the chat format to chat essentails
and when you initiate he chat command, it sends the message twice
@Dysthymical
I read the PVPManager code... In order to fix this, VirtualPlayers would have to inject itself into the CraftServer's playerList field and construct a playerConnection also. I doubt this is going to happen.
Another option would be for PVPManager to add support for VirtualPlayers in one of three ways:
1. For me.NoChance.PvPManager.Managers.PlayerHandler.add()... remove the first conditional statement:
2. Obviously, they do not want to un-necessarily populate their players HashMap, and that is the primary objective of the conditional check. But they don't have to return null... They could still return the created object without saving it to the HashMap. This is probably the best option because it's a more general solution to a variety of problems that arise when you return null.
The code would look something like this
Now it doesn't return null.
3. The third option would be to change the implementation details for the conditional-saving check to account for the existence of VirtualPlayers by hooking into the VirtualPlayers API.
Obviously, you wouldn't directly call VirtualPlayers.getPlayer() because it might not be installed on the server... But that's just an example. They would have hide the call via a Wrapper, Interface, or Utility to protect against ClassNotFoundException.
https://github.com/NoChanceSD/PvPManager/issues/41
https://github.com/NoChanceSD/PvPManager/pull/42
As far as Skript goes... That error is caused by PVPManager, not Skript. But if you have any other problems, lemme know and i'll take a look.
Can you add support for Skript and PVPManager? I get these spammed into console about every 30 seconds http://pastebin.com/snF6nL3w
@fr233
These builds have not been approved by the BukkitDev staff. Use them at your own risk.
http://rainbowcraft.sytes.net/download/plugins/WorldEdit/v6.1.1-SNAPSHOT/
If anyone wants to use VirtualPlayers to execute WorldEdit & WorldGuard commands, then you can download the above WorldEdit. Or you can use any v5.x version.
Here is the source code (& changes) if you wish to compile it yourself:
https://github.com/Europia79/WorldEdit/tree/vpcmdfix
https://github.com/Europia79/WorldEdit/commits/vpcmdfix
https://github.com/Europia79/WorldEdit/commit/eb43018ae2211b4257e418209fef1b922a03cf91
how to paste schematics use this plugin?
@LaughNgamez
Yeah, VirtualPlayers v1.6.5 for 1.8.7 needs approval from BukkitDev.
Development builds of this project can be acquired at the provided web-server.
These builds have not been approved by the BukkitDev staff. Use them at your own risk.
http://rainbowcraft.sytes.net/download/plugins/VirtualPlayers2/v1.6.5/
@Europia79 Would you please post a compiled build of the plugin to support 1.8.7 or is bukkit processing your request?
@jaime29010
v1.6.5 is updated for 1.8.7
@Jeffrey09
The code is pretty insane: https://github.com/Europia79/VirtualPlayers/tree/worldedit
That's the worldedit branch for VirtualPlayers (in case you wanted to find a developer to finish it). You would have to fix all the errors associated with the fake PlayerConnection. Then after that, you'd have to accommodate for VirtualPlayer being a real Player (the easy part).
@jaime29010
There shouldn't be any stacktrace... VirtualPlayers disables itself on server startup for unsupported servers... to prevent spamming the console with errors. Instead, you'll get a msg explaining that your server is un-supported.
I'm in the middle of updating BattleTracker right now... Hopefully, I can get to VirtualPlayers soon tho.
I like your plugin but using the lastest version (1.8.7) doesnt work, the nms classes have changed so yeah, it doesnt work, I think I dont need to put a stack trace in this situation.
@Europia79
I used your plugin in a similar way with schematics and now that I've come back to mc I would like to again. My problem is though that I can't backdate to WG 5.x so an update that fixes this would be nice.
@amli2011
LaughNgamez reported the same problem... I believe this feature works if you use WorldEdit v5.x... it just doesn't work if you use WorldEdit v6.0.0
WorldEdit has changed something in the code to break this feature. So either WorldEdit would have to change to allow fake players to run commands... Or else VirtualPlayers will have to somehow change to better simulate a real player... but HOW exactly, i do not know.
Thank you for the update!
I downloaded it and have tested a bit.
When i try to use a virtualplayer to execute WorldEdit commands schem load and paste it vil tell me that my clipboard is empty.
This might be that worldedit is not comfortable with virtual player...
First now I'll try your latest update and I'll search arounf a little more.
Again Thank you for the update :)
@Europia79
Thanks for your response. I just tried the latest dev build of Multiverse-Core (which was also suggested by someone else in the bukkit forums), but sadly it doesn't keep the dimension loaded without players - overworld-spawnchunks still go inactive the moment the last player leaves the overworld. Thought, keepSpawnInMemory: 'true' or autoLoad: 'true' might be the key there, but unfortunately they are not.