diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Infinity.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Infinity.java index a6a7c24e..24d25265 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Infinity.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Infinity.java @@ -29,6 +29,8 @@ public class Infinity extends Modifier implements Listener { private static Infinity instance; + private boolean worksOnCustomArrows; + private Infinity() { super(MineTinker.getPlugin()); customModelData = 10_014; @@ -68,6 +70,7 @@ public void reload() { config.addDefault("SlotCost", 2); config.addDefault("Color", "%WHITE%"); config.addDefault("ModifierItemMaterial", Material.ARROW.name()); + config.addDefault("WorksOnCustomArrows", true); config.addDefault("EnchantCost", 15); config.addDefault("Enchantable", true); @@ -79,6 +82,8 @@ public void reload() { ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName()); init(); + + this.worksOnCustomArrows = config.getBoolean("WorksOnCustomArrows", true); } @Override @@ -100,7 +105,7 @@ else if (ToolType.TRIDENT.contains(tool.getType())) public void onShoot(final MTProjectileLaunchEvent event) { Projectile projectile = event.getEvent().getEntity(); if (!(projectile instanceof Arrow arrow)) return; - if (arrow.hasCustomEffects()) return; + if (arrow.hasCustomEffects() && !this.worksOnCustomArrows) return; if (arrow.getPickupStatus() == AbstractArrow.PickupStatus.CREATIVE_ONLY) return; final Player player = event.getPlayer(); @@ -110,8 +115,8 @@ public void onShoot(final MTProjectileLaunchEvent event) { final ItemStack tool = event.getTool(); if (!modManager.hasMod(tool, this)) return; - if (!player.getInventory().addItem(new ItemStack(Material.ARROW, 1)).isEmpty()) { //adds items to (full) inventory - player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.ARROW, 1)); //drops item when inventory is full + if (!player.getInventory().addItem(arrow.getItem()).isEmpty()) { //adds items to (full) inventory + player.getWorld().dropItem(player.getLocation(), arrow.getItem()); //drops item when inventory is full } // no else as it gets added in if arrow.setPickupStatus(AbstractArrow.PickupStatus.CREATIVE_ONLY);