mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-10-06 11:27:31 +02:00
Fix /npc gravity for players
This commit is contained in:
parent
11df61f74d
commit
5e5b2dc8c8
@ -236,7 +236,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
navigation = new PlayerNavigation(this, world);
|
||||
NMS.setStepHeight(this, 1); // the default (0) breaks step climbing
|
||||
|
||||
setSkinFlags((byte)0xFF);
|
||||
setSkinFlags((byte) 0xFF);
|
||||
}
|
||||
|
||||
public boolean isNavigating() {
|
||||
|
@ -67,7 +67,7 @@ public class HumanController extends AbstractEntityController {
|
||||
}
|
||||
}
|
||||
}
|
||||
final String prefixCapture = prefix, suffixCapture = suffix, coloredNameCapture = coloredName;
|
||||
final String prefixCapture = prefix, suffixCapture = suffix;
|
||||
|
||||
UUID uuid = npc.getUniqueId();
|
||||
if (uuid.version() == 4) { // clear version
|
||||
|
@ -1,9 +1,11 @@
|
||||
package net.citizensnpcs.trait;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
import net.citizensnpcs.npc.entity.EntityHumanNPC.PlayerNPC;
|
||||
|
||||
public class Gravity extends Trait implements Toggleable {
|
||||
@Persist
|
||||
@ -19,7 +21,13 @@ public class Gravity extends Trait implements Toggleable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!npc.isSpawned() || !enabled)
|
||||
if (!npc.isSpawned())
|
||||
return;
|
||||
if (npc.getEntity() instanceof Player) {
|
||||
((PlayerNPC) npc.getEntity()).setGravityEnabled(!enabled);
|
||||
return;
|
||||
}
|
||||
if (!enabled)
|
||||
return;
|
||||
Vector vector = npc.getEntity().getVelocity();
|
||||
vector.setY(Math.max(0, vector.getY()));
|
||||
|
Loading…
Reference in New Issue
Block a user