mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-31 11:35:28 +02:00
if( -> if (
This commit is contained in:
@@ -61,7 +61,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,12 +72,12 @@ public final class CombatUtils {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.SWORDS);
|
||||
}
|
||||
|
||||
if(target.getHealth() - event.getFinalDamage() > 0) {
|
||||
if (target.getHealth() - event.getFinalDamage() > 0) {
|
||||
swordsManager.processRupture(target);
|
||||
}
|
||||
|
||||
//Add Stab Damage
|
||||
if(swordsManager.canUseStab())
|
||||
if (swordsManager.canUseStab())
|
||||
{
|
||||
boostedDamage += (swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public final class CombatUtils {
|
||||
swordsManager.serratedStrikes(target, event.getDamage());
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))
|
||||
if (canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))
|
||||
{
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
@@ -98,11 +98,11 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
private static void printFinalDamageDebug(@NotNull Player player, @NotNull EntityDamageByEntityEvent event, @NotNull McMMOPlayer mcMMOPlayer, @Nullable String @Nullable ... extraInfoLines) {
|
||||
if(mcMMOPlayer.isDebugMode()) {
|
||||
if (mcMMOPlayer.isDebugMode()) {
|
||||
player.sendMessage("Final Damage value after mcMMO modifiers: "+ event.getFinalDamage());
|
||||
if(extraInfoLines != null) {
|
||||
if (extraInfoLines != null) {
|
||||
for(String str : extraInfoLines) {
|
||||
if(str != null)
|
||||
if (str != null)
|
||||
player.sendMessage(str);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public final class CombatUtils {
|
||||
boostedDamage += (tridentsManager.impaleDamageBonus() * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public final class CombatUtils {
|
||||
boostedDamage += (tridentsManager.impaleDamageBonus() * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
delayArrowMetaCleanup(arrow);
|
||||
return;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public final class CombatUtils {
|
||||
boostedDamage = mcMMOPlayer.getCrossbowsManager().poweredShot(initialDamage);
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
||||
boostedDamage+=getLimitBreakDamage(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK);
|
||||
}
|
||||
|
||||
@@ -222,13 +222,13 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// MacesManager macesManager = mcMMOPlayer.getMacesManager();
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.MACES_MACES_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.MACES_MACES_LIMIT_BREAK)) {
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.MACES_MACES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public final class CombatUtils {
|
||||
boostedDamage+=(axesManager.criticalHit(target, boostedDamage) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK))
|
||||
if (canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK))
|
||||
{
|
||||
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
@@ -298,7 +298,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ public final class CombatUtils {
|
||||
unarmedManager.disarmCheck((Player) target);
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
||||
if (canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
||||
{
|
||||
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
@@ -335,11 +335,11 @@ public final class CombatUtils {
|
||||
double initialDamage = event.getDamage();
|
||||
double boostedDamage = initialDamage;
|
||||
|
||||
if(master != null && master.isOnline() && master.isValid()) {
|
||||
if (master != null && master.isOnline() && master.isValid()) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
delayArrowMetaCleanup(arrow);
|
||||
return;
|
||||
}
|
||||
@@ -394,7 +394,7 @@ public final class CombatUtils {
|
||||
archeryManager.retrieveArrows(target, arrow);
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))
|
||||
if (canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))
|
||||
{
|
||||
boostedDamage+=getLimitBreakDamage(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK);
|
||||
}
|
||||
@@ -402,7 +402,7 @@ public final class CombatUtils {
|
||||
double distanceMultiplier = ArcheryManager.distanceXpBonusMultiplier(target, arrow);
|
||||
double forceMultiplier = 1.0; //Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
||||
forceMultiplier = arrow.getMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE).get(0).asDouble();
|
||||
|
||||
event.setDamage(boostedDamage);
|
||||
@@ -431,7 +431,7 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
if (target instanceof Player player) {
|
||||
if(ExperienceConfig.getInstance().isNPCInteractionPrevented()) {
|
||||
if (ExperienceConfig.getInstance().isNPCInteractionPrevented()) {
|
||||
if (Misc.isNPCEntityExcludingVillagers(target)) {
|
||||
return;
|
||||
}
|
||||
@@ -549,7 +549,7 @@ public final class CombatUtils {
|
||||
|
||||
if (projectileSource instanceof Player player) {
|
||||
if (!Misc.isNPCEntityExcludingVillagers(player)) {
|
||||
if(mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
|
||||
if (mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
|
||||
processTridentCombatRanged(trident, target, player, event);
|
||||
}
|
||||
}
|
||||
@@ -561,9 +561,9 @@ public final class CombatUtils {
|
||||
if (projectileSource instanceof Player player) {
|
||||
|
||||
if (!Misc.isNPCEntityExcludingVillagers(player)) {
|
||||
if(!isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.ARCHERY, target)) {
|
||||
if (!isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.ARCHERY, target)) {
|
||||
processArcheryCombat(target, player, event, arrow);
|
||||
} else if(isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.CROSSBOWS, target)) {
|
||||
} else if (isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.CROSSBOWS, target)) {
|
||||
processCrossbowsCombat(target, player, event, arrow);
|
||||
}
|
||||
} else {
|
||||
@@ -576,7 +576,7 @@ public final class CombatUtils {
|
||||
&& mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TAMING)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||
@@ -594,7 +594,7 @@ public final class CombatUtils {
|
||||
{
|
||||
List<MetadataValue> metadataValue = entity.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY);
|
||||
|
||||
if(metadataValue.size() <= 0)
|
||||
if (metadataValue.size() <= 0)
|
||||
return;
|
||||
|
||||
OldName oldName = (OldName) metadataValue.get(0);
|
||||
@@ -612,7 +612,7 @@ public final class CombatUtils {
|
||||
* @return the RAW damage bonus from Limit Break which is applied before reductions
|
||||
*/
|
||||
public static int getLimitBreakDamage(@NotNull Player attacker, @NotNull LivingEntity defender, @NotNull SubSkillType subSkillType) {
|
||||
if(defender instanceof Player playerDefender) {
|
||||
if (defender instanceof Player playerDefender) {
|
||||
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, getArmorQualityLevel(playerDefender));
|
||||
} else {
|
||||
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, 1000);
|
||||
@@ -630,11 +630,11 @@ public final class CombatUtils {
|
||||
public static int getLimitBreakDamageAgainstQuality(@NotNull Player attacker, @NotNull SubSkillType subSkillType, int armorQualityLevel) {
|
||||
int rawDamageBoost = RankUtils.getRank(attacker, subSkillType);
|
||||
|
||||
if(armorQualityLevel <= 4) {
|
||||
if (armorQualityLevel <= 4) {
|
||||
rawDamageBoost *= .25; //75% Nerf
|
||||
} else if(armorQualityLevel <= 8) {
|
||||
} else if (armorQualityLevel <= 8) {
|
||||
rawDamageBoost *= .50; //50% Nerf
|
||||
} else if(armorQualityLevel <= 12) {
|
||||
} else if (armorQualityLevel <= 12) {
|
||||
rawDamageBoost *= .75; //25% Nerf
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ public final class CombatUtils {
|
||||
int armorQualityLevel = 0;
|
||||
|
||||
for(ItemStack itemStack : defender.getInventory().getArmorContents()) {
|
||||
if(itemStack != null) {
|
||||
if (itemStack != null) {
|
||||
armorQualityLevel += getArmorQuality(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -673,7 +673,7 @@ public final class CombatUtils {
|
||||
* @return true if the player has access to the limit break
|
||||
*/
|
||||
public static boolean canUseLimitBreak(@NotNull Player player, LivingEntity target, @NotNull SubSkillType subSkillType) {
|
||||
if(target instanceof Player || mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
||||
if (target instanceof Player || mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
||||
return RankUtils.hasUnlockedSubskill(player, subSkillType)
|
||||
&& Permissions.isSubSkillEnabled(player, subSkillType);
|
||||
} else {
|
||||
@@ -826,7 +826,7 @@ public final class CombatUtils {
|
||||
|
||||
McMMOPlayer mmoAttacker = UserManager.getPlayer(attacker);
|
||||
|
||||
if(mmoAttacker != null) {
|
||||
if (mmoAttacker != null) {
|
||||
mmoAttacker.getSwordsManager().processRupture(livingEntity);
|
||||
}
|
||||
|
||||
@@ -923,17 +923,17 @@ public final class CombatUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if(hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, target)) {
|
||||
if (hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, target)) {
|
||||
baseXP = 0;
|
||||
} else if(hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, target) || target.hasMetadata("ES")) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, target) || target.hasMetadata("ES")) {
|
||||
baseXP *= ExperienceConfig.getInstance().getSpawnedMobXpMultiplier();
|
||||
} else if(hasMobFlag(MobMetaFlagType.NETHER_PORTAL_MOB, target)) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.NETHER_PORTAL_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getNetherPortalXpMultiplier();
|
||||
} else if(hasMobFlag(MobMetaFlagType.EGG_MOB, target)) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.EGG_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getEggXpMultiplier();
|
||||
} else if (hasMobFlag(MobMetaFlagType.PLAYER_BRED_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getBredMobXpMultiplier();
|
||||
} else if(hasMobFlag(MobMetaFlagType.PLAYER_TAMED_MOB, target)) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.PLAYER_TAMED_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getTamedMobXpMultiplier();
|
||||
}
|
||||
|
||||
@@ -958,14 +958,14 @@ public final class CombatUtils {
|
||||
private static boolean shouldBeAffected(@NotNull Player player, @NotNull Entity entity) {
|
||||
if (entity instanceof Player defender) {
|
||||
//TODO: NPC Interaction?
|
||||
if(UserManager.getPlayer(defender) == null)
|
||||
if (UserManager.getPlayer(defender) == null)
|
||||
return true;
|
||||
|
||||
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getGodMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||
if (mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||
if ((mcMMO.p.getPartyManager().inSameParty(player, defender) || mcMMO.p.getPartyManager().areAllies(player, defender)) && !(Permissions.friendlyFire(player) && Permissions.friendlyFire(defender))) {
|
||||
return false;
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ public final class CombatUtils {
|
||||
public static void modifyMoveSpeed(@NotNull LivingEntity livingEntity, double multiplier) {
|
||||
AttributeInstance attributeInstance = livingEntity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
|
||||
|
||||
if(attributeInstance != null) {
|
||||
if (attributeInstance != null) {
|
||||
double normalSpeed = attributeInstance.getBaseValue();
|
||||
attributeInstance.setBaseValue(normalSpeed * multiplier);
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ public final class ParticleEffectUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if(location.getWorld() == null)
|
||||
if (location.getWorld() == null)
|
||||
return;
|
||||
|
||||
location.getWorld().playEffect(location, Effect.MOBSPAWNER_FLAMES, 1);
|
||||
@@ -91,7 +91,7 @@ public final class ParticleEffectUtils {
|
||||
public static void playSmokeEffect(Location location) {
|
||||
World world = location.getWorld();
|
||||
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
// Have to do it this way, because not all block directions are valid for smoke
|
||||
|
@@ -54,7 +54,7 @@ public final class PerksUtils {
|
||||
double modifier = 1.0F;
|
||||
|
||||
if (Permissions.customXpBoost(player, skill)) {
|
||||
if(UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
if (UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.DARK_GRAY + "XP Perk Multiplier IS CUSTOM! ");
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class PerksUtils {
|
||||
|
||||
float modifiedXP = (float) (xp * modifier);
|
||||
|
||||
if(UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
if (UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP Perk Multiplier - " + ChatColor.GOLD + modifier);
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "Original XP before perk boosts " + ChatColor.RED + (double) xp);
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.DARK_RED + modifiedXP);
|
||||
|
@@ -29,54 +29,54 @@ public class ProjectileUtils {
|
||||
*/
|
||||
// TODO: Add test
|
||||
public static void cleanupProjectileMetadata(@NotNull Arrow arrow) {
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_INF_ARROW, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOUNCE_COUNT)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOUNCE_COUNT)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_BOUNCE_COUNT, mcMMO.p);
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyArrowMetadata(@NotNull Plugin pluginRef, @NotNull Arrow arrowToCopy, @NotNull Arrow newArrow) {
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_INF_ARROW,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_INF_ARROW).get(0));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE,
|
||||
new FixedMetadataValue(pluginRef,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE).get(0).asDouble()));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE).get(0));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW).get(0));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW).get(0));
|
||||
}
|
||||
|
@@ -36,15 +36,15 @@ public class RankUtils {
|
||||
HashMap<Integer, Integer> innerMap = subSkillRanks.get(subSkillType.toString());
|
||||
|
||||
//If the skill doesn't have registered ranks gtfo
|
||||
if(innerMap == null || innerMap.get(playerRankInSkill) == null)
|
||||
if (innerMap == null || innerMap.get(playerRankInSkill) == null)
|
||||
continue;
|
||||
|
||||
//Don't send notifications if the player lacks the permission node
|
||||
if(!Permissions.isSubSkillEnabled(mcMMOPlayer.getPlayer(), subSkillType))
|
||||
if (!Permissions.isSubSkillEnabled(mcMMOPlayer.getPlayer(), subSkillType))
|
||||
continue;
|
||||
|
||||
//The players level is the exact level requirement for this skill
|
||||
if(newLevel == innerMap.get(playerRankInSkill))
|
||||
if (newLevel == innerMap.get(playerRankInSkill))
|
||||
{
|
||||
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
|
||||
|
||||
@@ -180,19 +180,19 @@ public class RankUtils {
|
||||
String skillName = subSkillType.toString();
|
||||
int numRanks = subSkillType.getNumRanks();
|
||||
|
||||
if(subSkillRanks == null)
|
||||
if (subSkillRanks == null)
|
||||
subSkillRanks = new HashMap<>();
|
||||
|
||||
if(numRanks == 0)
|
||||
if (numRanks == 0)
|
||||
return -1; //-1 Means the skill doesn't have ranks
|
||||
|
||||
if(subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
if (subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
addRanks(subSkillType);
|
||||
|
||||
//Get our rank map
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return 0;
|
||||
|
||||
//Skill level of parent skill
|
||||
@@ -205,11 +205,11 @@ public class RankUtils {
|
||||
int unlockLevel = getRankUnlockLevel(subSkillType, rank);
|
||||
|
||||
//If we check all ranks and still cannot unlock the skill, we return rank 0
|
||||
if(rank == 0)
|
||||
if (rank == 0)
|
||||
return 0;
|
||||
|
||||
//True if our skill level can unlock the current rank
|
||||
if(currentSkillLevel >= unlockLevel)
|
||||
if (currentSkillLevel >= unlockLevel)
|
||||
return rank;
|
||||
}
|
||||
|
||||
@@ -227,19 +227,19 @@ public class RankUtils {
|
||||
String skillName = abstractSubSkill.getConfigKeyName();
|
||||
int numRanks = abstractSubSkill.getNumRanks();
|
||||
|
||||
if(subSkillRanks == null)
|
||||
if (subSkillRanks == null)
|
||||
subSkillRanks = new HashMap<>();
|
||||
|
||||
if(numRanks == 0)
|
||||
if (numRanks == 0)
|
||||
return -1; //-1 Means the skill doesn't have ranks
|
||||
|
||||
if(subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
if (subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
addRanks(abstractSubSkill);
|
||||
|
||||
//Get our rank map
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return 0;
|
||||
|
||||
//Skill level of parent skill
|
||||
@@ -252,11 +252,11 @@ public class RankUtils {
|
||||
int unlockLevel = getRankUnlockLevel(abstractSubSkill, rank);
|
||||
|
||||
//If we check all ranks and still cannot unlock the skill, we return rank 0
|
||||
if(rank == 0)
|
||||
if (rank == 0)
|
||||
return 0;
|
||||
|
||||
//True if our skill level can unlock the current rank
|
||||
if(currentSkillLevel >= unlockLevel)
|
||||
if (currentSkillLevel >= unlockLevel)
|
||||
return rank;
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,7 @@ public class SkillTools {
|
||||
for(SubSkillType subSkillType : SubSkillType.values()) {
|
||||
String[] splitSubSkillName = subSkillType.toString().split("_");
|
||||
|
||||
if(primarySkillType1.toString().equalsIgnoreCase(splitSubSkillName[0])) {
|
||||
if (primarySkillType1.toString().equalsIgnoreCase(splitSubSkillName[0])) {
|
||||
//Parent Skill Found
|
||||
tempSubParentMap.put(subSkillType, primarySkillType1);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class SkillTools {
|
||||
PrimarySkillType parent = getSuperAbilityParent(superAbilityType);
|
||||
tempAbilityParentRelationshipMap.put(superAbilityType, parent);
|
||||
|
||||
if(superAbilityType != SuperAbilityType.BLAST_MINING) {
|
||||
if (superAbilityType != SuperAbilityType.BLAST_MINING) {
|
||||
//This map is used only for abilities that have a tool readying phase, so blast mining is ignored
|
||||
tempMainActivatedAbilityChildMap.put(parent, superAbilityType);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class SkillTools {
|
||||
}
|
||||
|
||||
public SuperAbilityType getSuperAbility(PrimarySkillType primarySkillType) {
|
||||
if(mainActivatedAbilityChildMap.get(primarySkillType) == null)
|
||||
if (mainActivatedAbilityChildMap.get(primarySkillType) == null)
|
||||
return null;
|
||||
|
||||
return mainActivatedAbilityChildMap.get(primarySkillType);
|
||||
|
@@ -61,7 +61,7 @@ public final class SkillUtils {
|
||||
|
||||
int length;
|
||||
|
||||
if(abilityLengthCap > 0)
|
||||
if (abilityLengthCap > 0)
|
||||
{
|
||||
length = (int) Math.min(abilityLengthCap, 2 + (skillValue / abilityLengthVar));
|
||||
} else {
|
||||
@@ -142,7 +142,7 @@ public final class SkillUtils {
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if(heldItem == null)
|
||||
if (heldItem == null)
|
||||
return;
|
||||
|
||||
if (!ItemUtils.canBeSuperAbilityDigBoosted(heldItem)) {
|
||||
@@ -171,7 +171,7 @@ public final class SkillUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Not Loaded
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
PrimarySkillType skill = mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) ? PrimarySkillType.MINING : PrimarySkillType.EXCAVATION;
|
||||
@@ -181,7 +181,7 @@ public final class SkillUtils {
|
||||
|
||||
int ticks;
|
||||
|
||||
if(abilityLengthCap > 0)
|
||||
if (abilityLengthCap > 0)
|
||||
{
|
||||
ticks = PerksUtils.handleActivationPerks(player, Math.min(abilityLengthCap, 2 + (mcMMOPlayer.getSkillLevel(skill) / abilityLengthVar)),
|
||||
mcMMO.p.getSkillTools().getSuperAbilityMaxLength(mcMMO.p.getSkillTools().getSuperAbility(skill))) * Misc.TICK_CONVERSION_FACTOR;
|
||||
@@ -202,18 +202,18 @@ public final class SkillUtils {
|
||||
}
|
||||
|
||||
public static void removeAbilityBuff(@Nullable ItemStack itemStack) {
|
||||
if(itemStack == null)
|
||||
if (itemStack == null)
|
||||
return;
|
||||
|
||||
if(!ItemUtils.canBeSuperAbilityDigBoosted(itemStack))
|
||||
if (!ItemUtils.canBeSuperAbilityDigBoosted(itemStack))
|
||||
return;
|
||||
|
||||
|
||||
//1.13.2+ will have persistent metadata for this itemStack
|
||||
if(isLegacyAbilityTool(itemStack)) {
|
||||
if (isLegacyAbilityTool(itemStack)) {
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta != null) {
|
||||
if (itemMeta != null) {
|
||||
// This is safe to call without prior checks.
|
||||
itemMeta.removeEnchant(mcMMO.p.getEnchantmentMapper().getEfficiency());
|
||||
|
||||
@@ -222,7 +222,7 @@ public final class SkillUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if(isSuperAbilityBoosted(itemStack)) {
|
||||
if (isSuperAbilityBoosted(itemStack)) {
|
||||
removeBonusDigSpeedOnSuperAbilityTool(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public final class SkillUtils {
|
||||
* @param maxDamageModifier the amount to adjust the max damage by
|
||||
*/
|
||||
public static void handleDurabilityChange(ItemStack itemStack, double durabilityModifier, double maxDamageModifier) {
|
||||
if(itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
if (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public final class SkillUtils {
|
||||
* @param maxDamageModifier the amount to adjust the max damage by
|
||||
*/
|
||||
public static void handleArmorDurabilityChange(ItemStack itemStack, double durabilityModifier, double maxDamageModifier) {
|
||||
if(itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
if (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public final class SkillUtils {
|
||||
public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) {
|
||||
int quantity = 0;
|
||||
|
||||
if(mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
|
||||
if (mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
|
||||
//One netherite bar requires 4 netherite scraps
|
||||
return 4;
|
||||
}
|
||||
@@ -323,10 +323,10 @@ public final class SkillUtils {
|
||||
for(Iterator<? extends Recipe> recipeIterator = Bukkit.getServer().recipeIterator(); recipeIterator.hasNext();) {
|
||||
Recipe bukkitRecipe = recipeIterator.next();
|
||||
|
||||
if(bukkitRecipe.getResult().getType() != itemMaterial)
|
||||
if (bukkitRecipe.getResult().getType() != itemMaterial)
|
||||
continue;
|
||||
|
||||
if(bukkitRecipe instanceof ShapelessRecipe) {
|
||||
if (bukkitRecipe instanceof ShapelessRecipe) {
|
||||
for (ItemStack ingredient : ((ShapelessRecipe) bukkitRecipe).getIngredientList()) {
|
||||
if (ingredient != null
|
||||
&& (recipeMaterial == null || ingredient.getType() == recipeMaterial)
|
||||
@@ -334,7 +334,7 @@ public final class SkillUtils {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
} else if(bukkitRecipe instanceof ShapedRecipe) {
|
||||
} else if (bukkitRecipe instanceof ShapedRecipe) {
|
||||
for (ItemStack ingredient : ((ShapedRecipe) bukkitRecipe).getIngredientMap().values()) {
|
||||
if (ingredient != null
|
||||
&& (recipeMaterial == null || ingredient.getType() == recipeMaterial)
|
||||
|
Reference in New Issue
Block a user