Skip to content

Commit

Permalink
wp dt is now a toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed May 3, 2022
1 parent 7092926 commit c880ef8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java
Expand Up @@ -9,6 +9,7 @@
import org.bukkit.entity.Player;

import net.citizensnpcs.Citizens;
import net.citizensnpcs.api.ai.TeleportStuckAction;
import net.citizensnpcs.api.astar.pathfinder.ChunkBlockSource;
import net.citizensnpcs.api.command.Command;
import net.citizensnpcs.api.command.CommandContext;
Expand Down Expand Up @@ -61,9 +62,15 @@ public void add(CommandContext args, CommandSender sender, NPC npc) throws Comma
max = 1,
permission = "citizens.waypoints.disableteleport")
public void disableTeleporting(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
npc.getNavigator().getDefaultParameters().stuckAction(null);
npc.data().setPersistent(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, true);
Messaging.sendTr(sender, Messages.WAYPOINT_TELEPORTING_DISABLED);
npc.data().setPersistent(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA,
!npc.data().get(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, false));
if (npc.data().get(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, false)) {
npc.getNavigator().getDefaultParameters().stuckAction(null);
Messaging.sendTr(sender, Messages.WAYPOINT_TELEPORTING_DISABLED, npc.getName());
} else {
npc.getNavigator().getDefaultParameters().stuckAction(TeleportStuckAction.INSTANCE);
Messaging.sendTr(sender, Messages.WAYPOINT_TELEPORTING_ENABLED, npc.getName());
}
}

@Command(
Expand Down
1 change: 1 addition & 0 deletions main/src/main/java/net/citizensnpcs/util/Messages.java
Expand Up @@ -412,6 +412,7 @@ public class Messages {
public static final String WAYPOINT_ADDED = "citizens.commands.waypoints.add.waypoint-added";
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider";
public static final String WAYPOINT_TELEPORTING_DISABLED = "citizens.commands.waypoints.disableteleporting.disabled";
public static final String WAYPOINT_TELEPORTING_ENABLED = "citizens.commands.waypoints.disableteleporting.enabled";
public static final String WAYPOINT_TRIGGER_ADD_PROMPT = "citizens.editors.waypoints.triggers.add.prompt";
public static final String WAYPOINT_TRIGGER_ADDED_SUCCESSFULLY = "citizens.editors.waypoints.triggers.add.added";
public static final String WAYPOINT_TRIGGER_CHAT_INVALID_RADIUS = "citizens.editors.waypoints.triggers.chat.invalid-radius";
Expand Down
1 change: 1 addition & 0 deletions main/src/main/resources/messages_en.properties
Expand Up @@ -295,6 +295,7 @@ citizens.commands.traitc.not-on-npc=The NPC doesn''t have that trait.
citizens.commands.unknown-command=Unknown command. Did you mean:
citizens.commands.waypoints.add.waypoint-added=Added waypoint at [[{0}]] (index [[{1}]]).
citizens.commands.waypoints.disableteleporting.disabled=[[{0}]] will no longer teleport when stuck pathfinding.
citizens.commands.waypoints.disableteleporting.enabled=[[{0}]] will now teleport when stuck pathfinding.
citizens.commands.waypoints.opendoors.enabled=[[{0}]] will now open doors while pathfinding.
citizens.commands.waypoints.opendoors.disabled=[[{0}]] will no longer doors while pathfinding.
citizens.commands.wolf.traits-updated=[[{0}]]''s Traits were updated. Angry:[[{1}]], Sitting:[[{2}]], Tamed:[[{3}]], Collar Color:[[{4}]]
Expand Down

0 comments on commit c880ef8

Please sign in to comment.