mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 04:35:50 +01:00
Minor change
This commit is contained in:
parent
333c4e35b4
commit
59dee87f38
@ -102,13 +102,11 @@ public class EquipmentEditor extends Editor {
|
||||
// Now edit the equipment based on the slot
|
||||
if (trait.getEquipment(slot) != null && trait.getEquipment(slot).getType() != Material.AIR)
|
||||
player.getWorld().dropItemNaturally(npc.getBukkitEntity().getLocation(), trait.getEquipment(slot));
|
||||
ItemStack set = hand;
|
||||
trait.setEquipment(slot, hand);
|
||||
if (hand.getAmount() > 1)
|
||||
hand.setAmount(hand.getAmount() - 1);
|
||||
else
|
||||
hand = null;
|
||||
player.setItemInHand(hand);
|
||||
set.setAmount(1);
|
||||
trait.setEquipment(slot, set);
|
||||
}
|
||||
}
|
@ -47,6 +47,10 @@ public class LinearWaypointProvider implements WaypointProvider {
|
||||
Messaging.send(player,
|
||||
String.format("<e>Removed<a> a waypoint (<e>%d<a> remaining)", waypoints.size()));
|
||||
}
|
||||
if (waypoints.size() == 0)
|
||||
callback.currentIndex = -1;
|
||||
else if (callback.currentIndex == -1)
|
||||
callback.currentIndex = 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -71,10 +75,11 @@ public class LinearWaypointProvider implements WaypointProvider {
|
||||
return callback;
|
||||
}
|
||||
|
||||
private final NavigationCallback callback = new NavigationCallback() {
|
||||
private final LinearNavigationCallback callback = new LinearNavigationCallback();
|
||||
|
||||
private class LinearNavigationCallback extends NavigationCallback {
|
||||
private boolean executing;
|
||||
private int currentIndex;
|
||||
private AI attached;
|
||||
|
||||
@Override
|
||||
public boolean onCancel(AI ai, PathCancelReason reason) {
|
||||
@ -93,13 +98,11 @@ public class LinearWaypointProvider implements WaypointProvider {
|
||||
|
||||
@Override
|
||||
public void onAttach(AI ai) {
|
||||
if (attached == null || attached != ai) {
|
||||
executing = false;
|
||||
currentIndex = -1;
|
||||
cycle();
|
||||
if (currentIndex != -1) {
|
||||
ai.setDestination(waypoints.get(currentIndex).getLocation());
|
||||
}
|
||||
executing = false;
|
||||
currentIndex = -1;
|
||||
cycle();
|
||||
if (currentIndex != -1) {
|
||||
ai.setDestination(waypoints.get(currentIndex).getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user