mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 10:33:43 +01:00 
			
		
		
		
	Taming Cleanup + Compiler Error fix
This commit is contained in:
		@@ -30,7 +30,7 @@ public class McmmoCommand implements CommandExecutor {
 | 
			
		||||
 | 
			
		||||
                sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
 | 
			
		||||
 | 
			
		||||
                mcMMO.getHolidayManager().anniversaryCheck(sender);
 | 
			
		||||
//                mcMMO.getHolidayManager().anniversaryCheck(sender);
 | 
			
		||||
                return true;
 | 
			
		||||
 | 
			
		||||
            case 1:
 | 
			
		||||
 
 | 
			
		||||
@@ -60,31 +60,45 @@ public class TamingCommand extends SkillCommand {
 | 
			
		||||
        if (canEnvironmentallyAware) {
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1")));
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (canFastFood) {
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9", percent.format(Taming.fastFoodServiceActivationChance / 100D))));
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template",
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.8"),
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.9",
 | 
			
		||||
                            percent.format(Taming.getInstance().getFastFoodServiceActivationChance() / 100D))));
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (canGore) {
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template",
 | 
			
		||||
                    LocaleLoader.getString("Taming.Combat.Chance.Gore"),
 | 
			
		||||
                    goreChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", goreChanceLucky) : ""));
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (canHolyHound) {
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.10"), LocaleLoader.getString("Taming.Ability.Bonus.11")));
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template",
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.10"),
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.11")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (canSharpenedClaws) {
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7", Taming.sharpenedClawsBonusDamage)));
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template",
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.6"),
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.7",
 | 
			
		||||
                            Taming.getInstance().getSharpenedClawsBonusDamage())));
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (canShockProof) {
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5", Taming.shockProofModifier)));
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template",
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.4"),
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.5",
 | 
			
		||||
                            Taming.getInstance().getShockProofModifier())));
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (canThickFur) {
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3", Taming.thickFurModifier)));
 | 
			
		||||
            messages.add(LocaleLoader.getString("Ability.Generic.Template",
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.2"),
 | 
			
		||||
                    LocaleLoader.getString("Taming.Ability.Bonus.3",
 | 
			
		||||
                            Taming.getInstance().getThickFurModifier())));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return messages;
 | 
			
		||||
 
 | 
			
		||||
@@ -5,17 +5,8 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
 | 
			
		||||
 | 
			
		||||
@ConfigSerializable
 | 
			
		||||
public class ConfigAutomatedBackups {
 | 
			
		||||
    public static final int SAVE_INTERVAL_MINUTES_DEFAULT = 10;
 | 
			
		||||
    public static final boolean ZIP_BACKUPS_ENABLED_DEFAULT = true;
 | 
			
		||||
    public static final int BACKUP_DAY_LIMIT_DEFAULT = 30;
 | 
			
		||||
    //public static final int MINIMUM_BACKUP_COUNT_DEFAULT = 10;
 | 
			
		||||
 | 
			
		||||
    @Setting(value = "Database-Save-Interval-Minutes", comment = "How often mcMMO player data gets saved." +
 | 
			
		||||
            "\nThis value represents how many minutes in between saving mcMMO does." +
 | 
			
		||||
            "\nSaving is done in ASYNC threads, so it has almost no impact on performance, however you should not be saving too often as its a bit pointless and takes resources away from your machine." +
 | 
			
		||||
            "\nI recommend just leaving this at its default value." +
 | 
			
		||||
            "\nDefault value: "+SAVE_INTERVAL_MINUTES_DEFAULT)
 | 
			
		||||
    private int saveIntervalMinutes = SAVE_INTERVAL_MINUTES_DEFAULT;
 | 
			
		||||
 | 
			
		||||
    @Setting(value = "Backup-Configs-And-FlatFile-Data", comment = "mcMMO will make backups of your configs and other important data for you." +
 | 
			
		||||
            "\nNOTE: mcMMO will not be making backups of your SQL data, you will have to setup scripts for that yourself." +
 | 
			
		||||
@@ -31,22 +22,6 @@ public class ConfigAutomatedBackups {
 | 
			
		||||
            "\nDefault value: "+ BACKUP_DAY_LIMIT_DEFAULT)
 | 
			
		||||
    private int backupDayLimit = BACKUP_DAY_LIMIT_DEFAULT;
 | 
			
		||||
 | 
			
		||||
/*    @Setting(value = "Minimum-Backups", comment = "The amount of backup files you must have before deletion of older files would be considered." +
 | 
			
		||||
            "\nThis does not prevent mcMMO from removing your old backups, it just prevents unnecessary removal of those files." +
 | 
			
		||||
            "\nFor example, if this value was set to 10. Then if you had 9 old backups from not having your server on for a long time," +
 | 
			
		||||
            "\n  then once the 10th backup is created those 9 older files would be removed." +
 | 
			
		||||
            "\nThis setting mostly prevents unnecessary operations rather than acting as a means to preserve a specific number of backups." +
 | 
			
		||||
            "\nDefault value: "+MINIMUM_BACKUP_COUNT_DEFAULT)
 | 
			
		||||
    private int minimumBackupCount = MINIMUM_BACKUP_COUNT_DEFAULT;*/
 | 
			
		||||
 | 
			
		||||
   /* public int getMinimumBackupCount() {
 | 
			
		||||
        return minimumBackupCount;
 | 
			
		||||
    }*/
 | 
			
		||||
 | 
			
		||||
    public int getSaveIntervalMinutes() {
 | 
			
		||||
        return saveIntervalMinutes;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isZipBackupsEnabled() {
 | 
			
		||||
        return zipBackupsEnabled;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package com.gmail.nossr50.datatypes.skills.alchemy;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
 | 
			
		||||
import org.bukkit.Color;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
import org.bukkit.inventory.ItemStack;
 | 
			
		||||
 
 | 
			
		||||
@@ -503,7 +503,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (Taming.canPreventDamage(pet, owner)) {
 | 
			
		||||
            if (Taming.getInstance().canPreventDamage(pet, owner)) {
 | 
			
		||||
                Player player = (Player) owner;
 | 
			
		||||
                Wolf wolf = (Wolf) pet;
 | 
			
		||||
 | 
			
		||||
@@ -527,7 +527,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
                    case ENTITY_ATTACK:
 | 
			
		||||
                    case PROJECTILE:
 | 
			
		||||
                        if (tamingManager.canUseThickFur()) {
 | 
			
		||||
                            event.setDamage(Taming.processThickFur(wolf, event.getDamage()));
 | 
			
		||||
                            event.setDamage(Taming.getInstance().processThickFur(wolf, event.getDamage()));
 | 
			
		||||
 | 
			
		||||
                            if (event.getFinalDamage() == 0) {
 | 
			
		||||
                                event.setCancelled(true);
 | 
			
		||||
@@ -537,7 +537,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
 | 
			
		||||
                    case FIRE_TICK:
 | 
			
		||||
                        if (tamingManager.canUseThickFur()) {
 | 
			
		||||
                            Taming.processThickFurFire(wolf);
 | 
			
		||||
                            Taming.getInstance().processThickFurFire(wolf);
 | 
			
		||||
                        }
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
@@ -545,7 +545,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
                    case POISON:
 | 
			
		||||
                    case WITHER:
 | 
			
		||||
                        if (tamingManager.canUseHolyHound()) {
 | 
			
		||||
                            Taming.processHolyHound(wolf, event.getDamage());
 | 
			
		||||
                            Taming.getInstance().processHolyHound(wolf, event.getDamage());
 | 
			
		||||
                        }
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
@@ -553,7 +553,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
                    case ENTITY_EXPLOSION:
 | 
			
		||||
                    case LIGHTNING:
 | 
			
		||||
                        if (tamingManager.canUseShockProof()) {
 | 
			
		||||
                            event.setDamage(Taming.processShockProof(wolf, event.getDamage()));
 | 
			
		||||
                            event.setDamage(Taming.getInstance().processShockProof(wolf, event.getDamage()));
 | 
			
		||||
 | 
			
		||||
                            if (event.getFinalDamage() == 0) {
 | 
			
		||||
                                event.setCancelled(true);
 | 
			
		||||
 
 | 
			
		||||
@@ -547,7 +547,7 @@ public class mcMMO extends JavaPlugin {
 | 
			
		||||
 | 
			
		||||
    private void scheduleTasks() {
 | 
			
		||||
        // Periodic save timer (Saves every 10 minutes by default)
 | 
			
		||||
        long saveIntervalTicks = Math.max(1200, (getConfigManager().getConfigAutomatedBackups().getSaveIntervalMinutes() * 1200));
 | 
			
		||||
        long saveIntervalTicks = Math.max(1200, (getConfigManager().getConfigDatabase().getConfigSectionDatabaseGeneral().getSaveIntervalMinutes() * (20 * 60)));
 | 
			
		||||
        new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
 | 
			
		||||
 | 
			
		||||
        // Cleanup the backups folder
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ public class AcrobaticsManager extends SkillManager {
 | 
			
		||||
 | 
			
		||||
    public boolean canGainRollXP()
 | 
			
		||||
    {
 | 
			
		||||
        if(!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
 | 
			
		||||
        if(!mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
 | 
			
		||||
            return true;
 | 
			
		||||
 | 
			
		||||
        if(System.currentTimeMillis() >= rollXPCooldown)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,47 +1,91 @@
 | 
			
		||||
package com.gmail.nossr50.skills.taming;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.config.AdvancedConfig;
 | 
			
		||||
import org.bukkit.EntityEffect;
 | 
			
		||||
import org.bukkit.entity.*;
 | 
			
		||||
 | 
			
		||||
public class Taming {
 | 
			
		||||
    public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
 | 
			
		||||
 | 
			
		||||
    public static int    goreBleedTicks    = 2; //Equivalent to rank 1 in Rupture
 | 
			
		||||
    public static double goreModifier      = AdvancedConfig.getInstance().getGoreModifier();
 | 
			
		||||
    private static Taming instance;
 | 
			
		||||
    private double fastFoodServiceActivationChance;
 | 
			
		||||
    private int goreBleedTicks;
 | 
			
		||||
    private double goreModifier;
 | 
			
		||||
    private double sharpenedClawsBonusDamage;
 | 
			
		||||
    private double shockProofModifier;
 | 
			
		||||
    private double thickFurModifier;
 | 
			
		||||
 | 
			
		||||
    public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
 | 
			
		||||
    public Taming() {
 | 
			
		||||
        fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
 | 
			
		||||
 | 
			
		||||
    public static double shockProofModifier    = AdvancedConfig.getInstance().getShockProofModifier();
 | 
			
		||||
        //Equivalent to rank 1 in Rupture
 | 
			
		||||
        goreBleedTicks = 2;
 | 
			
		||||
        goreModifier = AdvancedConfig.getInstance().getGoreModifier();
 | 
			
		||||
 | 
			
		||||
    public static double thickFurModifier    = AdvancedConfig.getInstance().getThickFurModifier();
 | 
			
		||||
        sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
 | 
			
		||||
 | 
			
		||||
    public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
 | 
			
		||||
        shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier();
 | 
			
		||||
 | 
			
		||||
        thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static Taming getInstance() {
 | 
			
		||||
        if (instance == null)
 | 
			
		||||
            instance = new Taming();
 | 
			
		||||
 | 
			
		||||
        return instance;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getFastFoodServiceActivationChance() {
 | 
			
		||||
        return fastFoodServiceActivationChance;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getGoreBleedTicks() {
 | 
			
		||||
        return goreBleedTicks;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getGoreModifier() {
 | 
			
		||||
        return goreModifier;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getSharpenedClawsBonusDamage() {
 | 
			
		||||
        return sharpenedClawsBonusDamage;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getShockProofModifier() {
 | 
			
		||||
        return shockProofModifier;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getThickFurModifier() {
 | 
			
		||||
        return thickFurModifier;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
 | 
			
		||||
        return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static double processThickFur(Wolf wolf, double damage) {
 | 
			
		||||
    public double processThickFur(Wolf wolf, double damage) {
 | 
			
		||||
        wolf.playEffect(EntityEffect.WOLF_SHAKE);
 | 
			
		||||
        return damage / thickFurModifier;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void processThickFurFire(Wolf wolf) {
 | 
			
		||||
    public void processThickFurFire(Wolf wolf) {
 | 
			
		||||
        wolf.playEffect(EntityEffect.WOLF_SMOKE);
 | 
			
		||||
        wolf.setFireTicks(0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static double processShockProof(Wolf wolf, double damage) {
 | 
			
		||||
    public double processShockProof(Wolf wolf, double damage) {
 | 
			
		||||
        wolf.playEffect(EntityEffect.WOLF_SHAKE);
 | 
			
		||||
        return damage / shockProofModifier;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void processHolyHound(Wolf wolf, double damage) {
 | 
			
		||||
    public void processHolyHound(Wolf wolf, double damage) {
 | 
			
		||||
        double modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth());
 | 
			
		||||
 | 
			
		||||
        wolf.setHealth(modifiedHealth);
 | 
			
		||||
        wolf.playEffect(EntityEffect.WOLF_HEARTS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected static String getCallOfTheWildFailureMessage(EntityType type) {
 | 
			
		||||
    public String getCallOfTheWildFailureMessage(EntityType type) {
 | 
			
		||||
        switch (type) {
 | 
			
		||||
            case OCELOT:
 | 
			
		||||
                return "Taming.Summon.Fail.Ocelot";
 | 
			
		||||
 
 | 
			
		||||
@@ -124,7 +124,7 @@ public class TamingManager extends SkillManager {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        BleedTimerTask.add(target, getPlayer(), Taming.goreBleedTicks, 1, 2);
 | 
			
		||||
        BleedTimerTask.add(target, getPlayer(), Taming.getInstance().getGoreBleedTicks(), 1, 2);
 | 
			
		||||
 | 
			
		||||
        if (target instanceof Player) {
 | 
			
		||||
            NotificationManager.sendPlayerInformation((Player)target, NotificationType.SUBSKILL_MESSAGE, "Combat.StruckByGore");
 | 
			
		||||
@@ -132,12 +132,12 @@ public class TamingManager extends SkillManager {
 | 
			
		||||
 | 
			
		||||
        NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.Gore");
 | 
			
		||||
 | 
			
		||||
        damage = (damage * Taming.goreModifier) - damage;
 | 
			
		||||
        damage = (damage * Taming.getInstance().getGoreModifier()) - damage;
 | 
			
		||||
        return damage;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double sharpenedClaws() {
 | 
			
		||||
        return Taming.sharpenedClawsBonusDamage;
 | 
			
		||||
    public double getSharpenedClawsDamage() {
 | 
			
		||||
        return Taming.getInstance().getSharpenedClawsBonusDamage();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -352,7 +352,7 @@ public class TamingManager extends SkillManager {
 | 
			
		||||
 | 
			
		||||
        for (Entity entity : player.getNearbyEntities(range, range, range)) {
 | 
			
		||||
            if (entity.getType() == type) {
 | 
			
		||||
                NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, Taming.getCallOfTheWildFailureMessage(type));
 | 
			
		||||
                NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, Taming.getInstance().getCallOfTheWildFailureMessage(type));
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -564,7 +564,7 @@ public final class BlockUtils {
 | 
			
		||||
    public static boolean isMcMMOAnvil(BlockState blockState) {
 | 
			
		||||
        Material type = blockState.getType();
 | 
			
		||||
 | 
			
		||||
        return type == Repair.anvilMaterial || type == Salvage.anvilMaterial;
 | 
			
		||||
        return type == Repair.getInstance().getAnvilMaterial() || type == Salvage.anvilMaterial;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static boolean isPistonPiece(BlockState blockState) {
 | 
			
		||||
 
 | 
			
		||||
@@ -180,7 +180,7 @@ public final class CombatUtils {
 | 
			
		||||
        tamingManager.pummel(target, wolf);
 | 
			
		||||
 | 
			
		||||
        if (tamingManager.canUseSharpenedClaws()) {
 | 
			
		||||
            finalDamage+=tamingManager.sharpenedClaws();
 | 
			
		||||
            finalDamage+=tamingManager.getSharpenedClawsDamage();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (tamingManager.canUseGore()) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user