Skip to content

Commit

Permalink
Fixed the adapt function for Actor -> Bukkit not working for players …
Browse files Browse the repository at this point in the history
…or command blocks
  • Loading branch information
me4502 committed Jan 4, 2020
1 parent 3ed02aa commit e198718
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -148,6 +148,11 @@ public static BukkitPlayer adapt(Player player) {
* @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();
}

Expand Down
Expand Up @@ -139,6 +139,10 @@ public boolean hasPermission(String permission) {
return sender.hasPermission(permission);
}

public BlockCommandSender getSender() {
return this.sender;
}

@Override
public SessionKey getSessionKey() {
return new SessionKey() {
Expand Down

0 comments on commit e198718

Please sign in to comment.