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