Changed command pipeline to use Actor over LocalPlayer.

This commit is contained in:
sk89q
2014-06-27 17:55:39 -07:00
parent aaf4c61251
commit ebe2bc6ae2
11 changed files with 127 additions and 138 deletions

View File

@ -97,6 +97,24 @@ public class WorldEditBinding extends BindingHelper {
return worldEdit.getSessionManager().get(sender);
}
/**
* Gets an {@link Actor} from a {@link ArgumentStack}.
*
* @param context the context
* @return a local player
* @throws ParameterException on error
*/
@BindingMatch(type = Actor.class,
behavior = BindingBehavior.PROVIDES)
public Actor getActor(ArgumentStack context) throws ParameterException {
Actor sender = context.getContext().getLocals().get(Actor.class);
if (sender == null) {
throw new ParameterException("Missing 'Actor'");
} else {
return sender;
}
}
/**
* Gets an {@link Player} from a {@link ArgumentStack}.
*