Don't break on double drops for woodcutting.

This commit is contained in:
t00thpick1 2018-07-30 20:44:10 -04:00
parent f287b6d8a7
commit fecf83c79c
2 changed files with 10 additions and 15 deletions

View File

@ -1,20 +1,19 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.EntityType;
import com.gmail.nossr50.database.SQLDatabaseManager.PoolIdentifier; import com.gmail.nossr50.database.SQLDatabaseManager.PoolIdentifier;
import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.EntityType;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class Config extends AutoUpdateConfigLoader { public class Config extends AutoUpdateConfigLoader {
private static Config instance; private static Config instance;
@ -518,7 +517,7 @@ public class Config extends AutoUpdateConfigLoader {
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); } public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
/* Woodcutting */ /* Woodcutting */
public boolean getWoodcuttingDoubleDropsEnabled(TreeSpecies species) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); } public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getFriendlyConfigBlockDataString(material)); }
public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); } public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); }
/* AFK Leveling */ /* AFK Leveling */

View File

@ -9,11 +9,9 @@ import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Tree;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -57,9 +55,7 @@ public final class Woodcutting {
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops()); Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
} }
else { else {
TreeSpecies species = new Tree(blockState.getType()).getSpecies(); if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(blockState.getBlockData())) {
if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(species)) {
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops()); Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
} }
} }