Fix compilation errors

This commit is contained in:
nossr50 2022-12-04 17:50:43 -08:00
parent bb44e56bdb
commit b077d9e0fb
11 changed files with 50 additions and 55 deletions

View File

@ -35,7 +35,7 @@ public class PowerLevelCommand extends BaseCommand {
mmoPlayer.getPlayer().sendMessage("Your power level is: "+powerLevel); //This is not gonna stay, just to show that the command executes in debug
//Send the players a few blank lines to make finding the top of the skill command easier
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines()) {
if (mcMMO.p.getAdvancedConfig().doesSkillCommandSendBlankLines()) {
for (int i = 0; i < 2; i++) {
player.sendMessage("");
}

View File

@ -232,9 +232,9 @@ public abstract class SkillCommand implements TabExecutor {
return Math.min((int) skillValue, maxLevel) / rankChangeLevel;
}
protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) {
return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill);
}
// protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) {
// return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill);
// }
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
int maxLength = mcMMO.p.getSkillTools().getSuperAbilityMaxLength(mcMMO.p.getSkillTools().getSuperAbility(skill));

View File

@ -422,16 +422,10 @@ public class Roll extends AcrobaticsSubSkill {
@Override
public Double[] getStats(Player player)
{
double playerChanceRoll, playerChanceGrace;
double playerChanceRoll = SkillUtils.getSubSkillProbability(subSkillType, player).getValue();
double playerChanceGrace = playerChanceRoll * 2;
RandomChanceSkill roll = new RandomChanceSkill(player, getSubSkillType());
RandomChanceSkill graceful = new RandomChanceSkill(player, getSubSkillType());
graceful.setSkillLevel(graceful.getSkillLevel() * 2); //Double odds
//Calculate
playerChanceRoll = RandomChanceUtil.getRandomChanceExecutionChance(roll);
playerChanceGrace = RandomChanceUtil.getRandomChanceExecutionChance(graceful);
double gracefulOdds = SkillUtils.getSubSkillProbability(subSkillType, player).getValue() * 2;
return new Double[]{ playerChanceRoll, playerChanceGrace };
}

View File

@ -125,7 +125,7 @@ public class MiningManager extends SkillManager {
private void processDoubleDrops(@NotNull BlockState blockState) {
//TODO: Make this readable
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.MINING_DOUBLE_DROPS, getPlayer())) {
boolean useTriple = mmoPlayer.getAbilityMode(skill.getAbility()) && AdvancedConfig.getInstance().getAllowMiningTripleDrops();
boolean useTriple = mmoPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) && mcMMO.p.getAdvancedConfig().getAllowMiningTripleDrops();
BlockUtils.markDropsAsBonus(blockState, useTriple);
}
}

View File

