diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/AllureBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/AllureBook.java index f004d75..ac0b218 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/AllureBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/AllureBook.java @@ -5,6 +5,7 @@ import net.minecraft.server.v1_8_R2.EntityExperienceOrb; import net.minecraft.server.v1_8_R2.EntityHuman; import net.minecraft.server.v1_8_R2.EntityItem; +import net.minecraft.server.v1_8_R2.EnumParticle; import net.minecraft.server.v1_8_R2.World; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -23,6 +24,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import us.corenetwork.mantle.MantlePlugin; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.spellbooks.EntityIterator; import us.corenetwork.mantle.spellbooks.Spellbook; @@ -76,6 +78,8 @@ else if (entity instanceof Item) Bukkit.getScheduler().runTask(MantlePlugin.instance, new PlayerShower(showerContents)); + ParticleLibrary.broadcastParticleRing(EnumParticle.CRIT, player.getEyeLocation(), 2); + return BookFinishAction.BROADCAST_AND_CONSUME; } diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/DecayBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/DecayBook.java index e845528..7a9b36d 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/DecayBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/DecayBook.java @@ -2,6 +2,7 @@ import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.ClaimsMode; +import net.minecraft.server.v1_8_R2.EnumParticle; import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.DyeColor; @@ -22,6 +23,7 @@ import us.corenetwork.core.claims.BlockWorker; import us.corenetwork.core.claims.ClaimsModule; import us.corenetwork.mantle.GriefPreventionHandler; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.spellbooks.Spellbook; import us.corenetwork.mantle.spellbooks.SpellbookItem; @@ -88,11 +90,9 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event player.updateInventory(); } - FireworkEffect effect = FireworkEffect.builder().withColor(Color.OLIVE).withFade(Color.OLIVE).build(); - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2); - Util.showFirework(effectLoc, effect); - effectLoc.getWorld().playSound(effectLoc, Sound.SKELETON_DEATH, 1f, 1f); - + Location effectLoc = player.getEyeLocation(); + ParticleLibrary.broadcastParticleRing(EnumParticle.SPELL_WITCH, effectLoc, 2); + effectLoc.getWorld().playSound(effectLoc, Sound.SKELETON_DEATH, 1f, 1f); return BookFinishAction.BROADCAST_AND_CONSUME; } diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/ForgingBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/ForgingBook.java index fcc14c5..c449a91 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/ForgingBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/ForgingBook.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map.Entry; import me.ryanhamshire.GriefPrevention.Claim; +import net.minecraft.server.v1_8_R2.EnumParticle; import net.minecraft.server.v1_8_R2.RecipesFurnace; import org.bukkit.CoalType; import org.bukkit.Color; @@ -24,6 +25,7 @@ import org.bukkit.inventory.ItemStack; import us.corenetwork.mantle.GriefPreventionHandler; import us.corenetwork.mantle.MLog; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.spellbooks.Spellbook; import us.corenetwork.mantle.spellbooks.SpellbookItem; @@ -87,7 +89,9 @@ protected boolean usesContainers() { @Override public BookFinishAction onActivate(SpellbookItem spellbookItem, PlayerInteractEvent event) { Player player = event.getPlayer(); - + + Location effectLoc; + Inventory inventory; if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && Util.isInventoryContainer(event.getClickedBlock().getTypeId())) { @@ -101,10 +105,12 @@ public BookFinishAction onActivate(SpellbookItem spellbookItem, PlayerInteractEv InventoryHolder container = (InventoryHolder) event.getClickedBlock().getState(); inventory = container.getInventory(); + effectLoc = Util.getLocationInBlockCenter(event.getClickedBlock()); } else { inventory = player.getInventory(); + effectLoc = player.getEyeLocation(); } int freeInventorySlots = InventoryUtil.getFreeInventorySlots(inventory); @@ -259,10 +265,8 @@ public int compare(ItemStack arg0, ItemStack arg1) { } player.updateInventory(); - - FireworkEffect effect = FireworkEffect.builder().withColor(Color.ORANGE).withFade(Color.ORANGE).build(); - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2); - Util.showFirework(effectLoc, effect); + + ParticleLibrary.broadcastParticleRing(EnumParticle.FLAME, effectLoc, 2); effectLoc.getWorld().playSound(effectLoc, Sound.FIRE, 1f, 1f); if (anythingSmelted) diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/FusingBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/FusingBook.java index 019c932..9029ba2 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/FusingBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/FusingBook.java @@ -4,6 +4,7 @@ import java.util.LinkedHashMap; import java.util.Map.Entry; import me.ryanhamshire.GriefPrevention.Claim; +import net.minecraft.server.v1_8_R2.EnumParticle; import org.bukkit.Color; import org.bukkit.DyeColor; import org.bukkit.FireworkEffect; @@ -20,6 +21,7 @@ import org.bukkit.inventory.ItemStack; import us.corenetwork.mantle.GriefPreventionHandler; import us.corenetwork.mantle.MLog; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.spellbooks.Spellbook; import us.corenetwork.mantle.spellbooks.SpellbookItem; @@ -64,6 +66,7 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event Player player = event.getPlayer(); Inventory inventory; + Location effectLoc; if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && Util.isInventoryContainer(event.getClickedBlock().getTypeId())) { //Check for claim if clicking on chest @@ -77,10 +80,12 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event InventoryHolder container = (InventoryHolder) event.getClickedBlock().getState(); inventory = container.getInventory(); + effectLoc = Util.getLocationInBlockCenter(event.getClickedBlock()); } else { inventory = player.getInventory(); + effectLoc = player.getEyeLocation(); } int freeInventorySlots = InventoryUtil.getFreeInventorySlots(inventory); @@ -142,10 +147,8 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event if (inventory.getType() == InventoryType.PLAYER) player.updateInventory(); - - FireworkEffect effect = FireworkEffect.builder().withColor(Color.SILVER).withFade(Color.SILVER).build(); - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2); - Util.showFirework(effectLoc, effect); + + ParticleLibrary.broadcastParticleRing(EnumParticle.CRIT, effectLoc, 2); effectLoc.getWorld().playSound(effectLoc, Sound.ANVIL_USE, 1f, 2f); if (fusedSomething) diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/GrowthBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/GrowthBook.java index a4c7138..5c6f492 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/GrowthBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/GrowthBook.java @@ -42,13 +42,7 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event Player player = event.getPlayer(); Location effectLoc = player.getEyeLocation(); - // effectLoc.setY(effectLoc.getY() + 1); - //;SpellbookUtil.getPointInFrontOfPlayer(event.getPlayer().getEyeLocation(), 2); - // - // Vector direction = event.getPlayer().getLocation().getDirection(); - ParticleLibrary.broadcastParticleRing(EnumParticle.VILLAGER_HAPPY, effectLoc, 2); - //ParticleLibrary.broadcastParticle(EnumParticle.VILLAGER_HAPPY, effectLoc, (float) (1.0 - direction.getX()), 0.5f, (float) (1.0 - direction.getZ()), 0, 10, null); event.getPlayer().playSound(effectLoc, Sound.LEVEL_UP, 1.0f, 1.0f); Block baseBlock = event.getPlayer().getLocation().getBlock(); diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/PeddlingBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/PeddlingBook.java index d41dcbe..2690dc0 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/PeddlingBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/PeddlingBook.java @@ -5,6 +5,7 @@ import java.util.List; import me.ryanhamshire.GriefPrevention.Claim; import net.minecraft.server.v1_8_R2.EntityVillager; +import net.minecraft.server.v1_8_R2.EnumParticle; import net.minecraft.server.v1_8_R2.Items; import net.minecraft.server.v1_8_R2.MerchantRecipe; import net.minecraft.server.v1_8_R2.MerchantRecipeList; @@ -22,6 +23,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import us.corenetwork.mantle.GriefPreventionHandler; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.nanobot.NanobotUtil; import us.corenetwork.mantle.spellbooks.Spellbook; @@ -149,11 +151,10 @@ protected BookFinishAction onActivateEntity(SpellbookItem spellbookItem, PlayerI targetAmount -= stackAmount; } - Color effectColor = Color.fromRGB(0xcd5cab); - FireworkEffect effect = FireworkEffect.builder().withColor(effectColor).withFade(effectColor).build(); - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2); - Util.showFirework(effectLoc, effect); - event.getPlayer().playSound(effectLoc, Sound.VILLAGER_YES, 1.0f, 1.0f); + Location effectLoc = entity.getLocation(); + effectLoc.setY(effectLoc.getY() + 1); + ParticleLibrary.broadcastParticleRing(EnumParticle.CRIT_MAGIC, effectLoc, 2); + event.getPlayer().playSound(effectLoc, Sound.VILLAGER_YES, 1.0f, 1.0f); return BookFinishAction.BROADCAST_AND_CONSUME; diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/SmithingBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/SmithingBook.java index d5305f4..3c365b7 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/SmithingBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/SmithingBook.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map.Entry; import me.ryanhamshire.GriefPrevention.Claim; +import net.minecraft.server.v1_8_R2.EnumParticle; import org.bukkit.CoalType; import org.bukkit.Color; import org.bukkit.DyeColor; @@ -26,6 +27,7 @@ import org.bukkit.inventory.PlayerInventory; import us.corenetwork.mantle.GriefPreventionHandler; import us.corenetwork.mantle.MLog; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.spellbooks.Spellbook; import us.corenetwork.mantle.spellbooks.SpellbookItem; @@ -81,6 +83,7 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event Inventory inventory; Inventory fuelInventory = player.getInventory(); + Location effectLoc; if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && Util.isInventoryContainer(event.getClickedBlock().getTypeId())) { //Check for claim if clicking on chest @@ -94,13 +97,15 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event InventoryHolder container = (InventoryHolder) event.getClickedBlock().getState(); inventory = container.getInventory(); + effectLoc = Util.getLocationInBlockCenter(event.getClickedBlock()); } else { inventory = player.getInventory(); + effectLoc = player.getEyeLocation(); } - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2); + ParticleLibrary.broadcastParticleRing(EnumParticle.FLAME, effectLoc, 2); effectLoc.getWorld().playSound(effectLoc, Sound.BLAZE_HIT, 0.5f, 0.3f); boolean anythingSmelted = smith(inventory, fuelInventory); diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/TimeBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/TimeBook.java index e73b5e8..4e0116a 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/TimeBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/TimeBook.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import net.minecraft.server.v1_8_R2.EnumParticle; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Location; @@ -13,6 +14,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.nanobot.NanobotUtil; import us.corenetwork.mantle.spellbooks.Spellbook; @@ -35,10 +37,7 @@ public TimeBook() { public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event) { curPlayer = event.getPlayer(); - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(curPlayer.getEyeLocation(), 2); - - FireworkEffect effect = FireworkEffect.builder().withColor(Color.BLUE).withFade(Color.BLUE).build(); - Util.showFirework(effectLoc, effect); + ParticleLibrary.broadcastParticleRing(EnumParticle.ENCHANTMENT_TABLE, curPlayer.getEyeLocation(), 2); for (int i = 0; i < curPlayer.getInventory().getSize() + 4; i++) { diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/UnslimingBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/UnslimingBook.java index af1debc..1946eff 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/UnslimingBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/UnslimingBook.java @@ -1,6 +1,7 @@ package us.corenetwork.mantle.spellbooks.books; import me.ryanhamshire.GriefPrevention.Claim; +import net.minecraft.server.v1_8_R2.EnumParticle; import org.bukkit.Chunk; import org.bukkit.Color; import org.bukkit.FireworkEffect; @@ -12,6 +13,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import us.corenetwork.mantle.GriefPreventionHandler; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.netherspawning.NetherSpawner; import us.corenetwork.mantle.slimespawning.IgnoredSlimeChunks; @@ -70,11 +72,10 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event { Util.Message(settings.getString(SETTING_MESSAGE_NOT_SLIME_CHUNK), player); } - - Color slimeColor = Color.fromRGB(0x8bbb79); - FireworkEffect effect = FireworkEffect.builder().withColor(slimeColor).withFade(slimeColor).build(); - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2); - Util.showFirework(effectLoc, effect); + + + Location effectLoc = player.getEyeLocation(); + ParticleLibrary.broadcastParticleRing(EnumParticle.SLIME, effectLoc, 2); effectLoc.getWorld().playSound(effectLoc, Sound.SLIME_WALK2, 2f, 1f); if (slimeChunk) diff --git a/src/main/java/us/corenetwork/mantle/spellbooks/books/WindBook.java b/src/main/java/us/corenetwork/mantle/spellbooks/books/WindBook.java index 7e1fb51..a5b9951 100644 --- a/src/main/java/us/corenetwork/mantle/spellbooks/books/WindBook.java +++ b/src/main/java/us/corenetwork/mantle/spellbooks/books/WindBook.java @@ -2,6 +2,7 @@ import java.util.HashSet; import java.util.UUID; +import net.minecraft.server.v1_8_R2.EnumParticle; import net.minecraft.server.v1_8_R2.GenericAttributes; import net.minecraft.server.v1_8_R2.MinecraftServer; import org.bukkit.Bukkit; @@ -27,6 +28,7 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import us.corenetwork.mantle.MantlePlugin; +import us.corenetwork.mantle.ParticleLibrary; import us.corenetwork.mantle.Util; import us.corenetwork.mantle.spellbooks.Spellbook; import us.corenetwork.mantle.spellbooks.SpellbookItem; @@ -56,8 +58,6 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, EFFECT_DURATION, 49)); - - LivingEntity mount = (LivingEntity) player.getVehicle(); if (mount != null && mount instanceof Horse) { @@ -71,10 +71,8 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event } Bukkit.getScheduler().runTaskLater(MantlePlugin.instance, new SprintingTimer(uuid), EFFECT_DURATION); - - FireworkEffect effect = FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.WHITE).build(); - Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2); - Util.showFirework(effectLoc, effect); + + ParticleLibrary.broadcastParticleRing(EnumParticle.EXPLOSION_NORMAL, player.getEyeLocation(), 2); return BookFinishAction.BROADCAST_AND_CONSUME; }