Fixed the adapt function for Actor -> Bukkit not working for players or command blocks

This commit is contained in:
Matthew Miller 2020-01-04 16:29:32 +10:00
parent 3ed02aa1a8
commit e198718a1e
2 changed files with 9 additions and 0 deletions

View File

@ -148,6 +148,11 @@ public class BukkitAdapter {
* @return The Bukkit command sender
*/
public static CommandSender adapt(Actor actor) {
if (actor instanceof com.sk89q.worldedit.entity.Player) {
return adapt((com.sk89q.worldedit.entity.Player) actor);
} else if (actor instanceof BukkitBlockCommandSender) {
return ((BukkitBlockCommandSender) actor).getSender();
}
return ((BukkitCommandSender) actor).getSender();
}

View File

@ -139,6 +139,10 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
return sender.hasPermission(permission);
}
public BlockCommandSender getSender() {
return this.sender;
}
@Override
public SessionKey getSessionKey() {
return new SessionKey() {