mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Remove duplicate checks.
This commit is contained in:
parent
60041a1253
commit
20f6a55df2
@ -8,13 +8,11 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
import org.getspout.spoutapi.sound.SoundEffect;
|
import org.getspout.spoutapi.sound.SoundEffect;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.TreasuresConfig;
|
import com.gmail.nossr50.config.TreasuresConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||||
@ -36,9 +34,6 @@ public class Excavation {
|
|||||||
* @param player The player who broke the block
|
* @param player The player who broke the block
|
||||||
*/
|
*/
|
||||||
public static void excavationProcCheck(Block block, Player player) {
|
public static void excavationProcCheck(Block block, Player player) {
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
Location location = block.getLocation();
|
Location location = block.getLocation();
|
||||||
|
|
||||||
@ -50,45 +45,38 @@ public class Excavation {
|
|||||||
|
|
||||||
int xp;
|
int xp;
|
||||||
|
|
||||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
switch (type) {
|
||||||
|
case CLAY:
|
||||||
|
xp = Config.getInstance().getExcavationClayXP();
|
||||||
|
break;
|
||||||
|
|
||||||
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
case DIRT:
|
||||||
xp = ModChecks.getCustomBlock(block).getXpGain();
|
xp = Config.getInstance().getExcavationDirtXP();
|
||||||
}
|
break;
|
||||||
else {
|
|
||||||
switch (type) {
|
|
||||||
case CLAY:
|
|
||||||
xp = Config.getInstance().getExcavationClayXP();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DIRT:
|
case GRASS:
|
||||||
xp = Config.getInstance().getExcavationDirtXP();
|
xp = Config.getInstance().getExcavationGrassXP();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRASS:
|
case GRAVEL:
|
||||||
xp = Config.getInstance().getExcavationGrassXP();
|
xp = Config.getInstance().getExcavationGravelXP();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRAVEL:
|
case MYCEL:
|
||||||
xp = Config.getInstance().getExcavationGravelXP();
|
xp = Config.getInstance().getExcavationMycelXP();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MYCEL:
|
case SAND:
|
||||||
xp = Config.getInstance().getExcavationMycelXP();
|
xp = Config.getInstance().getExcavationSandXP();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAND:
|
case SOUL_SAND:
|
||||||
xp = Config.getInstance().getExcavationSandXP();
|
xp = Config.getInstance().getExcavationSoulSandXP();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOUL_SAND:
|
default:
|
||||||
xp = Config.getInstance().getExcavationSoulSandXP();
|
xp = ModChecks.getCustomBlock(block).getXpGain();;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
xp = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.excavationTreasures(player)) {
|
if (Permissions.excavationTreasures(player)) {
|
||||||
@ -154,9 +142,6 @@ public class Excavation {
|
|||||||
* @param block The block to check
|
* @param block The block to check
|
||||||
*/
|
*/
|
||||||
public static void gigaDrillBreaker(Player player, Block block) {
|
public static void gigaDrillBreaker(Player player, Block block) {
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SkillTools.abilityDurabilityLoss(player.getItemInHand(), Misc.toolDurabilityLoss);
|
SkillTools.abilityDurabilityLoss(player.getItemInHand(), Misc.toolDurabilityLoss);
|
||||||
|
|
||||||
if (!mcMMO.placeStore.isTrue(block) && Misc.blockBreakSimulate(block, player, true)) {
|
if (!mcMMO.placeStore.isTrue(block) && Misc.blockBreakSimulate(block, player, true)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user