mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixed bug where spawned arrows could throw
ArrayIndexOutOfBoundsException. Fixes #1171
This commit is contained in:
parent
190b7ee1f5
commit
0ea07d4bc7
@ -29,6 +29,7 @@ Version 1.4.06-dev
|
|||||||
+ Added information about /party itemshare and /party expshare to the party help page
|
+ Added information about /party itemshare and /party expshare to the party help page
|
||||||
+ Added option to use scoreboards for power level display instead of Spout.
|
+ Added option to use scoreboards for power level display instead of Spout.
|
||||||
+ Added permission node to prevent inspecting hidden players
|
+ Added permission node to prevent inspecting hidden players
|
||||||
|
= Fixed bug where spawned arrows could throw ArrayIndexOutOfBoundsException
|
||||||
= Fixed bug where custom Spout titles were overwritten by mcMMO.
|
= Fixed bug where custom Spout titles were overwritten by mcMMO.
|
||||||
= Fixed bug where Nether Quartz wasn't included in Smelting or item sharing
|
= Fixed bug where Nether Quartz wasn't included in Smelting or item sharing
|
||||||
= Fixed bug where players were able to join the same party multiple times
|
= Fixed bug where players were able to join the same party multiple times
|
||||||
|
@ -28,6 +28,7 @@ import org.bukkit.event.entity.EntityTameEvent;
|
|||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
@ -59,19 +60,15 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityShootBow(EntityShootBowEvent event) {
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||||
ItemStack bow = event.getBow();
|
|
||||||
|
|
||||||
if (bow == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity projectile = event.getProjectile();
|
Entity projectile = event.getProjectile();
|
||||||
|
|
||||||
if (!(projectile instanceof Arrow)) {
|
if (!(projectile instanceof Arrow)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
|
ItemStack bow = event.getBow();
|
||||||
|
|
||||||
|
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
|
||||||
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
|
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +76,18 @@ public class EntityListener implements Listener {
|
|||||||
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, Archery.locationToString(projectile.getLocation())));
|
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, Archery.locationToString(projectile.getLocation())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||||
|
Projectile projectile = event.getEntity();
|
||||||
|
|
||||||
|
if (!(projectile instanceof Arrow) || projectile.hasMetadata(mcMMO.bowForceKey)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, 1.0));
|
||||||
|
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, Archery.locationToString(projectile.getLocation())));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor EntityChangeBlock events.
|
* Monitor EntityChangeBlock events.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user