Add a few methods for setting lookclose/gravity directly.

This commit is contained in:
Jeremy Schroeder 2012-11-07 22:23:02 -05:00
parent 3faa57ee70
commit 0021b57f44
3 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,10 @@ public class Gravity extends Trait implements Toggleable {
velocity.setY(Math.max(velocity.getY(), 0));
npc.getBukkitEntity().setVelocity(velocity);
}
public void gravitate(boolean gravitate) {
enabled = gravitate;
}
@Override
public boolean toggle() {

View File

@ -39,7 +39,11 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
realisticLooking = args.hasFlag('r');
}
private void findNewTarget() {
public void lookClose(boolean lookClose) {
enabled = lookClose;
}
private void findNewTarget() {
List<Entity> nearby = npc.getBukkitEntity().getNearbyEntities(range, range, range);
final Location npcLocation = npc.getBukkitEntity().getLocation();
Collections.sort(nearby, new Comparator<Entity>() {
@ -114,7 +118,7 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
enabled = !enabled;
return enabled;
}
@Override
public String toString() {
return "LookClose{" + enabled + "}";

View File

@ -53,5 +53,6 @@ public class WaypointTriggerRegistry implements Persister {
addTrigger("chat", ChatTrigger.class, ChatTriggerPrompt.class);
addTrigger("delay", DelayTrigger.class, DelayTriggerPrompt.class);
addTrigger("teleport", TeleportTrigger.class, TeleportTriggerPrompt.class);
addTrigger("pose", PoseTrigger.class, PoseTriggerPrompt.class);
}
}