Merge pull request #111 from mcmonkey4eva/sit-anim-patch

Fix the sit animation, fixes #96
This commit is contained in:
fullwall 2014-11-04 15:45:10 +08:00
commit 9048d0738a
2 changed files with 6 additions and 3 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@
Citizens.jar
*.lnk
*.iml
/.idea
dependency-reduced-pom.xml

View File

@ -52,10 +52,11 @@ public enum PlayerAnimation {
protected void playAnimation(final EntityPlayer player, int radius) {
player.getBukkitEntity().setMetadata("citizens.sitting",
new FixedMetadataValue(CitizensAPI.getPlugin(), true));
Bukkit.getScheduler().runTaskTimer(CitizensAPI.getPlugin(), new BukkitRunnable() {
new BukkitRunnable() {
@Override
public void run() {
if (player.dead || !player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
if (player.dead || !player.valid ||
!player.getBukkitEntity().getMetadata("citizens.sitting").get(0).asBoolean()) {
cancel();
return;
}
@ -67,7 +68,7 @@ public enum PlayerAnimation {
player.mount(player);
}
}
}, 0, 1);
}.runTaskTimer(CitizensAPI.getPlugin(), 0, 1);
}
},
SLEEP {