mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Refactoring the oopsies
This commit is contained in:
parent
9731b9cffb
commit
acf2bf362f
@ -56,19 +56,19 @@ public class FishingCommand extends SkillCommand {
|
||||
lootTier = fishingManager.getLootTier();
|
||||
|
||||
// Item drop rates
|
||||
commonTreasure = percent.format(TreasureMainConfig.getInstance().getItemDropRate(lootTier, Rarity.COMMON) / 100.0);
|
||||
uncommonTreasure = percent.format(TreasureMainConfig.getInstance().getItemDropRate(lootTier, Rarity.UNCOMMON) / 100.0);
|
||||
rareTreasure = percent.format(TreasureMainConfig.getInstance().getItemDropRate(lootTier, Rarity.RARE) / 100.0);
|
||||
epicTreasure = percent.format(TreasureMainConfig.getInstance().getItemDropRate(lootTier, Rarity.EPIC) / 100.0);
|
||||
legendaryTreasure = percent.format(TreasureMainConfig.getInstance().getItemDropRate(lootTier, Rarity.LEGENDARY) / 100.0);
|
||||
recordTreasure = percent.format(TreasureMainConfig.getInstance().getItemDropRate(lootTier, Rarity.RECORD) / 100.0);
|
||||
commonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.COMMON) / 100.0);
|
||||
uncommonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.UNCOMMON) / 100.0);
|
||||
rareTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RARE) / 100.0);
|
||||
epicTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.EPIC) / 100.0);
|
||||
legendaryTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.LEGENDARY) / 100.0);
|
||||
recordTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RECORD) / 100.0);
|
||||
|
||||
// Magic hunter drop rates
|
||||
double totalEnchantChance = 0;
|
||||
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
if (rarity != Rarity.RECORD) {
|
||||
totalEnchantChance += TreasureMainConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
|
||||
totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class AlchemyPotion {
|
||||
if (!children.isEmpty()) {
|
||||
for (Entry<ItemStack, String> child : children.entrySet()) {
|
||||
if (ingredient.isSimilar(child.getKey())) {
|
||||
return PotionMainConfig.getInstance().getPotion(child.getValue());
|
||||
return PotionConfig.getInstance().getPotion(child.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
public void cleanupAbilityTools(Player player, McMMOPlayer mcMMOPlayer, BlockState blockState, ItemStack heldItem) {
|
||||
if (HiddenMainConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER))) {
|
||||
SkillUtils.removeAbilityBuff(heldItem);
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
|
||||
// Force the loading of config files
|
||||
TreasureMainConfig.getInstance();
|
||||
HiddenMainConfig.getInstance();
|
||||
TreasureConfig.getInstance();
|
||||
HiddenConfig.getInstance();
|
||||
AdvancedConfig.getInstance();
|
||||
PotionMainConfig.getInstance();
|
||||
PotionConfig.getInstance();
|
||||
CoreSkillsMainConfig.getInstance();
|
||||
SoundMainConfig.getInstance();
|
||||
SoundConfig.getInstance();
|
||||
RankConfig.getInstance();
|
||||
|
||||
new ChildConfig();
|
||||
|
@ -15,9 +15,9 @@ import java.util.logging.Level;
|
||||
|
||||
public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
private mcMMO plugin;
|
||||
private static final int MAX_LOOKUP = Math.max(HiddenMainConfig.getInstance().getUUIDConvertAmount(), 100);
|
||||
private static final int RATE_LIMIT = HiddenMainConfig.getInstance().getMojangRateLimit();
|
||||
private static final long LIMIT_PERIOD = HiddenMainConfig.getInstance().getMojangLimitPeriod();
|
||||
private static final int MAX_LOOKUP = Math.max(HiddenConfig.getInstance().getUUIDConvertAmount(), 100);
|
||||
private static final int RATE_LIMIT = HiddenConfig.getInstance().getMojangRateLimit();
|
||||
private static final long LIMIT_PERIOD = HiddenConfig.getInstance().getMojangLimitPeriod();
|
||||
private static final int BATCH_SIZE = MAX_LOOKUP * 3;
|
||||
|
||||
private List<String> userNames;
|
||||
|
@ -25,7 +25,7 @@ public class AlchemyManager extends SkillManager {
|
||||
}
|
||||
|
||||
public List<ItemStack> getIngredients() {
|
||||
return PotionMainConfig.getInstance().getIngredients(getTier());
|
||||
return PotionConfig.getInstance().getIngredients(getTier());
|
||||
}
|
||||
|
||||
public String getIngredientList() {
|
||||
|
@ -34,7 +34,7 @@ public final class AlchemyPotionBrewer {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getChildPotion(PotionMainConfig.getInstance().getPotion(contents[i]), contents[Alchemy.INGREDIENT_SLOT]) != null) {
|
||||
if (getChildPotion(PotionConfig.getInstance().getPotion(contents[i]), contents[Alchemy.INGREDIENT_SLOT]) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ public final class AlchemyPotionBrewer {
|
||||
}
|
||||
|
||||
private static List<ItemStack> getValidIngredients(Player player) {
|
||||
return PotionMainConfig.getInstance().getIngredients((player == null || !Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
|
||||
return PotionConfig.getInstance().getIngredients((player == null || !Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
|
||||
}
|
||||
|
||||
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
||||
@ -112,11 +112,11 @@ public final class AlchemyPotionBrewer {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ItemStack item = inventory.getItem(i);
|
||||
|
||||
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionMainConfig.getInstance().isValidPotion(item)) {
|
||||
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AlchemyPotion input = PotionMainConfig.getInstance().getPotion(item);
|
||||
AlchemyPotion input = PotionConfig.getInstance().getPotion(item);
|
||||
AlchemyPotion output = input.getChild(ingredient);
|
||||
|
||||
inputList.add(input);
|
||||
|
@ -18,8 +18,8 @@ public class Excavation {
|
||||
*/
|
||||
protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
|
||||
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
||||
if (TreasureMainConfig.getInstance().excavationMap.containsKey(friendly))
|
||||
return TreasureMainConfig.getInstance().excavationMap.get(friendly);
|
||||
if (TreasureConfig.getInstance().excavationMap.containsKey(friendly))
|
||||
return TreasureConfig.getInstance().excavationMap.get(friendly);
|
||||
return new ArrayList<ExcavationTreasure>();
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ public final class Fishing {
|
||||
* @return possibleDrops List of ItemStack that can be dropped
|
||||
*/
|
||||
protected static List<ShakeTreasure> findPossibleDrops(LivingEntity target) {
|
||||
if (TreasureMainConfig.getInstance().shakeMap.containsKey(target.getType()))
|
||||
return TreasureMainConfig.getInstance().shakeMap.get(target.getType());
|
||||
if (TreasureConfig.getInstance().shakeMap.containsKey(target.getType()))
|
||||
return TreasureConfig.getInstance().shakeMap.get(target.getType());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ public class FishingManager extends SkillManager {
|
||||
break;
|
||||
|
||||
case BEDROCK:
|
||||
if (TreasureMainConfig.getInstance().getInventoryStealEnabled()) {
|
||||
if (TreasureConfig.getInstance().getInventoryStealEnabled()) {
|
||||
PlayerInventory inventory = targetPlayer.getInventory();
|
||||
int length = inventory.getContents().length;
|
||||
int slot = Misc.getRandom().nextInt(length);
|
||||
@ -377,7 +377,7 @@ public class FishingManager extends SkillManager {
|
||||
break;
|
||||
}
|
||||
|
||||
if (TreasureMainConfig.getInstance().getInventoryStealStacks()) {
|
||||
if (TreasureConfig.getInstance().getInventoryStealStacks()) {
|
||||
inventory.setItem(slot, null);
|
||||
}
|
||||
else {
|
||||
@ -445,7 +445,7 @@ public class FishingManager extends SkillManager {
|
||||
FishingTreasure treasure = null;
|
||||
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
double dropRate = TreasureMainConfig.getInstance().getItemDropRate(getLootTier(), rarity);
|
||||
double dropRate = TreasureConfig.getInstance().getItemDropRate(getLootTier(), rarity);
|
||||
|
||||
if (diceRoll <= dropRate) {
|
||||
/*if (rarity == Rarity.TRAP) {
|
||||
@ -453,7 +453,7 @@ public class FishingManager extends SkillManager {
|
||||
break;
|
||||
}*/
|
||||
|
||||
List<FishingTreasure> fishingTreasures = TreasureMainConfig.getInstance().fishingRewards.get(rarity);
|
||||
List<FishingTreasure> fishingTreasures = TreasureConfig.getInstance().fishingRewards.get(rarity);
|
||||
|
||||
if (fishingTreasures.isEmpty()) {
|
||||
return null;
|
||||
@ -504,7 +504,7 @@ public class FishingManager extends SkillManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
double dropRate = TreasureMainConfig.getInstance().getEnchantmentDropRate(getLootTier(), rarity);
|
||||
double dropRate = TreasureConfig.getInstance().getEnchantmentDropRate(getLootTier(), rarity);
|
||||
|
||||
if (diceRoll <= dropRate) {
|
||||
// Make sure enchanted books always get some kind of enchantment. --hoorigan
|
||||
@ -512,7 +512,7 @@ public class FishingManager extends SkillManager {
|
||||
diceRoll = dropRate + 1;
|
||||
continue;
|
||||
}
|
||||
fishingEnchantments = TreasureMainConfig.getInstance().fishingEnchantments.get(rarity);
|
||||
fishingEnchantments = TreasureConfig.getInstance().fishingEnchantments.get(rarity);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -212,9 +212,9 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
||||
if (!TreasureMainConfig.getInstance().hylianMap.containsKey(friendly))
|
||||
if (!TreasureConfig.getInstance().hylianMap.containsKey(friendly))
|
||||
return false;
|
||||
List<HylianTreasure> treasures = TreasureMainConfig.getInstance().hylianMap.get(friendly);
|
||||
List<HylianTreasure> treasures = TreasureConfig.getInstance().hylianMap.get(friendly);
|
||||
|
||||
Player player = getPlayer();
|
||||
|
||||
|
@ -4,7 +4,7 @@ import com.gmail.nossr50.config.HiddenConfig;
|
||||
|
||||
public class ChunkletManagerFactory {
|
||||
public static ChunkletManager getChunkletManager() {
|
||||
HiddenConfig hConfig = HiddenMainConfig.getInstance();
|
||||
HiddenConfig hConfig = HiddenConfig.getInstance();
|
||||
|
||||
if (hConfig.getChunkletsEnabled()) {
|
||||
return new HashChunkletManager();
|
||||
|
@ -4,7 +4,7 @@ import com.gmail.nossr50.config.HiddenConfig;
|
||||
|
||||
public class ChunkManagerFactory {
|
||||
public static ChunkManager getChunkManager() {
|
||||
HiddenConfig hConfig = HiddenMainConfig.getInstance();
|
||||
HiddenConfig hConfig = HiddenConfig.getInstance();
|
||||
|
||||
if (hConfig.getChunkletsEnabled()) {
|
||||
return new HashChunkManager();
|
||||
|
@ -18,7 +18,7 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
this.world = world;
|
||||
this.scheduler = mcMMO.p.getServer().getScheduler();
|
||||
this.dataDir = new File(this.world.getWorldFolder(), "mcmmo_data");
|
||||
this.converters = new BlockStoreConversionXDirectory[HiddenMainConfig.getInstance().getConversionRate()];
|
||||
this.converters = new BlockStoreConversionXDirectory[HiddenConfig.getInstance().getConversionRate()];
|
||||
}
|
||||
|
||||
public void start() {
|
||||
@ -51,7 +51,7 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
|
||||
this.xDirs = this.dataDir.listFiles();
|
||||
|
||||
for (this.i = 0; (this.i < HiddenMainConfig.getInstance().getConversionRate()) && (this.i < this.xDirs.length); this.i++) {
|
||||
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.xDirs.length); this.i++) {
|
||||
if (this.converters[this.i] == null) {
|
||||
this.converters[this.i] = new BlockStoreConversionXDirectory();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
public void start(org.bukkit.World world, File dataDir) {
|
||||
this.world = world;
|
||||
this.scheduler = mcMMO.p.getServer().getScheduler();
|
||||
this.converters = new BlockStoreConversionZDirectory[HiddenMainConfig.getInstance().getConversionRate()];
|
||||
this.converters = new BlockStoreConversionZDirectory[HiddenConfig.getInstance().getConversionRate()];
|
||||
this.dataDir = dataDir;
|
||||
|
||||
if (this.taskID >= 0) {
|
||||
@ -52,7 +52,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
|
||||
this.zDirs = this.dataDir.listFiles();
|
||||
|
||||
for (this.i = 0; (this.i < HiddenMainConfig.getInstance().getConversionRate()) && (this.i < this.zDirs.length); this.i++) {
|
||||
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.zDirs.length); this.i++) {
|
||||
if (this.converters[this.i] == null) {
|
||||
this.converters[this.i] = new BlockStoreConversionZDirectory();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class SkillUtils {
|
||||
}
|
||||
|
||||
public static void handleAbilitySpeedIncrease(Player player) {
|
||||
if (HiddenMainConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (heldItem == null || heldItem.getType() == Material.AIR) {
|
||||
@ -187,7 +187,7 @@ public class SkillUtils {
|
||||
}
|
||||
|
||||
public static void handleAbilitySpeedDecrease(Player player) {
|
||||
if (!HiddenMainConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if (!HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -14,13 +14,13 @@ public class SoundManager {
|
||||
*/
|
||||
public static void sendSound(Player player, Location location, SoundType soundType)
|
||||
{
|
||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory)
|
||||
{
|
||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
@ -28,13 +28,13 @@ public class SoundManager {
|
||||
{
|
||||
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
||||
|
||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
||||
}
|
||||
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType)
|
||||
{
|
||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class SoundManager {
|
||||
*/
|
||||
private static float getVolume(SoundType soundType)
|
||||
{
|
||||
return SoundMainConfig.getInstance().getVolume(soundType) * SoundMainConfig.getInstance().getMasterVolume();
|
||||
return SoundConfig.getInstance().getVolume(soundType) * SoundConfig.getInstance().getMasterVolume();
|
||||
}
|
||||
|
||||
private static float getPitch(SoundType soundType)
|
||||
@ -55,7 +55,7 @@ public class SoundManager {
|
||||
else if (soundType == SoundType.POP)
|
||||
return getPopPitch();
|
||||
else
|
||||
return SoundMainConfig.getInstance().getPitch(soundType);
|
||||
return SoundConfig.getInstance().getPitch(soundType);
|
||||
}
|
||||
|
||||
private static Sound getSound(SoundType soundType)
|
||||
|
Loading…
Reference in New Issue
Block a user