Introducing Block Cracker

This commit is contained in:
NuclearW 2013-02-14 00:34:50 -05:00
parent 7d826a0cdb
commit 9bd33ab3df
7 changed files with 59 additions and 8 deletions

View File

@ -31,6 +31,7 @@ Version 1.4.00-dev
+ Added the "wait" music disc to the default fishing treasures
+ Added "Chinese (Taiwan)" localization files (zh_TW)
+ Added '/hardcore' and '/vampirism' commands for toggling these modes on or off.
+ Added Block Cracker to Unarmed's Berserk, turn smooth brick into cracked smooth brick
= Fixed bug where splash potions could raise a player's unarmed level
= Fixed bug where fired arrows could raise skill levels other than Archery
= Fixed /ptp telporting the target to the player, rather than the other way around.

View File

@ -256,6 +256,9 @@ public class Config extends ConfigLoader {
public int getSmeltingXPLapis() { return config.getInt("Experience.Smelting.Lapis", 40); }
public int getSmeltingXPEmerald() { return config.getInt("Experience.Smelting.Emerald", 100); }
/* Unarmed */
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
/* Taming */
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }

View File

@ -35,6 +35,7 @@ import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.Salvage;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.skills.unarmed.Unarmed;
import com.gmail.nossr50.skills.utilities.AbilityType;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
@ -286,7 +287,7 @@ public class BlockListener implements Listener {
else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemChecks.isShovel(heldItem) && BlockChecks.canBeGigaDrillBroken(block) && Permissions.gigaDrillBreaker(player)) {
SkillTools.abilityCheck(player, SkillType.EXCAVATION);
}
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW) && Permissions.berserk(player)) {
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW || (block.getType() == Material.SMOOTH_BRICK && block.getData() == 0x0)) && Permissions.berserk(player)) {
SkillTools.abilityCheck(player, SkillType.UNARMED);
}
}
@ -344,16 +345,21 @@ public class BlockListener implements Listener {
Excavation.gigaDrillBreaker(mcMMOPlayer, block);
}
}
else if (profile.getAbilityMode(AbilityType.BERSERK) && SkillTools.triggerCheck(player, block, AbilityType.BERSERK)) {
else if (profile.getAbilityMode(AbilityType.BERSERK)) {
if (SkillTools.triggerCheck(player, block, AbilityType.BERSERK)) {
if (heldItem.getType() == Material.AIR) {
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
plugin.getServer().getPluginManager().callEvent(armswing);
event.setInstaBreak(true);
}
player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.POP_PITCH);
}
}
// Another perm check for the cracked blocks activation
else if (BlockChecks.canBeCracked(block) && player.hasPermission("mcmmo.ability.unarmed.blockcracker")) {
Unarmed.blockCracker(player, block);
}
}
else if (profile.getAbilityMode(AbilityType.SUPER_BREAKER) && SkillTools.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
MiningManager miningManager = new MiningManager(mcMMOPlayer);

View File

@ -1,7 +1,12 @@
package com.gmail.nossr50.skills.unarmed;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.Misc;
public class Unarmed {
public static int ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
@ -16,8 +21,27 @@ public class Unarmed {
public static double ironGripMaxChance = AdvancedConfig.getInstance().getIronGripChanceMax();
public static int ironGripMaxBonusLevel = AdvancedConfig.getInstance().getIronGripMaxBonusLevel();
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
public static boolean pvpEnabled = Config.getInstance().getUnarmedPVP();
public static boolean pveEnabled = Config.getInstance().getUnarmedPVE();
public static double berserkDamageModifier = 1.5;
public static void blockCracker(Player player, Block block) {
if (Misc.blockBreakSimulate(block, player, false)) {
Material type = block.getType();
switch (type) {
case SMOOTH_BRICK:
if (blockCrackerSmoothBrick && block.getData() == 0x0) {
block.setData((byte) 0x2);
}
return;
default:
return;
}
}
}
}

View File

@ -350,4 +350,16 @@ public final class BlockChecks {
return true;
}
}
public static boolean canBeCracked(Block block) {
switch(block.getType()) {
case SMOOTH_BRICK:
if (block.getData() == 0) {
return true;
}
default:
return false;
}
}
}

View File

@ -171,6 +171,8 @@ Skills:
Enabled_For_PVP: true
Enabled_For_PVE: true
Level_Cap: 0
Block_Cracker:
SmoothBrick_To_CrackedBrick: true
Woodcutting:
Level_Cap: 0
Requires_Axe: true

View File

@ -462,12 +462,15 @@ permissions:
description: Allows access to all Unarmed abilities
children:
mcmmo.ability.unarmed.berserk: true
mcmmo.ability.unarmed.blockcracker: true
mcmmo.ability.unarmed.bonusdamage: true
mcmmo.ability.unarmed.deflect: true
mcmmo.ability.unarmed.disarm: true
mcmmo.ability.unarmed.irongrip: true
mcmmo.ability.unarmed.berserk:
description: Allows access to the Berserker ability
mcmmo.ability.unarmed.blockcracker:
description: Allows access to the Block Cracker ability
mcmmo.ability.unarmed.bonusdamage:
description: Allows bonus damage from Unarmed
mcmmo.ability.unarmed.deflect: