Fix @Requirements

This commit is contained in:
fullwall 2012-12-10 18:59:33 +08:00
parent 891e2fa96d
commit 6d6dec8e7a
4 changed files with 6 additions and 7 deletions

View File

@ -227,6 +227,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
private void registerCommands() { private void registerCommands() {
commands.setInjector(new Injector(this)); commands.setInjector(new Injector(this));
commands.registerAnnotationProcessor(new RequirementsProcessor());
// Register command classes // Register command classes
commands.register(AdminCommands.class); commands.register(AdminCommands.class);
@ -237,7 +238,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
commands.register(TemplateCommands.class); commands.register(TemplateCommands.class);
commands.register(TraitCommands.class); commands.register(TraitCommands.class);
commands.register(WaypointCommands.class); commands.register(WaypointCommands.class);
commands.registerAnnotationProcessor(new RequirementsProcessor());
} }
private void registerScriptHelpers() { private void registerScriptHelpers() {

View File

@ -35,7 +35,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
public class CommandManager { public class CommandManager {
private final Map<Class<? extends Annotation>, CommandAnnotationProcessor> annotationProcessors = Maps private final Map<Class<? extends Annotation>, CommandAnnotationProcessor> annotationProcessors = Maps
.newHashMap(); .newHashMap();

View File

@ -620,7 +620,7 @@ public class NPCCommands {
Messaging.send(sender, " <a>Type: <e>" + npc.getTrait(MobType.class).getType()); Messaging.send(sender, " <a>Type: <e>" + npc.getTrait(MobType.class).getType());
if (npc.isSpawned()) { if (npc.isSpawned()) {
Location loc = npc.getBukkitEntity().getLocation(); Location loc = npc.getBukkitEntity().getLocation();
String format = " <a>Spawned at: <e> %d, %d, %d in world %s"; String format = " <a>Spawned at <e>%d, %d, %d <a>in world<e> %s";
Messaging.send(sender, String.format(format, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), Messaging.send(sender, String.format(format, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(),
loc.getWorld().getName())); loc.getWorld().getName()));
} }

View File

@ -28,8 +28,8 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
this.destination = dest; this.destination = dest;
this.npc = npc; this.npc = npc;
Location location = npc.getBukkitEntity().getEyeLocation(); Location location = npc.getBukkitEntity().getEyeLocation();
plan = (Path) ASTAR.runFully(new VectorGoal(dest), new VectorNode(location, new ChunkBlockSource( plan = ASTAR.runFully(new VectorGoal(dest), new VectorNode(location, new ChunkBlockSource(location,
location, params.range()), params.examiners()), (int) (params.range() * 10)); params.range()), params.examiners()), (int) (params.range() * 10));
if (plan == null || plan.isComplete()) { if (plan == null || plan.isComplete()) {
setCancelReason(CancelReason.STUCK); setCancelReason(CancelReason.STUCK);
} else { } else {
@ -62,11 +62,11 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
.playEffect(vector.toLocation(npc.getBukkitEntity().getWorld()), Effect.STEP_SOUND, .playEffect(vector.toLocation(npc.getBukkitEntity().getWorld()), Effect.STEP_SOUND,
org.bukkit.Material.STONE.getId()); org.bukkit.Material.STONE.getId());
} }
NMS.setDestination(npc.getBukkitEntity(), vector.getX(), vector.getY(), vector.getZ(), params.speed()); NMS.setDestination(npc.getBukkitEntity(), vector.getBlockX(), vector.getBlockY() + 2,
vector.getBlockZ(), params.speed());
return false; return false;
} }
private static final AStarMachine ASTAR = AStarMachine.createWithDefaultStorage(); private static final AStarMachine ASTAR = AStarMachine.createWithDefaultStorage();
private static final Location NPC_LOCATION = new Location(null, 0, 0, 0); private static final Location NPC_LOCATION = new Location(null, 0, 0, 0);
} }