diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index bece332e5..5aecd63c7 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -21,7 +21,6 @@ import com.gmail.nossr50.util.skills.SkillActivationType; import com.google.common.collect.ImmutableList; import net.kyori.adventure.text.Component; import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index fc6886a27..a86e74e28 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -23,7 +23,6 @@ import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; import net.kyori.adventure.text.TextComponent; -import net.md_5.bungee.api.chat.ComponentBuilder; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.SoundCategory; diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java index 701a528aa..1ca73bbdf 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/interfaces/SubSkill.java @@ -2,7 +2,6 @@ package com.gmail.nossr50.datatypes.skills.subskills.interfaces; import com.gmail.nossr50.datatypes.skills.interfaces.Skill; import net.kyori.adventure.text.TextComponent; -import net.md_5.bungee.api.chat.ComponentBuilder; import org.bukkit.entity.Player; public interface SubSkill extends Skill { diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 89339cc8c..5d58aac17 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -5,6 +5,7 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; @@ -328,12 +329,6 @@ public class EntityListener implements Listener { if (event.getEntity() instanceof ArmorStand) { return; } - - if (event.getDamager().hasMetadata(mcMMO.funfettiMetadataKey)) - { - event.setCancelled(true); - return; - } if (Misc.isNPCEntityExcludingVillagers(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) { return; @@ -420,8 +415,10 @@ public class EntityListener implements Listener { * Surprising this kind of thing * */ - if(event.getDamage() <= 0 && !CombatUtils.isDamageLikelyFromNormalCombat(event.getCause())) { - return; + if(mcMMO.isProjectKorraEnabled()) { + if(event.getFinalDamage() == 0) { + return; + } } CombatUtils.processCombatAttack(event, attacker, target); diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 64c1509ef..345e1fd28 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -102,6 +102,7 @@ public class mcMMO extends JavaPlugin { /* Plugin Checks */ private static boolean healthBarPluginEnabled; + private static boolean projectKorraEnabled; // API checks private static boolean serverAPIOutdated = false; @@ -159,6 +160,7 @@ public class mcMMO extends JavaPlugin { PluginManager pluginManager = getServer().getPluginManager(); healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null; + projectKorraEnabled = pluginManager.getPlugin("ProjectKorra") != null; upgradeManager = new UpgradeManager(); @@ -182,6 +184,10 @@ public class mcMMO extends JavaPlugin { checkModConfigs(); } + if(projectKorraEnabled) { + getLogger().info("ProjectKorra was detected, this can cause some issues with weakness potions and combat skills for mcMMO"); + } + if (healthBarPluginEnabled) { getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled."); } @@ -689,4 +695,8 @@ public class mcMMO extends JavaPlugin { public static BukkitAudiences getAudiences() { return audiences; } + + public static boolean isProjectKorraEnabled() { + return projectKorraEnabled; + } } diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java index ebf7e81c0..ebf50f28a 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -35,7 +35,7 @@ public class UnarmedManager extends SkillManager { return mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && Permissions.berserk(getPlayer()); } - public boolean canUseIronArm() { + public boolean canUseSteelArm() { if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_STEEL_ARM_STYLE)) return false; diff --git a/src/main/java/com/gmail/nossr50/util/EventUtils.java b/src/main/java/com/gmail/nossr50/util/EventUtils.java index b75dcd197..8043e895b 100644 --- a/src/main/java/com/gmail/nossr50/util/EventUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EventUtils.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.util; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainSource; diff --git a/src/main/java/com/gmail/nossr50/util/McMMOMessageType.java b/src/main/java/com/gmail/nossr50/util/McMMOMessageType.java index 741c94767..6619e8f0f 100644 --- a/src/main/java/com/gmail/nossr50/util/McMMOMessageType.java +++ b/src/main/java/com/gmail/nossr50/util/McMMOMessageType.java @@ -1,10 +1,11 @@ package com.gmail.nossr50.util; -import java.util.function.BiConsumer; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.text.Component; +import java.util.function.BiConsumer; + public enum McMMOMessageType { ACTION_BAR(Audience::sendActionBar), SYSTEM((audience, message) -> audience.sendMessage(message, MessageType.SYSTEM)); diff --git a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java index 3a7fbed73..2ec6351bc 100644 --- a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java +++ b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java @@ -11,7 +11,6 @@ import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.skills.RankUtils; -import java.util.concurrent.atomic.AtomicReference; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.text.Component; @@ -22,12 +21,11 @@ import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.text.format.TextDecoration; -import net.md_5.bungee.api.ChatMessageType; import org.bukkit.entity.Player; -import java.util.ArrayList; import java.util.List; import java.util.Locale; +import java.util.concurrent.atomic.AtomicReference; /** * This class handles many of the JSON components that mcMMO makes and uses diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 501d9571c..a6cc6af19 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -32,6 +32,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.MetadataValue; +import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; import java.util.EnumMap; @@ -54,6 +55,11 @@ public final class CombatUtils { } } + public static boolean hasWeakenedDamage(LivingEntity livingEntity) { + return livingEntity.hasPotionEffect(PotionEffectType.WEAKNESS); + } + + private static void processSwordCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) { if (event.getCause() == DamageCause.THORNS) { return; @@ -198,8 +204,7 @@ public final class CombatUtils { mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED); } - //Only execute bonuses if the player is not spamming - if (unarmedManager.canUseIronArm()) { + if (unarmedManager.canUseSteelArm()) { finalDamage+=(unarmedManager.calculateSteelArmStyleDamage() * mcMMOPlayer.getAttackStrength()); }