Avoid errors with missing metadata

This commit is contained in:
fullwall 2021-01-20 17:55:34 +08:00
parent 8c0fa7cd17
commit 688ba3af8e
8 changed files with 9 additions and 9 deletions

View File

@ -62,7 +62,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;

View File

@ -62,7 +62,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;

View File

@ -61,7 +61,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;

View File

@ -61,7 +61,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;

View File

@ -61,7 +61,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;
@ -137,9 +137,9 @@ public class PlayerAnimationImpl {
NMSImpl.sendPacketNearby(player.getBukkitEntity(), player.getBukkitEntity().getLocation(), packet, radius); NMSImpl.sendPacketNearby(player.getBukkitEntity(), player.getBukkitEntity().getLocation(), packet, radius);
} }
private static EnumMap<PlayerAnimation, Integer> DEFAULTS = Maps.newEnumMap(PlayerAnimation.class);
private static final MethodHandle ENTITY_SETPOSE_METHOD = NMS.getMethodHandle(Entity.class, "setPose", true, private static final MethodHandle ENTITY_SETPOSE_METHOD = NMS.getMethodHandle(Entity.class, "setPose", true,
EntityPose.class); EntityPose.class);
private static EnumMap<PlayerAnimation, Integer> DEFAULTS = Maps.newEnumMap(PlayerAnimation.class);
static { static {
DEFAULTS.put(PlayerAnimation.ARM_SWING, 0); DEFAULTS.put(PlayerAnimation.ARM_SWING, 0);
DEFAULTS.put(PlayerAnimation.HURT, 1); DEFAULTS.put(PlayerAnimation.HURT, 1);

View File

@ -61,7 +61,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;

View File

@ -61,7 +61,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;

View File

@ -60,7 +60,7 @@ public class PlayerAnimationImpl {
@Override @Override
public void run() { public void run() {
if (player.dead || !player.valid if (player.dead || !player.valid || !player.getBukkitEntity().hasMetadata("citizens.sitting")
|| !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) { || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel(); cancel();
return; return;