mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 03:25:13 +01:00
Trigger conversation is active while the editor is active
This commit is contained in:
parent
641b19aa99
commit
e898918d6d
@ -102,6 +102,7 @@ public class LinearWaypointProvider implements WaypointProvider {
|
||||
@Override
|
||||
public void begin() {
|
||||
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_BEGIN);
|
||||
conversation = TriggerEditPrompt.start(player, LinearWaypointEditor.this);
|
||||
}
|
||||
|
||||
private void createWaypointMarker(int index, Waypoint waypoint) {
|
||||
@ -178,27 +179,13 @@ public class LinearWaypointProvider implements WaypointProvider {
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
if (!event.getPlayer().equals(player))
|
||||
return;
|
||||
if (event.getMessage().equalsIgnoreCase("triggers")) {
|
||||
event.setCancelled(true);
|
||||
if (!player.hasPermission("citizens.waypoints.triggers")) {
|
||||
Messaging.sendErrorTr(player, Messages.COMMAND_NO_PERMISSION);
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
conversation = TriggerEditPrompt.start(player, LinearWaypointEditor.this);
|
||||
}
|
||||
}, 1);
|
||||
return;
|
||||
}
|
||||
if (!event.getMessage().equalsIgnoreCase("toggle path"))
|
||||
return;
|
||||
event.setCancelled(true);
|
||||
// we need to spawn entities, get back on the main thread.
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// we need to spawn entities, get back on the main thread.
|
||||
togglePath();
|
||||
}
|
||||
}, 1);
|
||||
|
@ -34,14 +34,12 @@ public class TriggerEditPrompt extends StringPrompt {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
context.setSessionData("previous", this);
|
||||
context.setSessionData("exit", false);
|
||||
if (editor.getCurrentWaypoint() == null)
|
||||
return Messaging.tr(Messages.WAYPOINT_TRIGGER_EDITOR_INACTIVE);
|
||||
|
||||
String base = Messaging.tr(Messages.WAYPOINT_TRIGGER_EDITOR_PROMPT);
|
||||
Waypoint waypoint = editor.getCurrentWaypoint();
|
||||
for (WaypointTrigger trigger : waypoint.getTriggers()) {
|
||||
base += "\n - " + trigger.description();
|
||||
if (editor.getCurrentWaypoint() != null) {
|
||||
Waypoint waypoint = editor.getCurrentWaypoint();
|
||||
for (WaypointTrigger trigger : waypoint.getTriggers()) {
|
||||
base += "\n - " + trigger.description();
|
||||
}
|
||||
}
|
||||
Messaging.send((CommandSender) context.getForWhom(), base);
|
||||
return "";
|
||||
|
@ -147,7 +147,7 @@ citizens.editors.waypoints.triggers.add.added=<b>[[Added]] waypoint trigger succ
|
||||
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.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. Type [[triggers]] to begin editing waypoint triggers.
|
||||
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.
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user