mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 04:35:50 +01:00
Make /npc pickupitems persistent
This commit is contained in:
parent
35245a580b
commit
ce1f306b08
@ -1768,7 +1768,7 @@ public class NPCCommands {
|
||||
public void pickupitems(CommandContext args, CommandSender sender, NPC npc, @Flag("set") Boolean set)
|
||||
throws CommandException {
|
||||
boolean pickup = set == null ? !npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected()) : set;
|
||||
npc.data().set(NPC.Metadata.PICKUP_ITEMS, pickup);
|
||||
npc.data().setPersistent(NPC.Metadata.PICKUP_ITEMS, pickup);
|
||||
Messaging.sendTr(sender, pickup ? Messages.PICKUP_ITEMS_SET : Messages.PICKUP_ITEMS_UNSET, npc.getName());
|
||||
}
|
||||
|
||||
|
@ -302,9 +302,11 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||
selector.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (npc.getNavigator().isNavigating()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Waypoint current = plan.getCurrentWaypoint();
|
||||
npc.getNavigator().setTarget(current.getLocation());
|
||||
npc.getNavigator().getLocalParameters().addSingleUseCallback(new NavigatorCallback() {
|
||||
@ -322,6 +324,7 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||
if (paused || available.size() == 0 || !npc.isSpawned() || npc.getNavigator().isNavigating()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Waypoint target = available.get(Util.getFastRandom().nextInt(available.size()));
|
||||
plan = ASTAR.runFully(new GuidedGoal(target), new GuidedNode(null, new Waypoint(npc.getStoredLocation())));
|
||||
return plan != null;
|
||||
@ -403,8 +406,8 @@ public class GuidedWaypointProvider implements EnumerableWaypointProvider {
|
||||
List<AStarNode> resList = Lists.newArrayList();
|
||||
res.forEachRemaining(new Consumer<Waypoint>() {
|
||||
@Override
|
||||
public void accept(Waypoint t) {
|
||||
resList.add(new GuidedNode(null, t));
|
||||
public void accept(Waypoint n) {
|
||||
resList.add(new GuidedNode(null, n));
|
||||
}
|
||||
});
|
||||
return resList;
|
||||
|
Loading…
Reference in New Issue
Block a user