Skip to content

Commit

Permalink
Fix AnimationTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jan 4, 2015
1 parent 0f05bd1 commit 2ef7906
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ public void e(float f, float f1) {
}
}

@Override
public void E() {
if (npc == null) {
super.E();
}
}

@Override
public void g(double x, double y, double z) {
if (npc == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
}

@Override
protected void D() {
if (npc == null) {
super.D();
}
}

@Override
protected void E() {
if (npc == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AnimationTrigger() {
}

public AnimationTrigger(Collection<PlayerAnimation> collection) {
animations = Lists.newArrayList(animations);
animations = Lists.newArrayList(collection);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ public class AnimationTriggerPrompt extends StringPrompt implements WaypointTrig

@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("back"))
if (input.equalsIgnoreCase("back")) {
return (Prompt) context.getSessionData("previous");
}
if (input.equalsIgnoreCase("finish")) {
context.setSessionData(WaypointTriggerPrompt.CREATED_TRIGGER_KEY, new AnimationTrigger(animations));
return (Prompt) context.getSessionData(WaypointTriggerPrompt.RETURN_PROMPT_KEY);
}
PlayerAnimation animation = Util.matchEnum(PlayerAnimation.values(), input);
if (animation == null)
if (animation == null) {
Messaging.sendErrorTr((CommandSender) context.getForWhom(), Messages.INVALID_ANIMATION, input,
getValidAnimations());
}
animations.add(animation);
Messaging.sendTr((CommandSender) context.getForWhom(), Messages.ANIMATION_ADDED, input);
return this;
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/citizensnpcs/util/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class Messages {
public static final String ANCHOR_ALREADY_EXISTS = "citizens.commands.npc.anchor.already-exists";
public static final String ANCHOR_MISSING = "citizens.commands.npc.anchor.missing";
public static final String ANCHOR_REMOVED = "citizens.commands.npc.anchor.removed";
public static final String ANIMATION_ADDED = "citizens.editors.waypoints.triggers.animation.added";
public static final String ANIMATION_TRIGGER_PROMPT = "citizens.editors.waypoints.triggers.animation.prompt";
public static final String AVAILABLE_WAYPOINT_PROVIDERS = "citizens.waypoints.available-providers-header";
public static final String BEHAVIOUR_HELP = "citizens.commands.npc.behaviour.help";
Expand All @@ -30,7 +31,7 @@ public class Messages {
public static final String CITIZENS_SAVED = "citizens.notifications.saved";
public static final String CITIZENS_SAVING = "citizens.notifications.saving";
public static final String COLLAR_COLOUR_NOT_RECOGNISED = "citizens.commands.npc.wolf.unknown-collar-color";
public static final String COLLAR_COLOUR_NOT_SUPPORTED = "citizens.commands.npc.wolf.collar-color-unsupported";
public static final String COLLAR_COLOUR_NOT_SUPPORTED = "citizens.commands.npc.wolf.collar-color-unsupported";
public static final String COMMAND_AGE_HELP = "citizens.commands.npc.age.help";
public static final String COMMAND_HELP_HEADER = "citizens.commands.help.header";
public static final String COMMAND_INVALID_MOBTYPE = "citizens.commands.invalid-mobtype";
Expand Down Expand Up @@ -259,7 +260,7 @@ public class Messages {
public static final String WAYPOINT_TRIGGER_REMOVE_PROMPT = "citizens.editors.waypoints.triggers.remove.prompt";
public static final String WAYPOINT_TRIGGER_REMOVE_REMOVED = "citizens.editors.waypoints.triggers.remove.removed";
public static final String WAYPOINT_TRIGGER_TELEPORT_PROMPT = "citizens.editors.waypoints.triggers.teleport.prompt";
public static final String WOLF_TRAIT_UPDATED="citizens.commands.wolf.traits-updated";
public static final String WOLF_TRAIT_UPDATED = "citizens.commands.wolf.traits-updated";
public static final String WORLD_NOT_FOUND = "citizens.commands.errors.missing-world";
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
public static final String ZOMBIE_BABY_SET = "citizens.commands.npc.zombiemod.baby-set";
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ citizens.editors.waypoints.guided.end=Exited the guided waypoint editor.
citizens.editors.waypoints.guided.added-guide=Added a [[guide]] waypoint. This will guide NPCs to their destination.
citizens.editors.waypoints.guided.added-available=Added a [[destination]] waypoint. This will be available for NPCs to path to.
citizens.editors.waypoints.linear.added-waypoint=[[Added]] a waypoint at ({0}) ([[{1}]], [[{2}]])
citizens.editors.waypoints.linear.begin=<b>Entered the linear waypoint editor!<br> [[Left click]] to add a waypoint, [[right click]] to remove.<br> Type [[toggle path]] to toggle showing entities at waypoints, [[triggers]] to enter the trigger editor and [[clear]] to clear all waypoints.
citizens.editors.waypoints.linear.begin=<b>Entered the linear waypoint editor!<br><b> [[Left click]] to add a waypoint, [[right click]] to remove.<br><b> Type [[toggle path]] to toggle showing entities at waypoints, [[triggers]] to enter the trigger editor and [[clear]] to clear all waypoints.
citizens.editors.waypoints.linear.edit-slot-set=Editing slot set to [[{0}]] ({1}).
citizens.editors.waypoints.linear.end=Exited the linear waypoint editor.
citizens.editors.waypoints.linear.not-showing-markers=[[Stopped]] showing waypoint markers.
Expand All @@ -211,14 +211,15 @@ citizens.editors.waypoints.linear.waypoints-cleared=Waypoints cleared.
citizens.editors.waypoints.triggers.add.added=<b>[[Added]] waypoint trigger successfully ({0}).
citizens.editors.waypoints.triggers.add.invalid-trigger=Couldn''t create a trigger by the name [[{0}]].
citizens.editors.waypoints.triggers.add.prompt=Enter in a trigger name to add or type [[back]] to return to the edit prompt. Valid trigger names are {0}.
citizens.editors.waypoints.triggers.animation.added=Animation [[{0}]] added.
citizens.editors.waypoints.triggers.animation.prompt=Enter in animations to perform - valid animations are {0}.<br>Type in [[finish]] to finish the animation trigger or [[back]] to return to the previous prompt.
citizens.editors.waypoints.triggers.animation.invalid-animation=Invalid animation [[{0}]]. Valid animations are {1}.
citizens.editors.waypoints.triggers.chat.invalid-radius=The radius must be a number.
citizens.editors.waypoints.triggers.chat.missing-radius=No radius supplied.
citizens.editors.waypoints.triggers.chat.prompt=Enter in chat lines to say.<br>Type in [[radius (radius)]] to set the block radius to broadcast the messages.<br>Type [[finish]] to finish the chat trigger or [[back]] to return to the previous prompt.
citizens.editors.waypoints.triggers.delay.prompt=Enter the delay in [[server ticks]] to use. (20 ticks = 1 second)
citizens.editors.waypoints.triggers.main.missing-waypoint=Not editing a waypoint.
citizens.editors.waypoints.triggers.main.prompt=<b>Entered the waypoint trigger editor.<br> Type [[add]] to begin adding triggers and [[remove]] to remove triggers.<br> Type [[triggers]] to enter the waypoint trigger editor.<br> Current triggers are:
citizens.editors.waypoints.triggers.main.prompt=<b>Entered the waypoint trigger editor.<br> Type [[add]] to begin adding triggers and [[remove]] to remove triggers.<br> Type [[triggers]] to enter the waypoint trigger editor.<br><b> Current triggers are:
citizens.editors.waypoints.triggers.remove.index-out-of-range=Index must be in the range [[1-{0}]].
citizens.editors.waypoints.triggers.remove.not-a-number=Index must be a number.
citizens.editors.waypoints.triggers.remove.prompt=Enter in the index of the trigger to delete or [[back]] to return to the edit prompt. Current triggers are:
Expand Down

0 comments on commit 2ef7906

Please sign in to comment.