mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-28 21:55:29 +01:00
Stop previous AStarTargeter nav strategy, usability tweaks for animation/chat triggers
This commit is contained in:
parent
6e27ec8920
commit
147df027bb
@ -186,6 +186,9 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
}
|
}
|
||||||
location = block.getLocation();
|
location = block.getLocation();
|
||||||
}
|
}
|
||||||
|
if (strategy != null) {
|
||||||
|
strategy.stop();
|
||||||
|
}
|
||||||
strategy = npc.isFlyable() ? new FlyingAStarNavigationStrategy(npc, location, parameters)
|
strategy = npc.isFlyable() ? new FlyingAStarNavigationStrategy(npc, location, parameters)
|
||||||
: new AStarNavigationStrategy(npc, location, parameters);
|
: new AStarNavigationStrategy(npc, location, parameters);
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ public class AnimationTriggerPrompt extends StringPrompt implements WaypointTrig
|
|||||||
if (animation == null) {
|
if (animation == null) {
|
||||||
Messaging.sendErrorTr((CommandSender) context.getForWhom(), Messages.INVALID_ANIMATION, input,
|
Messaging.sendErrorTr((CommandSender) context.getForWhom(), Messages.INVALID_ANIMATION, input,
|
||||||
getValidAnimations());
|
getValidAnimations());
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
animations.add(animation);
|
animations.add(animation);
|
||||||
Messaging.sendTr((CommandSender) context.getForWhom(), Messages.ANIMATION_ADDED, input);
|
Messaging.sendTr((CommandSender) context.getForWhom(), Messages.ANIMATION_ADDED, input);
|
||||||
@ -64,7 +65,14 @@ public class AnimationTriggerPrompt extends StringPrompt implements WaypointTrig
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
Messaging.sendTr((CommandSender) context.getForWhom(), Messages.ANIMATION_TRIGGER_PROMPT, getValidAnimations());
|
if (context.getSessionData("said") == Boolean.TRUE) {
|
||||||
|
Messaging.send((CommandSender) context.getForWhom(),
|
||||||
|
"Current animations:<br>- " + Joiner.on("<br>- ").join(animations));
|
||||||
|
} else {
|
||||||
|
Messaging.sendTr((CommandSender) context.getForWhom(), Messages.ANIMATION_TRIGGER_PROMPT,
|
||||||
|
getValidAnimations());
|
||||||
|
context.setSessionData("said", true);
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class ChatTriggerPrompt extends StringPrompt implements WaypointTriggerPr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WaypointTrigger createFromShortInput(ConversationContext context, String input) {
|
public WaypointTrigger createFromShortInput(ConversationContext context, String input) {
|
||||||
return null;
|
return new ChatTrigger(radius, Lists.newArrayList(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,6 +54,7 @@ public class ChatTriggerPrompt extends StringPrompt implements WaypointTriggerPr
|
|||||||
"Current lines:<br>- " + Joiner.on("<br>- ").join(lines));
|
"Current lines:<br>- " + Joiner.on("<br>- ").join(lines));
|
||||||
} else {
|
} else {
|
||||||
Messaging.sendTr((CommandSender) context.getForWhom(), Messages.CHAT_TRIGGER_PROMPT);
|
Messaging.sendTr((CommandSender) context.getForWhom(), Messages.CHAT_TRIGGER_PROMPT);
|
||||||
|
context.setSessionData("said", true);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user