Skip to content

Commit

Permalink
for back-compat for #288
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 30, 2019
1 parent 8da06e2 commit 74213fa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 14 additions & 8 deletions src/main/java/org/mcmonkey/sentinel/SentinelWeaponHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,22 @@ public void fireArrow(ItemStack type, Location target, Vector lead) {
sentinel.stats_arrowsFired++;
Entity arrow;
if (SentinelTarget.v1_9) {
Class<? extends Arrow> toShoot;
toShoot = type.getType() == Material.SPECTRAL_ARROW ? SpectralArrow.class :
(type.getType() == Material.TIPPED_ARROW ? TippedArrow.class : Arrow.class);
Vector dir = sentinel.fixForAcc(start.getValue());
double length = Math.max(1.0, dir.length());
arrow = start.getKey().getWorld().spawnArrow(start.getKey(), dir.multiply(1.0 / length), (float) length, 0f, toShoot);
((Projectile) arrow).setShooter(getLivingEntity());
if (SentinelTarget.v1_11) {
if (SentinelTarget.v1_14) {
Class toShoot;
toShoot = type.getType() == Material.SPECTRAL_ARROW ? SpectralArrow.class :
(type.getType() == Material.TIPPED_ARROW ? TippedArrow.class : Arrow.class);
Vector dir = sentinel.fixForAcc(start.getValue());
double length = Math.max(1.0, dir.length());
arrow = start.getKey().getWorld().spawnArrow(start.getKey(), dir.multiply(1.0 / length), (float) length, 0f, toShoot);
((Arrow) arrow).setPickupStatus(Arrow.PickupStatus.DISALLOWED);
}
else {
arrow = start.getKey().getWorld().spawnEntity(start.getKey(),
type.getType() == Material.SPECTRAL_ARROW ? EntityType.SPECTRAL_ARROW :
(type.getType() == Material.TIPPED_ARROW ? TIPPED_ARROW : EntityType.ARROW));
arrow.setVelocity(sentinel.fixForAcc(start.getValue()));
}
((Projectile) arrow).setShooter(getLivingEntity());
if (arrow instanceof TippedArrow && type instanceof PotionMeta) {
PotionData data = ((PotionMeta) type.getItemMeta()).getBasePotionData();
if (data.getType() == null || data.getType() == PotionType.UNCRAFTABLE) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ main: org.mcmonkey.sentinel.SentinelPlugin
depend: [Citizens]
softdepend: [Vault, Sentry, CrackShot, Factions, Towny, SimpleClans, War]

api-version: 1.14
api-version: 1.13

commands:
sentinel:
Expand Down

0 comments on commit 74213fa

Please sign in to comment.