mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 18:43:43 +01:00 
			
		
		
		
	Handle all the buff removal in BlockDamage. Also removes the config
option for using Mining & Excavation without tools.
This commit is contained in:
		@@ -90,7 +90,8 @@ Version 1.4.00-dev
 | 
			
		||||
 - Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
 | 
			
		||||
 - Removed unused "healthbar" files from the resources
 | 
			
		||||
 - Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
 | 
			
		||||
 - Removed /mcc command. Replaced with /mcmmo [?|help|commands]
 | 
			
		||||
 - Removed /mcc command. Replaced with /mcmmo [?|help|commands]
 | 
			
		||||
 - Removed options to allow Mining & Excavation without a tool due to the changes to their abilities
 | 
			
		||||
 | 
			
		||||
Version 1.3.14
 | 
			
		||||
 + Added new Hylian Luck skill to Herbalism.
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,6 @@ import org.bukkit.entity.Player;
 | 
			
		||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
 | 
			
		||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
			
		||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
			
		||||
import com.gmail.nossr50.skills.utilities.SkillTools;
 | 
			
		||||
import com.gmail.nossr50.util.Users;
 | 
			
		||||
 | 
			
		||||
public class McrefreshCommand implements CommandExecutor {
 | 
			
		||||
@@ -33,7 +32,6 @@ public class McrefreshCommand implements CommandExecutor {
 | 
			
		||||
            profile.resetCooldowns();
 | 
			
		||||
            profile.resetToolPrepMode();
 | 
			
		||||
            profile.resetAbilityMode();
 | 
			
		||||
            SkillTools.handleAbilitySpeedDecrease((Player) sender); //Remove enchants left over
 | 
			
		||||
 | 
			
		||||
            sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -69,7 +67,6 @@ public class McrefreshCommand implements CommandExecutor {
 | 
			
		||||
            profile.resetCooldowns();
 | 
			
		||||
            profile.resetToolPrepMode();
 | 
			
		||||
            profile.resetAbilityMode();
 | 
			
		||||
            SkillTools.handleAbilitySpeedDecrease(player); //Remove enchants left over
 | 
			
		||||
 | 
			
		||||
            player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
 | 
			
		||||
            sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
 | 
			
		||||
 
 | 
			
		||||
@@ -150,8 +150,6 @@ public class Config extends ConfigLoader {
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    /* Tool Requirements */
 | 
			
		||||
    public boolean getMiningRequiresTool() { return config.getBoolean("Skills.Mining.Requires_Pickaxe", true); }
 | 
			
		||||
    public boolean getExcavationRequiresTool() { return config.getBoolean("Skills.Excavation.Requires_Shovel", true); }
 | 
			
		||||
    public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
 | 
			
		||||
 | 
			
		||||
    /* Excavation */
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,6 @@ import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
 | 
			
		||||
import com.gmail.nossr50.runnables.StickyPistonTracker;
 | 
			
		||||
import com.gmail.nossr50.skills.excavation.Excavation;
 | 
			
		||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
 | 
			
		||||
import com.gmail.nossr50.skills.mining.Mining;
 | 
			
		||||
import com.gmail.nossr50.skills.mining.MiningManager;
 | 
			
		||||
import com.gmail.nossr50.skills.repair.Repair;
 | 
			
		||||
import com.gmail.nossr50.skills.repair.Salvage;
 | 
			
		||||
@@ -169,24 +168,12 @@ public class BlockListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* MINING */
 | 
			
		||||
        else if (BlockChecks.canBeSuperBroken(block) && player.hasPermission("mcmmo.skills.mining") && !mcMMO.placeStore.isTrue(block)) {
 | 
			
		||||
            if (Mining.requiresTool) {
 | 
			
		||||
                if (ItemChecks.isPickaxe(heldItem)) {
 | 
			
		||||
                    MiningManager miningManager = new MiningManager(mcMMOPlayer);
 | 
			
		||||
                    miningManager.miningBlockCheck(block);
 | 
			
		||||
        else if (BlockChecks.canBeSuperBroken(block) && ItemChecks.isPickaxe(heldItem) && player.hasPermission("mcmmo.skills.mining") && !mcMMO.placeStore.isTrue(block)) {
 | 
			
		||||
            MiningManager miningManager = new MiningManager(mcMMOPlayer);
 | 
			
		||||
            miningManager.miningBlockCheck(block);
 | 
			
		||||
 | 
			
		||||
                    if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
 | 
			
		||||
                        miningManager.miningBlockCheck(block);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                MiningManager miningManager = new MiningManager(mcMMOPlayer);
 | 
			
		||||
            if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
 | 
			
		||||
                miningManager.miningBlockCheck(block);
 | 
			
		||||
 | 
			
		||||
                if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
 | 
			
		||||
                    miningManager.miningBlockCheck(block);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -208,22 +195,11 @@ public class BlockListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* EXCAVATION */
 | 
			
		||||
        else if (BlockChecks.canBeGigaDrillBroken(block) && player.hasPermission("mcmmo.skills.excavation") && !mcMMO.placeStore.isTrue(block)) {
 | 
			
		||||
            if (Excavation.requiresTool) {
 | 
			
		||||
                if (ItemChecks.isShovel(heldItem)) {
 | 
			
		||||
                    Excavation.excavationProcCheck(block, mcMMOPlayer);
 | 
			
		||||
        else if (BlockChecks.canBeGigaDrillBroken(block) && ItemChecks.isShovel(heldItem) && player.hasPermission("mcmmo.skills.excavation") && !mcMMO.placeStore.isTrue(block)) {
 | 
			
		||||
            Excavation.excavationProcCheck(block, mcMMOPlayer);
 | 
			
		||||
 | 
			
		||||
                    if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
 | 
			
		||||
                        Excavation.gigaDrillBreaker(mcMMOPlayer, block);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                Excavation.excavationProcCheck(block, mcMMOPlayer);
 | 
			
		||||
 | 
			
		||||
                if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
 | 
			
		||||
                    Excavation.gigaDrillBreaker(mcMMOPlayer, block);
 | 
			
		||||
                }
 | 
			
		||||
            if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
 | 
			
		||||
                Excavation.gigaDrillBreaker(mcMMOPlayer, block);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -290,6 +266,10 @@ public class BlockListener implements Listener {
 | 
			
		||||
        if (BlockChecks.canActivateAbilities(block)) {
 | 
			
		||||
            ItemStack heldItem = player.getItemInHand();
 | 
			
		||||
 | 
			
		||||
            if ((ItemChecks.isPickaxe(heldItem) && !profile.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemChecks.isShovel(heldItem) && !profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
 | 
			
		||||
                SkillTools.removeAbilityBuff(heldItem);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (profile.getToolPreparationMode(ToolType.HOE) && ItemChecks.isHoe(heldItem) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.canMakeMossy(block)) && player.hasPermission("mcmmo.ability.herbalism.greenterra")) {
 | 
			
		||||
                SkillTools.abilityCheck(player, SkillType.HERBALISM);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@ import org.bukkit.event.Listener;
 | 
			
		||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
 | 
			
		||||
import org.bukkit.event.inventory.FurnaceExtractEvent;
 | 
			
		||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
 | 
			
		||||
import org.bukkit.event.inventory.InventoryClickEvent;
 | 
			
		||||
import org.bukkit.event.inventory.InventoryCloseEvent;
 | 
			
		||||
import org.bukkit.event.inventory.InventoryOpenEvent;
 | 
			
		||||
import org.bukkit.event.inventory.InventoryType;
 | 
			
		||||
@@ -20,7 +19,6 @@ import org.bukkit.inventory.ItemStack;
 | 
			
		||||
import com.gmail.nossr50.mcMMO;
 | 
			
		||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
 | 
			
		||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
 | 
			
		||||
import com.gmail.nossr50.skills.utilities.SkillTools;
 | 
			
		||||
import com.gmail.nossr50.util.ItemChecks;
 | 
			
		||||
import com.gmail.nossr50.util.Users;
 | 
			
		||||
 | 
			
		||||
@@ -130,10 +128,4 @@ public class InventoryListener implements Listener{
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 | 
			
		||||
    public void onInventoryClickEvent(InventoryClickEvent event) {
 | 
			
		||||
        ItemStack item = event.getCurrentItem();
 | 
			
		||||
        SkillTools.removeAbilityBuff(item); //Remove enchants if they try to move them in an inventory
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -58,28 +58,6 @@ public class PlayerListener implements Listener {
 | 
			
		||||
        this.plugin = plugin;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle PlayerDeath events where the event is modified.
 | 
			
		||||
     *
 | 
			
		||||
     * @param event The event to modify
 | 
			
		||||
     */
 | 
			
		||||
    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 | 
			
		||||
    public void onPlayerDeathHigher(PlayerDeathEvent event) {
 | 
			
		||||
        Player player = event.getEntity();
 | 
			
		||||
 | 
			
		||||
        if (Misc.isNPCPlayer(player)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        PlayerProfile playerProfile = Users.getPlayer(player).getProfile();
 | 
			
		||||
 | 
			
		||||
        if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
 | 
			
		||||
            for (ItemStack item : event.getDrops()) {
 | 
			
		||||
                SkillTools.removeAbilityBuff(item);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Monitor PlayerDeath events.
 | 
			
		||||
     *
 | 
			
		||||
@@ -245,8 +223,6 @@ public class PlayerListener implements Listener {
 | 
			
		||||
        if (plugin.isXPEventEnabled()) {
 | 
			
		||||
            player.sendMessage(LocaleLoader.getString("XPRate.Event", Config.getInstance().getExperienceGainsGlobalMultiplier()));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        SkillTools.handleAbilitySpeedDecrease(player); //Remove enchants left over in case of disconnect or server crash
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,6 @@ import com.gmail.nossr50.util.Misc;
 | 
			
		||||
import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
 | 
			
		||||
public class Excavation {
 | 
			
		||||
    public static boolean requiresTool = Config.getInstance().getExcavationRequiresTool();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check to see if treasures were found.
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,6 @@ public class Mining {
 | 
			
		||||
    public static double doubleDropsMaxChance = advancedConfig.getMiningDoubleDropChance();
 | 
			
		||||
    public static boolean doubleDropsDisabled = config.miningDoubleDropsDisabled();
 | 
			
		||||
 | 
			
		||||
    public static boolean requiresTool = Config.getInstance().getMiningRequiresTool();
 | 
			
		||||
 | 
			
		||||
    public static final int DIAMOND_TOOL_TIER = 4;
 | 
			
		||||
    public static final int IRON_TOOL_TIER = 3;
 | 
			
		||||
 
 | 
			
		||||
@@ -140,7 +140,6 @@ Skills:
 | 
			
		||||
        Level_Cap: 0
 | 
			
		||||
    Excavation:
 | 
			
		||||
        Level_Cap: 0
 | 
			
		||||
        Requires_Shovel: true
 | 
			
		||||
    Fishing:
 | 
			
		||||
        Drops_Enabled: true
 | 
			
		||||
        Level_Cap: 0
 | 
			
		||||
@@ -154,7 +153,6 @@ Skills:
 | 
			
		||||
            Dirt_To_Grass: true
 | 
			
		||||
    Mining:
 | 
			
		||||
        Level_Cap: 0
 | 
			
		||||
        Requires_Pickaxe: true
 | 
			
		||||
        Detonator_ID: 259
 | 
			
		||||
    Repair:
 | 
			
		||||
        Level_Cap: 0
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user