mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Merge pull request #327 from Glitchfinder/fixes
Additional fixes and patches.
This commit is contained in:
		@@ -43,7 +43,7 @@ public class AxesCommand extends SkillCommand {
 | 
				
			|||||||
        int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel);
 | 
					        int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        impactDamage = String.valueOf(1 + ((double) skillValue / (double) greaterImpactIncreaseLevel));
 | 
					        impactDamage = String.valueOf(1 + ((double) skillValue / (double) greaterImpactIncreaseLevel));
 | 
				
			||||||
        skullSplitterLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
					        skullSplitterLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
				
			||||||
        greaterImpactDamage = "2";
 | 
					        greaterImpactDamage = "2";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance);
 | 
					        if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ public class ExcavationCommand extends SkillCommand {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void dataCalculations() {
 | 
					    protected void dataCalculations() {
 | 
				
			||||||
        gigaDrillBreakerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
					        gigaDrillBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,7 @@ public class HerbalismCommand extends SkillCommand {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void dataCalculations() {
 | 
					    protected void dataCalculations() {
 | 
				
			||||||
        DecimalFormat df = new DecimalFormat("#.0");
 | 
					        DecimalFormat df = new DecimalFormat("#.0");
 | 
				
			||||||
        greenTerraLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
					        greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
				
			||||||
        //FARMERS DIET
 | 
					        //FARMERS DIET
 | 
				
			||||||
        if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
 | 
					        if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
 | 
				
			||||||
        else farmersDietRank = String.valueOf((double) skillValue / (double) farmersDietRankChange);
 | 
					        else farmersDietRank = String.valueOf((double) skillValue / (double) farmersDietRankChange);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ public class MiningCommand extends SkillCommand {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void dataCalculations() {
 | 
					    protected void dataCalculations() {
 | 
				
			||||||
        DecimalFormat df = new DecimalFormat("#.0");
 | 
					        DecimalFormat df = new DecimalFormat("#.0");
 | 
				
			||||||
        superBreakerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
					        superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
				
			||||||
        if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
 | 
					        if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
 | 
				
			||||||
        else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue);
 | 
					        else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@ public class SwordsCommand extends SkillCommand {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void dataCalculations() {
 | 
					    protected void dataCalculations() {
 | 
				
			||||||
        DecimalFormat df = new DecimalFormat("#.0");
 | 
					        DecimalFormat df = new DecimalFormat("#.0");
 | 
				
			||||||
        serratedStrikesLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
					        serratedStrikesLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks);
 | 
					        if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks);
 | 
				
			||||||
        else bleedLength = String.valueOf(bleedBaseTicks);
 | 
					        else bleedLength = String.valueOf(bleedBaseTicks);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ public class UnarmedCommand extends SkillCommand {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void dataCalculations() {
 | 
					    protected void dataCalculations() {
 | 
				
			||||||
        DecimalFormat df = new DecimalFormat("#.0");
 | 
					        DecimalFormat df = new DecimalFormat("#.0");
 | 
				
			||||||
        berserkLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
					        berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(skillValue >= disarmMaxLevel) disarmChance = df.format(disarmChanceMax);
 | 
					        if(skillValue >= disarmMaxLevel) disarmChance = df.format(disarmChanceMax);
 | 
				
			||||||
        else disarmChance = df.format(((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillValue);
 | 
					        else disarmChance = df.format(((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillValue);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ public class WoodcuttingCommand extends SkillCommand {
 | 
				
			|||||||
    protected void dataCalculations() {
 | 
					    protected void dataCalculations() {
 | 
				
			||||||
        DecimalFormat df = new DecimalFormat("0.0");
 | 
					        DecimalFormat df = new DecimalFormat("0.0");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        treeFellerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
					        treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
 | 
				
			||||||
        if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
 | 
					        if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
 | 
				
			||||||
        else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue);
 | 
					        else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -119,6 +119,11 @@ public class McMMOPlayer {
 | 
				
			|||||||
     * @param newvalue The amount of XP to add
 | 
					     * @param newvalue The amount of XP to add
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void addXP(SkillType skillType, int newValue) {
 | 
					    public void addXP(SkillType skillType, int newValue) {
 | 
				
			||||||
 | 
					        if(player == null)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        else if(player.getGameMode() == null)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (player.getGameMode().equals(GameMode.CREATIVE)) {
 | 
					        if (player.getGameMode().equals(GameMode.CREATIVE)) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,17 +63,17 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
        Block futureEmptyBlock = event.getBlock().getRelative(direction);
 | 
					        Block futureEmptyBlock = event.getBlock().getRelative(direction);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (Block b : blocks) {
 | 
					        for (Block b : blocks) {
 | 
				
			||||||
            if (mcMMO.placeStore.isTrue(b)) {
 | 
					            if (mcMMO.p.placeStore.isTrue(b)) {
 | 
				
			||||||
                b.getRelative(direction).setMetadata("pistonTrack", new FixedMetadataValue(plugin, true));
 | 
					                b.getRelative(direction).setMetadata("pistonTrack", new FixedMetadataValue(plugin, true));
 | 
				
			||||||
                if (b.equals(futureEmptyBlock)) {
 | 
					                if (b.equals(futureEmptyBlock)) {
 | 
				
			||||||
                    mcMMO.placeStore.setFalse(b);
 | 
					                    mcMMO.p.placeStore.setFalse(b);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (Block b : blocks) {
 | 
					        for (Block b : blocks) {
 | 
				
			||||||
            if (b.getRelative(direction).hasMetadata("pistonTrack")) {
 | 
					            if (b.getRelative(direction).hasMetadata("pistonTrack")) {
 | 
				
			||||||
                mcMMO.placeStore.setTrue(b.getRelative(direction));
 | 
					                mcMMO.p.placeStore.setTrue(b.getRelative(direction));
 | 
				
			||||||
                b.getRelative(direction).removeMetadata("pistonTrack", plugin);
 | 
					                b.getRelative(direction).removeMetadata("pistonTrack", plugin);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -96,7 +96,7 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
            Block fallenBlock = event.getBlock().getRelative(BlockFace.UP);
 | 
					            Block fallenBlock = event.getBlock().getRelative(BlockFace.UP);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (fallenBlock.getType() == type) {
 | 
					            if (fallenBlock.getType() == type) {
 | 
				
			||||||
                mcMMO.placeStore.setTrue(fallenBlock);
 | 
					                mcMMO.p.placeStore.setTrue(fallenBlock);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -139,7 +139,7 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
                    Block newLocation = block.getRelative(0, y + 1, 0);
 | 
					                    Block newLocation = block.getRelative(0, y + 1, 0);
 | 
				
			||||||
                    mcMMO.placeStore.setTrue(newLocation);
 | 
					                    mcMMO.p.placeStore.setTrue(newLocation);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -148,7 +148,7 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
        /* Check if the blocks placed should be monitored so they do not give out XP in the future */
 | 
					        /* Check if the blocks placed should be monitored so they do not give out XP in the future */
 | 
				
			||||||
        if (BlockChecks.shouldBeWatched(block)) {
 | 
					        if (BlockChecks.shouldBeWatched(block)) {
 | 
				
			||||||
            if (!((type == Material.SAND || type == Material.GRAVEL) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR)) { //Don't wanna track sand that's gonna fall.
 | 
					            if (!((type == Material.SAND || type == Material.GRAVEL) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR)) { //Don't wanna track sand that's gonna fall.
 | 
				
			||||||
                mcMMO.placeStore.setTrue(block);
 | 
					                mcMMO.p.placeStore.setTrue(block);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -233,7 +233,7 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* EXCAVATION */
 | 
					        /* EXCAVATION */
 | 
				
			||||||
        else if (BlockChecks.canBeGigaDrillBroken(block) && permInstance.excavation(player) && !mcMMO.placeStore.isTrue(block)) {
 | 
					        else if (BlockChecks.canBeGigaDrillBroken(block) && permInstance.excavation(player) && !mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
            if (configInstance.getExcavationRequiresTool()) {
 | 
					            if (configInstance.getExcavationRequiresTool()) {
 | 
				
			||||||
                if (ItemChecks.isShovel(inHand)) {
 | 
					                if (ItemChecks.isShovel(inHand)) {
 | 
				
			||||||
                    Excavation.excavationProcCheck(block, player);
 | 
					                    Excavation.excavationProcCheck(block, player);
 | 
				
			||||||
@@ -246,7 +246,7 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        //Remove metadata when broken
 | 
					        //Remove metadata when broken
 | 
				
			||||||
        if (BlockChecks.shouldBeWatched(block)) {
 | 
					        if (BlockChecks.shouldBeWatched(block)) {
 | 
				
			||||||
            mcMMO.placeStore.setFalse(block);
 | 
					            mcMMO.p.placeStore.setFalse(block);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Remove metadata from fallen sand/gravel
 | 
					        //Remove metadata from fallen sand/gravel
 | 
				
			||||||
@@ -257,11 +257,11 @@ public class BlockListener implements Listener {
 | 
				
			|||||||
                Block relative = block.getRelative(0, y, 0);
 | 
					                Block relative = block.getRelative(0, y, 0);
 | 
				
			||||||
                Material relativeType = relative.getType();
 | 
					                Material relativeType = relative.getType();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.placeStore.isTrue(relative)) {
 | 
					                if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.p.placeStore.isTrue(relative)) {
 | 
				
			||||||
                    mcMMO.placeStore.setFalse(relative);
 | 
					                    mcMMO.p.placeStore.setFalse(relative);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)){
 | 
					                else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.p.placeStore.isTrue(relative)){
 | 
				
			||||||
                    mcMMO.placeStore.setFalse(relative);
 | 
					                    mcMMO.p.placeStore.setFalse(relative);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,16 +37,16 @@ public class WorldListener implements Listener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onWorldUnload(WorldUnloadEvent event) {
 | 
					    public void onWorldUnload(WorldUnloadEvent event) {
 | 
				
			||||||
        mcMMO.placeStore.unloadWorld(event.getWorld());
 | 
					        mcMMO.p.placeStore.unloadWorld(event.getWorld());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onWorldSave(WorldSaveEvent event) {
 | 
					    public void onWorldSave(WorldSaveEvent event) {
 | 
				
			||||||
        mcMMO.placeStore.saveWorld(event.getWorld());
 | 
					        mcMMO.p.placeStore.saveWorld(event.getWorld());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onChunkUnload(ChunkUnloadEvent event) {
 | 
					    public void onChunkUnload(ChunkUnloadEvent event) {
 | 
				
			||||||
        mcMMO.placeStore.chunkUnloaded(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
 | 
					        mcMMO.p.placeStore.chunkUnloaded(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,11 +17,11 @@ public class StickyPistonTracker implements Runnable {
 | 
				
			|||||||
    public void run() {
 | 
					    public void run() {
 | 
				
			||||||
        Block originalBlock = event.getRetractLocation().getBlock();
 | 
					        Block originalBlock = event.getRetractLocation().getBlock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (originalBlock.getType() == Material.AIR && mcMMO.placeStore.isTrue(originalBlock)) {
 | 
					        if (originalBlock.getType() == Material.AIR && mcMMO.p.placeStore.isTrue(originalBlock)) {
 | 
				
			||||||
            Block newBlock = originalBlock.getRelative(event.getDirection().getOppositeFace());
 | 
					            Block newBlock = originalBlock.getRelative(event.getDirection().getOppositeFace());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            mcMMO.placeStore.setFalse(originalBlock);
 | 
					            mcMMO.p.placeStore.setFalse(originalBlock);
 | 
				
			||||||
            mcMMO.placeStore.setTrue(newBlock);
 | 
					            mcMMO.p.placeStore.setTrue(newBlock);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,7 @@ public class BlastMining {
 | 
				
			|||||||
                blocksDropped.add(temp);
 | 
					                blocksDropped.add(temp);
 | 
				
			||||||
                Mining.miningDrops(temp);
 | 
					                Mining.miningDrops(temp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (!mcMMO.placeStore.isTrue(temp)) {
 | 
					                if (!mcMMO.p.placeStore.isTrue(temp)) {
 | 
				
			||||||
                    for (int i = 1 ; i < extraDrops ; i++) {
 | 
					                    for (int i = 1 ; i < extraDrops ; i++) {
 | 
				
			||||||
                        blocksDropped.add(temp);
 | 
					                        blocksDropped.add(temp);
 | 
				
			||||||
                        Mining.miningDrops(temp);
 | 
					                        Mining.miningDrops(temp);
 | 
				
			||||||
@@ -172,7 +172,7 @@ public class BlastMining {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (Block block : xp) {
 | 
					        for (Block block : xp) {
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(block)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
                Mining.miningXP(player, block);
 | 
					                Mining.miningXP(player, block);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,7 +130,7 @@ public class Excavation {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
 | 
					        Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!mcMMO.placeStore.isTrue(block) && !Misc.blockBreakSimulate(block, player, true)) {
 | 
					        if (!mcMMO.p.placeStore.isTrue(block) && !Misc.blockBreakSimulate(block, player, true)) {
 | 
				
			||||||
            FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
 | 
					            FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
 | 
				
			||||||
            mcMMO.p.getServer().getPluginManager().callEvent(armswing);
 | 
					            mcMMO.p.getServer().getPluginManager().callEvent(armswing);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@ public class Herbalism {
 | 
				
			|||||||
            else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type == Material.COBBLESTONE) {
 | 
					            else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type == Material.COBBLESTONE) {
 | 
				
			||||||
                block.setType(Material.MOSSY_COBBLESTONE);
 | 
					                block.setType(Material.MOSSY_COBBLESTONE);
 | 
				
			||||||
                // Don't award double drops to mossified cobblestone
 | 
					                // Don't award double drops to mossified cobblestone
 | 
				
			||||||
                mcMMO.placeStore.setTrue(block);
 | 
					                mcMMO.p.placeStore.setTrue(block);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else if (Config.getInstance().getHerbalismGreenThumbCobbleWallToMossyWall() && type == Material.COBBLE_WALL) {
 | 
					            else if (Config.getInstance().getHerbalismGreenThumbCobbleWallToMossyWall() && type == Material.COBBLE_WALL) {
 | 
				
			||||||
                block.setData((byte) 1);
 | 
					                block.setData((byte) 1);
 | 
				
			||||||
@@ -109,7 +109,7 @@ public class Herbalism {
 | 
				
			|||||||
        switch (type) {
 | 
					        switch (type) {
 | 
				
			||||||
        case BROWN_MUSHROOM:
 | 
					        case BROWN_MUSHROOM:
 | 
				
			||||||
        case RED_MUSHROOM:
 | 
					        case RED_MUSHROOM:
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(block)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
                mat = Material.getMaterial(id);
 | 
					                mat = Material.getMaterial(id);
 | 
				
			||||||
                xp = Config.getInstance().getHerbalismXPMushrooms();
 | 
					                xp = Config.getInstance().getHerbalismXPMushrooms();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -120,7 +120,7 @@ public class Herbalism {
 | 
				
			|||||||
                Block b = block.getRelative(0, y, 0);
 | 
					                Block b = block.getRelative(0, y, 0);
 | 
				
			||||||
                if (b.getType().equals(Material.CACTUS)) {
 | 
					                if (b.getType().equals(Material.CACTUS)) {
 | 
				
			||||||
                    mat = Material.CACTUS;
 | 
					                    mat = Material.CACTUS;
 | 
				
			||||||
                    if (!mcMMO.placeStore.isTrue(b)) {
 | 
					                    if (!mcMMO.p.placeStore.isTrue(b)) {
 | 
				
			||||||
                        if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) {
 | 
					                        if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) {
 | 
				
			||||||
                            catciDrops++;
 | 
					                            catciDrops++;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -142,7 +142,7 @@ public class Herbalism {
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case MELON_BLOCK:
 | 
					        case MELON_BLOCK:
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(block)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
                mat = Material.MELON;
 | 
					                mat = Material.MELON;
 | 
				
			||||||
                xp = Config.getInstance().getHerbalismXPMelon();
 | 
					                xp = Config.getInstance().getHerbalismXPMelon();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -161,7 +161,7 @@ public class Herbalism {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        case PUMPKIN:
 | 
					        case PUMPKIN:
 | 
				
			||||||
        case JACK_O_LANTERN:
 | 
					        case JACK_O_LANTERN:
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(block)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
                mat = Material.getMaterial(id);
 | 
					                mat = Material.getMaterial(id);
 | 
				
			||||||
                xp = Config.getInstance().getHerbalismXPPumpkin();
 | 
					                xp = Config.getInstance().getHerbalismXPPumpkin();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -169,7 +169,7 @@ public class Herbalism {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        case RED_ROSE:
 | 
					        case RED_ROSE:
 | 
				
			||||||
        case YELLOW_FLOWER:
 | 
					        case YELLOW_FLOWER:
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(block)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
                mat = Material.getMaterial(id);
 | 
					                mat = Material.getMaterial(id);
 | 
				
			||||||
                xp = Config.getInstance().getHerbalismXPFlowers();
 | 
					                xp = Config.getInstance().getHerbalismXPFlowers();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -180,7 +180,7 @@ public class Herbalism {
 | 
				
			|||||||
                Block b = block.getRelative(0, y, 0);
 | 
					                Block b = block.getRelative(0, y, 0);
 | 
				
			||||||
                if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
 | 
					                if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
 | 
				
			||||||
                    mat = Material.SUGAR_CANE;
 | 
					                    mat = Material.SUGAR_CANE;
 | 
				
			||||||
                    if (!mcMMO.placeStore.isTrue(b)) {
 | 
					                    if (!mcMMO.p.placeStore.isTrue(b)) {
 | 
				
			||||||
                        if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) {
 | 
					                        if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) {
 | 
				
			||||||
                            caneDrops++;
 | 
					                            caneDrops++;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -191,14 +191,14 @@ public class Herbalism {
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case VINE:
 | 
					        case VINE:
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(block)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
                mat = type;
 | 
					                mat = type;
 | 
				
			||||||
                xp = Config.getInstance().getHerbalismXPVines();
 | 
					                xp = Config.getInstance().getHerbalismXPVines();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case WATER_LILY:
 | 
					        case WATER_LILY:
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(block)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
                mat = type;
 | 
					                mat = type;
 | 
				
			||||||
                xp = Config.getInstance().getHerbalismXPLilyPads();
 | 
					                xp = Config.getInstance().getHerbalismXPLilyPads();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -316,7 +316,7 @@ public class Mining {
 | 
				
			|||||||
     * @param block The block being broken
 | 
					     * @param block The block being broken
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void miningBlockCheck(Player player, Block block) {
 | 
					    public static void miningBlockCheck(Player player, Block block) {
 | 
				
			||||||
        if (mcMMO.placeStore.isTrue(block)) {
 | 
					        if (mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -362,7 +362,7 @@ public class Mining {
 | 
				
			|||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (mcMMO.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) {
 | 
					            if (mcMMO.p.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -408,7 +408,7 @@ public class Mining {
 | 
				
			|||||||
            case NETHERRACK:
 | 
					            case NETHERRACK:
 | 
				
			||||||
            case SANDSTONE:
 | 
					            case SANDSTONE:
 | 
				
			||||||
            case STONE:
 | 
					            case STONE:
 | 
				
			||||||
                if (mcMMO.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) {
 | 
					                if (mcMMO.p.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) {
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -109,7 +109,7 @@ public class WoodCutting {
 | 
				
			|||||||
                        CustomBlock block = ModChecks.getCustomBlock(x);
 | 
					                        CustomBlock block = ModChecks.getCustomBlock(x);
 | 
				
			||||||
                        item = block.getItemDrop();
 | 
					                        item = block.getItemDrop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        if (!mcMMO.placeStore.isTrue(x)) {
 | 
					                        if (!mcMMO.p.placeStore.isTrue(x)) {
 | 
				
			||||||
                            WoodCutting.woodCuttingProcCheck(player, x);
 | 
					                            WoodCutting.woodCuttingProcCheck(player, x);
 | 
				
			||||||
                            xp = block.getXpGain();
 | 
					                            xp = block.getXpGain();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -169,7 +169,7 @@ public class WoodCutting {
 | 
				
			|||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (!mcMMO.placeStore.isTrue(x)) {
 | 
					                    if (!mcMMO.p.placeStore.isTrue(x)) {
 | 
				
			||||||
                        WoodCutting.woodCuttingProcCheck(player, x);
 | 
					                        WoodCutting.woodCuttingProcCheck(player, x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        switch (species) {
 | 
					                        switch (species) {
 | 
				
			||||||
@@ -245,7 +245,7 @@ public class WoodCutting {
 | 
				
			|||||||
        Block zNegative = currentBlock.getRelative(0, 0, -1);
 | 
					        Block zNegative = currentBlock.getRelative(0, 0, -1);
 | 
				
			||||||
        Block yPositive = currentBlock.getRelative(0, 1, 0);
 | 
					        Block yPositive = currentBlock.getRelative(0, 1, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!mcMMO.placeStore.isTrue(currentBlock)) {
 | 
					        if (!mcMMO.p.placeStore.isTrue(currentBlock)) {
 | 
				
			||||||
            if (!isTooAggressive(currentBlock, xPositive) && BlockChecks.treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive)) {
 | 
					            if (!isTooAggressive(currentBlock, xPositive) && BlockChecks.treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive)) {
 | 
				
			||||||
                processTreeFelling(xPositive, toBeFelled);
 | 
					                processTreeFelling(xPositive, toBeFelled);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -277,7 +277,7 @@ public class WoodCutting {
 | 
				
			|||||||
            Block corner3 = currentBlock.getRelative(-1, 0, 1);
 | 
					            Block corner3 = currentBlock.getRelative(-1, 0, 1);
 | 
				
			||||||
            Block corner4 = currentBlock.getRelative(-1, 0, -1);
 | 
					            Block corner4 = currentBlock.getRelative(-1, 0, -1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!mcMMO.placeStore.isTrue(currentBlock)) {
 | 
					            if (!mcMMO.p.placeStore.isTrue(currentBlock)) {
 | 
				
			||||||
                if (!isTooAggressive(currentBlock, corner1) && BlockChecks.treeFellerCompatible(corner1) && !toBeFelled.contains(corner1)) {
 | 
					                if (!isTooAggressive(currentBlock, corner1) && BlockChecks.treeFellerCompatible(corner1) && !toBeFelled.contains(corner1)) {
 | 
				
			||||||
                    processTreeFelling(corner1, toBeFelled);
 | 
					                    processTreeFelling(corner1, toBeFelled);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -297,7 +297,7 @@ public class WoodCutting {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (BlockChecks.treeFellerCompatible(yPositive)) {
 | 
					        if (BlockChecks.treeFellerCompatible(yPositive)) {
 | 
				
			||||||
            if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
 | 
					            if(!mcMMO.p.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
 | 
				
			||||||
                processTreeFelling(yPositive, toBeFelled);
 | 
					                processTreeFelling(yPositive, toBeFelled);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -421,7 +421,7 @@ public class WoodCutting {
 | 
				
			|||||||
        PlayerProfile profile = Users.getProfile(player);
 | 
					        PlayerProfile profile = Users.getProfile(player);
 | 
				
			||||||
        int xp = 0;
 | 
					        int xp = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (mcMMO.placeStore.isTrue(block)) {
 | 
					        if (mcMMO.p.placeStore.isTrue(block)) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -210,20 +210,22 @@ public class Repair {
 | 
				
			|||||||
     * @return The final amount of durability repaired to the item
 | 
					     * @return The final amount of durability repaired to the item
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
 | 
					    protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
 | 
				
			||||||
//        float bonus = (float) skillLevel / 500;
 | 
					        double  bonus;
 | 
				
			||||||
        float bonus;
 | 
					        if(skillLevel >= repairMasteryMaxBonusLevel) bonus = (double) repairMasteryChanceMax;
 | 
				
			||||||
        if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax;
 | 
					        else bonus = ((double) skillLevel / (double) repairMasteryMaxBonusLevel) * (double) repairMasteryChanceMax;
 | 
				
			||||||
        else bonus = ((float) skillLevel / (float) repairMasteryMaxBonusLevel) * (float) repairMasteryChanceMax;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (permInstance.repairMastery(player)) {
 | 
					        if (permInstance.repairMastery(player)) {
 | 
				
			||||||
            bonus = (repairAmount * bonus);
 | 
					            bonus = ((double) repairAmount * bonus);
 | 
				
			||||||
            repairAmount += bonus;
 | 
					            repairAmount += (int) bonus;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (checkPlayerProcRepair(player)) {
 | 
					        if (checkPlayerProcRepair(player)) {
 | 
				
			||||||
            repairAmount = (short) (repairAmount * 2);
 | 
					            repairAmount = (int) (repairAmount * 2D);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(repairAmount <= 0 || repairAmount > 32767)
 | 
				
			||||||
 | 
							repairAmount = 32767;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        durability -= repairAmount;
 | 
					        durability -= repairAmount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (durability < 0) {
 | 
					        if (durability < 0) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user