Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SKELETON_START_SWING_ARM and SKELETON_STOP_SWING_ARM animations
Requires at least 1.9.2
- Loading branch information
Showing
12 changed files
with
160 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
nmshandler/src/main/java/net/aufdemrand/denizen/nms/abstracts/AnimationHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net.aufdemrand.denizen.nms.abstracts; | ||
|
||
import net.aufdemrand.denizen.nms.interfaces.EntityAnimation; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public abstract class AnimationHelper { | ||
|
||
private final Map<String, EntityAnimation> entityAnimations = new HashMap<String, EntityAnimation>(); | ||
|
||
protected void register(String name, EntityAnimation animation) { | ||
entityAnimations.put(name.toUpperCase(), animation); | ||
} | ||
|
||
public boolean hasEntityAnimation(String name) { | ||
return entityAnimations.containsKey(name.toUpperCase()); | ||
} | ||
|
||
public EntityAnimation getEntityAnimation(String name) { | ||
return entityAnimations.get(name.toUpperCase()); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
nmshandler/src/main/java/net/aufdemrand/denizen/nms/interfaces/EntityAnimation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package net.aufdemrand.denizen.nms.interfaces; | ||
|
||
import org.bukkit.entity.Entity; | ||
|
||
public interface EntityAnimation { | ||
|
||
void play(Entity entity); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
v1_10_R1/src/main/java/net/aufdemrand/denizen/nms/helpers/AnimationHelper_v1_10_R1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.aufdemrand.denizen.nms.helpers; | ||
|
||
import net.aufdemrand.denizen.nms.abstracts.AnimationHelper; | ||
import net.aufdemrand.denizen.nms.interfaces.EntityAnimation; | ||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftSkeleton; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.EntityType; | ||
|
||
public class AnimationHelper_v1_10_R1 extends AnimationHelper { | ||
|
||
public AnimationHelper_v1_10_R1() { | ||
register("SKELETON_START_SWING_ARM", new EntityAnimation() { | ||
@Override | ||
public void play(Entity entity) { | ||
if (entity.getType() == EntityType.SKELETON) { | ||
((CraftSkeleton) entity).getHandle().a(true); | ||
} | ||
} | ||
}); | ||
register("SKELETON_STOP_SWING_ARM", new EntityAnimation() { | ||
@Override | ||
public void play(Entity entity) { | ||
if (entity.getType() == EntityType.SKELETON) { | ||
((CraftSkeleton) entity).getHandle().a(false); | ||
} | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
v1_8_R3/src/main/java/net/aufdemrand/denizen/nms/helpers/AnimationHelper_v1_8_R3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net.aufdemrand.denizen.nms.helpers; | ||
|
||
import net.aufdemrand.denizen.nms.abstracts.AnimationHelper; | ||
import net.aufdemrand.denizen.nms.interfaces.EntityAnimation; | ||
import org.bukkit.entity.Entity; | ||
|
||
public class AnimationHelper_v1_8_R3 extends AnimationHelper { | ||
|
||
public AnimationHelper_v1_8_R3() { | ||
register("SKELETON_START_SWING_ARM", new EntityAnimation() { | ||
@Override | ||
public void play(Entity entity) { | ||
// Not available in 1.8 | ||
} | ||
}); | ||
register("SKELETON_STOP_SWING_ARM", new EntityAnimation() { | ||
@Override | ||
public void play(Entity entity) { | ||
// Not available in 1.8 | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
v1_9_R2/src/main/java/net/aufdemrand/denizen/nms/helpers/AnimationHelper_v1_9_R2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.aufdemrand.denizen.nms.helpers; | ||
|
||
import net.aufdemrand.denizen.nms.abstracts.AnimationHelper; | ||
import net.aufdemrand.denizen.nms.interfaces.EntityAnimation; | ||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftSkeleton; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.EntityType; | ||
|
||
public class AnimationHelper_v1_9_R2 extends AnimationHelper { | ||
|
||
public AnimationHelper_v1_9_R2() { | ||
register("SKELETON_START_SWING_ARM", new EntityAnimation() { | ||
@Override | ||
public void play(Entity entity) { | ||
if (entity.getType() == EntityType.SKELETON) { | ||
((CraftSkeleton) entity).getHandle().a(true); | ||
} | ||
} | ||
}); | ||
register("SKELETON_STOP_SWING_ARM", new EntityAnimation() { | ||
@Override | ||
public void play(Entity entity) { | ||
if (entity.getType() == EntityType.SKELETON) { | ||
((CraftSkeleton) entity).getHandle().a(false); | ||
} | ||
} | ||
}); | ||
} | ||
} |