From 7f8944c154496e978764524d187e9c42101c1e4e Mon Sep 17 00:00:00 2001 From: FN-FAL113 Date: Thu, 15 Feb 2024 09:55:21 +0800 Subject: [PATCH] fixed mystery sticks unchecked cast - resolves #120 --- pom.xml | 2 +- .../mysteriousitems/MysteryStick.java | 18 +++++++++++------ .../mysteriousitems/MysteryStick10.java | 19 ++++++++++++------ .../mysteriousitems/MysteryStick11.java | 20 +++++++++++++------ .../mysteriousitems/MysteryStick2.java | 18 +++++++++++------ .../mysteriousitems/MysteryStick3.java | 19 ++++++++++++------ .../mysteriousitems/MysteryStick4.java | 16 ++++++++++----- .../mysteriousitems/MysteryStick5.java | 18 +++++++++++------ .../mysteriousitems/MysteryStick6.java | 19 ++++++++++++------ .../mysteriousitems/MysteryStick7.java | 16 ++++++++------- .../mysteriousitems/MysteryStick8.java | 18 +++++++++++------ .../mysteriousitems/MysteryStick9.java | 17 +++++++++++----- 12 files changed, 134 insertions(+), 66 deletions(-) diff --git a/pom.xml b/pom.xml index 802829c6..e19cbc08 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ne.fnfal113 FNAmplifications - Unoffical-4.1.8 + Unoffical-4.1.9 jar FNAmplifications diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick.java index 0ed7b4c0..f871f827 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick.java @@ -34,7 +34,7 @@ public MysteryStick(ItemGroup itemGroup, SlimefunItemStack item, RecipeType reci } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.SWEEPING_EDGE, 2); enchantments.put(Enchantment.DAMAGE_ALL, 3); @@ -44,12 +44,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "What is this sorcery?"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "I wonder what this stick does"; } @@ -59,17 +59,23 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { + return; + } + Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); - if(item.getType() != getMaterial()){ + if(item.getType() != getMaterial()) { return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 27, 1)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 20, 1)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 80, 0, false, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick10.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick10.java index 7b86ffb0..e23337e3 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick10.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick10.java @@ -48,12 +48,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "Why is this stick too good"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "Deadly or creepy stick"; } @@ -63,27 +63,34 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { + return; + } + Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); - if(item.getType() != getMaterial()){ + if(item.getType() != getMaterial()) { return; } // if item material is not a weapon, don't continue further - if(getStickTask().onSwing(item, player, event.getDamage(), 13, 4)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 28, 4)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 80, 2, false, true, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 80, 2, false, true, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 80, 2, false, true, false)); int playerDefaultHealth = (int) Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue(); - if(player.getHealth() < playerDefaultHealth - 2) { + + if(player.getHealth() < playerDefaultHealth - 2) { player.setHealth(player.getHealth() + 2); victim.setHealth(victim.getHealth() < 2 ? victim.getHealth() + (victim.getHealth() * (-1)) : victim.getHealth() - 2); } else { player.sendMessage(ChatColor.RED + "Make sure your hearts are not full for Lifesteal to proc!"); } + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick11.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick11.java index fb391340..984e4832 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick11.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick11.java @@ -35,7 +35,7 @@ public MysteryStick11(ItemGroup itemGroup, SlimefunItemStack item, RecipeType re } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.DAMAGE_ARTHROPODS, 10); enchantments.put(Enchantment.DAMAGE_ALL, 7); @@ -46,12 +46,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "Behind your enemies awaits danger"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "The stick of the nords"; } @@ -61,24 +61,32 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { + return; + } + Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); - if(item.getType() != getMaterial()){ + if(item.getType() != getMaterial()) { return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 13, 4)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 28, 4)) { LivingEntity victim = (LivingEntity) event.getEntity(); victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 80, 2, false, true, false)); + victim.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 80, 2, false, true, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 100, 2, false, true, false)); Location loc = victim.getLocation(); + loc.setYaw(loc.getYaw() + 180); + victim.teleport(loc); victim.sendMessage(ChatColor.DARK_RED + "You have been disoriented! your opponent's mysterious stick is deadly"); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick2.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick2.java index bd36647f..2b817cac 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick2.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick2.java @@ -34,7 +34,7 @@ public MysteryStick2(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.DAMAGE_ARTHROPODS, 3); enchantments.put(Enchantment.DAMAGE_ALL, 2); @@ -44,22 +44,26 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "Another stick of wrecking"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "Another stick of no matter what is it"; } @Override - public Material getStickMaterial(){ + public Material getStickMaterial() { return getMaterial(); } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { + return; + } + Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); @@ -67,9 +71,11 @@ public void onSwing(EntityDamageByEntityEvent event){ return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 27, 1)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 20, 1)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 80, 0, false, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick3.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick3.java index 25781d77..4d7b4b92 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick3.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick3.java @@ -35,7 +35,7 @@ public MysteryStick3(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.ARROW_DAMAGE, 2); enchantments.put(Enchantment.ARROW_INFINITE, 1); @@ -44,12 +44,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "I knew it was something about shooting arrows"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "I feel coordinated when holding this stick"; } @@ -59,10 +59,15 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Arrow)) { + return; + } + Arrow arrow = (Arrow) event.getDamager(); Player player = ((Player) arrow.getShooter()); - if(player == null){ + + if(player == null) { return; } @@ -72,9 +77,11 @@ public void onSwing(EntityDamageByEntityEvent event){ return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 27, 1)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 20, 1)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, 0, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick4.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick4.java index f8a3842d..66a10c75 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick4.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick4.java @@ -34,7 +34,7 @@ public MysteryStick4(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.SWEEPING_EDGE, 3); enchantments.put(Enchantment.DAMAGE_ALL, 3); @@ -44,12 +44,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "It was indeed a magical improvement"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "Did I use this before or maybe not"; } @@ -59,7 +59,11 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { + return; + } + Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); @@ -67,10 +71,12 @@ public void onSwing(EntityDamageByEntityEvent event){ return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 20, 2)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 24, 2)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 1, false, false, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 0, false, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick5.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick5.java index 0a8ab003..307f5794 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick5.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick5.java @@ -34,7 +34,7 @@ public MysteryStick5(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.DAMAGE_ARTHROPODS, 4); enchantments.put(Enchantment.DAMAGE_ALL, 3); @@ -44,12 +44,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "Another stick of somewhat reckoning"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "I know you are tired of this stick thing"; } @@ -59,18 +59,24 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { + return; + } + Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); - if(item.getType() != getMaterial()){ + if(item.getType() != getMaterial()) { return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 20, 2)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 24, 2)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 100, 1, false, false, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 40, 0, false, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick6.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick6.java index 892ab5fa..527de5a8 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick6.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick6.java @@ -35,7 +35,7 @@ public MysteryStick6(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.ARROW_DAMAGE, 4); enchantments.put(Enchantment.ARROW_INFINITE, 1); @@ -45,12 +45,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "Make them take an arrow to the knee"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "May the force and accuracy be with you"; } @@ -60,10 +60,15 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Arrow)) { + return; + } + Arrow arrow = (Arrow) event.getDamager(); Player player = ((Player) arrow.getShooter()); - if(player == null){ + + if(player == null) { return; } @@ -73,10 +78,12 @@ public void onSwing(EntityDamageByEntityEvent event){ return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 20, 2)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 24, 2)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100, 1, false, false, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 40, 0, false, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick7.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick7.java index 549de0b9..c4183f4f 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick7.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick7.java @@ -34,7 +34,7 @@ public MysteryStick7(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.SWEEPING_EDGE, 7); enchantments.put(Enchantment.DAMAGE_ALL, 6); @@ -46,12 +46,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "Blood will spit across the land"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "The aura on this stick is mesmerizing"; } @@ -61,23 +61,25 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ - if(!(event.getDamager() instanceof Player)){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { return; } Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); - if(item.getType() != getMaterial()){ + if(item.getType() != getMaterial()) { return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 17, 3)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 26, 3)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 1, false, false, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 80, 1, false, false, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 0, false, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick8.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick8.java index 2445d001..646c66da 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick8.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick8.java @@ -34,7 +34,7 @@ public MysteryStick8(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.DAMAGE_ARTHROPODS, 7); enchantments.put(Enchantment.DAMAGE_ALL, 5); @@ -45,12 +45,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "I'm out of words using this"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "This stick is kinda heavy"; } @@ -60,19 +60,25 @@ public Material getStickMaterial() { } @Override - public void onSwing(EntityDamageByEntityEvent event){ + public void onSwing(EntityDamageByEntityEvent event) { + if(!(event.getDamager() instanceof Player)) { + return; + } + Player player = (Player) event.getDamager(); ItemStack item = player.getInventory().getItemInMainHand(); - if(item.getType() != getMaterial()){ + if(item.getType() != getMaterial()) { return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 18, 3)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 26, 3)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 100, 1, false, false, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 1, false, false, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 40, 0, false, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); } diff --git a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick9.java b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick9.java index 881ae019..efd8e689 100644 --- a/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick9.java +++ b/src/main/java/ne/fnfal113/fnamplifications/mysteriousitems/MysteryStick9.java @@ -35,7 +35,7 @@ public MysteryStick9(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec } @Override - public Map enchantments(){ + public Map enchantments() { Map enchantments = new HashMap<>(); enchantments.put(Enchantment.ARROW_DAMAGE, 5); enchantments.put(Enchantment.ARROW_INFINITE, 1); @@ -46,12 +46,12 @@ public Map enchantments(){ } @Override - public String weaponLore(){ + public String weaponLore() { return ChatColor.GOLD + "I wonder if Elves possess this relic"; } @Override - public String stickLore(){ + public String stickLore() { return ChatColor.WHITE + "You need more mana when using this"; } @@ -62,9 +62,14 @@ public Material getStickMaterial() { @Override public void onSwing(EntityDamageByEntityEvent event){ + if(!(event.getDamager() instanceof Arrow)) { + return; + } + Arrow arrow = (Arrow) event.getDamager(); Player player = ((Player) arrow.getShooter()); - if(player == null){ + + if(player == null) { return; } @@ -73,11 +78,13 @@ public void onSwing(EntityDamageByEntityEvent event){ return; } - if(getStickTask().onSwing(item, player, event.getDamage(), 17, 3)) { + if(getStickTask().onSwing(item, player, event.getDamage(), 26, 3)) { LivingEntity victim = (LivingEntity) event.getEntity(); + victim.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 60, 1, false, true, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 60, 0, false, true, false)); victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, 2, false, false)); + player.sendMessage(Utils.colorTranslator("&cMystery effects was applied to your enemy")); }