WorldEdit

WorldEdit

43M Downloads

VirtualPlayers can no longer execute WorldEdit v6 commands

LadyCailinBot opened this issue ยท 2 comments

commented

WORLDEDIT-3315 - Reported by Europia79

https://github.com/Europia79/VirtualPlayers

http://bukkit.org/threads/virtualplayer-cannot-execute-worldguard-worldedit-cmds.352155/

works in v5, but not in v6 due to
https://github.com/sk89q/WorldEdit/blob/58aac973af943bc747dc58161d84c34932d6bc1e/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java#L158

https://github.com/sk89q/WorldEdit/blob/58aac973af943bc747dc58161d84c34932d6bc1e/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java#L233-L238

Which is SessionManager.get() and get() checks if sessionKey.isActive(): Which calls worldedit.bukkit.BukkitPlayer.SessionKeyImpl.isActive(), whose implementation details are Bukkit.getServer().getPlayerExact(name) != null.

And getPlayerExact() calls Bukkit.getOnlinePlayers() and cycles thru them in order to check each players name on the server against the give argument name.

This is where the problem lies: VirtualPlayers are not listed in the net.minecraft.server.{version}.PlayerList which is a field of org.bukkit.craftbukkit.{version}.CraftServer

Essentially, WorldEdit v6 places a further command restriction to only those in the server's playerList.

Removing this restriction should be okay since the timer will perform an isActive() check at a later time, and remove them.

commented

Comment by LaughNgamez

I can confirm this issue and have tested the suggested fix and have no issues.

commented

Comment by Europia79

i submitted a Pull Request for this:

#330