Skip to content

Commit

Permalink
stronger arrow cleanup enforcement to be safe
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 16, 2020
1 parent c0848ee commit 9901e7b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/mcmonkey/sentinel/SentinelWeaponHelper.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.mcmonkey.sentinel;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
Expand Down Expand Up @@ -137,6 +138,17 @@ public void fireArrow(ItemStack type, Location target, Vector lead) {
if (sentinel.itemHelper.getHeldItem().containsEnchantment(Enchantment.ARROW_FIRE)) {
arrow.setFireTicks(10000);
}
if (SentinelPlugin.instance.arrowCleanupTime > 0) {
final Entity projectile = arrow;
Bukkit.getScheduler().scheduleSyncDelayedTask(SentinelPlugin.instance, new Runnable() {
@Override
public void run() {
if (projectile.isValid()) {
projectile.remove();
}
}
}, SentinelPlugin.instance.arrowCleanupTime + 10 * 20);
}
sentinel.useItem();
}

Expand Down

0 comments on commit 9901e7b

Please sign in to comment.