@ -18,6 +18,7 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -76,7 +77,8 @@ public class SwordsManager extends SkillManager {
return; //Don't apply bleed
}
if (RandomChanceUtil.rollDice(mcMMO.p.getAdvancedConfig().getRuptureChanceToApplyOnHit(getRuptureRank()), 100)) {
double ruptureOdds = mcMMO.p.getAdvancedConfig().getRuptureChanceToApplyOnHit(getRuptureRank());
if (SkillUtils.isStaticSkillRNGSuccessful(PrimarySkillType.SWORDS, this.getPlayer(), ruptureOdds)) {
if (target instanceof Player defender) {
@ -141,7 +143,8 @@ public class SwordsManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event
*/
public void counterAttackChecks(@NotNull LivingEntity attacker, double damage) {
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SWORDS_COUNTER_ATTACK, getPlayer())) {
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.SWORDS_COUNTER_ATTACK, getPlayer())) {
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier, getPlayer());
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Countered");

View File

@ -262,7 +262,7 @@ public class TamingManager extends SkillManager {
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL))
return;
if(!SkillUtils.isStaticSkillRNGSuccessful(PrimarySkillType.TAMING, getPlayer(), AdvancedConfig.getInstance().getPummelChance()))
if(!SkillUtils.isStaticSkillRNGSuccessful(PrimarySkillType.TAMING, getPlayer(), mcMMO.p.getAdvancedConfig().getPummelChance()))
return;
ParticleEffectUtils.playGreaterImpactEffect(target);
@ -372,17 +372,12 @@ public class TamingManager extends SkillManager {
}
private void spawnCOTWEntity(CallOfTheWildType callOfTheWildType, Location spawnLocation, EntityType entityType) {
switch(callOfTheWildType) {
case CAT:
switch (callOfTheWildType) {
case CAT ->
//Entity type is needed for cats because in 1.13 and below we spawn ocelots, in 1.14 and above we spawn cats
spawnCat(spawnLocation, entityType);
break;
case HORSE:
spawnHorse(spawnLocation);
break;
case WOLF:
spawnWolf(spawnLocation);
break;
case HORSE -> spawnHorse(spawnLocation);
case WOLF -> spawnWolf(spawnLocation);
}
}

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.skills.woodcutting;
import com.gmail.nossr50.api.ItemSpawnReason;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
@ -91,19 +92,19 @@ public class WoodcuttingManager extends SkillManager {
if(Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, blockState.getType())) {
//Mastery enabled for player
if(Permissions.canUseSubSkill(getPlayer(), SubSkillType.WOODCUTTING_CLEAN_CUTS)) {
if(checkCleanCutsActivation()) {
if(checkCleanCutsActivation(blockState.getType())) {
//Triple drops
spawnHarvestLumberBonusDrops(blockState);
spawnHarvestLumberBonusDrops(blockState);
} else {
//Harvest Lumber Check
if(checkHarvestLumberActivation()) {
if(checkHarvestLumberActivation(blockState.getType())) {
spawnHarvestLumberBonusDrops(blockState);
}
}
//No Mastery (no Clean Cuts)
} else if (Permissions.canUseSubSkill(getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)) {
if(checkHarvestLumberActivation()) {
if(checkHarvestLumberActivation(blockState.getType())) {
spawnHarvestLumberBonusDrops(blockState);
}
}

View File

@ -7,8 +7,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.util.random.RandomChanceSkill;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -68,7 +67,7 @@ public final class BlockUtils {
*/
public static boolean checkDoubleDrops(Player player, BlockState blockState, PrimarySkillType skillType, SubSkillType subSkillType) {
if (mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(skillType, blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
return SkillUtils.isSkillRNGSuccessful(subSkillType, player);
}
return false;
@ -201,22 +200,22 @@ public final class BlockUtils {
return mcMMO.getMaterialMapStore().isTreeFellerDestructible(material);
}
/**
* Determine if a given block should be affected by Flux Mining
*
* @param blockState The {@link BlockState} of the block to check
* @return true if the block should affected by Flux Mining, false otherwise
*/
public static boolean affectedByFluxMining(BlockState blockState) {
switch (blockState.getType()) {
case IRON_ORE:
case GOLD_ORE:
return true;
default:
return false;
}
}
// /**
// * Determine if a given block should be affected by Flux Mining
// *
// * @param blockState The {@link BlockState} of the block to check
// * @return true if the block should affected by Flux Mining, false otherwise
// */
// public static boolean affectedByFluxMining(BlockState blockState) {
// switch (blockState.getType()) {
// case IRON_ORE:
// case GOLD_ORE:
// return true;
//
// default:
// return false;
// }
// }
/**
* Determine if a given block can activate Herbalism abilities

View File

@ -26,7 +26,7 @@ public final class MobHealthbarUtils {
EntityDamageEvent lastDamageCause = player.getLastDamageCause();
String replaceString = lastDamageCause instanceof EntityDamageByEntityEvent ? StringUtils.getPrettyEntityTypeString(((EntityDamageByEntityEvent) lastDamageCause).getDamager().getType()) : "a mob";
return deathMessage.replaceAll("(?:(\u00A7(?:[0-9A-FK-ORa-fk-or]))*(?:[\u2764\u25A0]{1,10})){1,2}", replaceString);
return deathMessage.replaceAll("(?:(§(?:[0-9A-FK-ORa-fk-or]))*(?:[❤■]{1,10})){1,2}", replaceString);
}
/**

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.util.random;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -35,9 +36,9 @@ public class ProbabilityFactory {
}
//Probability ceiling is configurable in this type
probabilityCeiling = AdvancedConfig.getInstance().getMaximumProbability(subSkillType);
probabilityCeiling = mcMMO.p.getAdvancedConfig().getMaximumProbability(subSkillType);
//The xCeiling is configurable in this type
xCeiling = AdvancedConfig.getInstance().getMaxBonusLevel(subSkillType);
xCeiling = mcMMO.p.getAdvancedConfig().getMaxBonusLevel(subSkillType);
return new ProbabilityImpl(xPos, xCeiling, probabilityCeiling);
case STATIC_CONFIGURABLE:
try {
@ -69,11 +70,11 @@ public class ProbabilityFactory {
private static double getStaticRandomChance(@NotNull SubSkillType subSkillType) throws InvalidStaticChance {
switch (subSkillType) {
case AXES_ARMOR_IMPACT:
return AdvancedConfig.getInstance().getImpactChance();
return mcMMO.p.getAdvancedConfig().getImpactChance();
case AXES_GREATER_IMPACT:
return AdvancedConfig.getInstance().getGreaterImpactChance();
return mcMMO.p.getAdvancedConfig().getGreaterImpactChance();
case TAMING_FAST_FOOD_SERVICE:
return AdvancedConfig.getInstance().getFastFoodChance();
return mcMMO.p.getAdvancedConfig().getFastFoodChance();
default:
throw new InvalidStaticChance();
}

View File

@ -12,8 +12,10 @@ import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.metadata.ItemMetadataService;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.random.*;