mcMMO should work on both 1.13 and 1.14 now

This commit is contained in:
nossr50 2019-04-23 08:20:00 -07:00
parent b36c4b56c3
commit c07a29ba86
7 changed files with 435 additions and 355 deletions

View File

@ -1,24 +1,21 @@
Version 2.1.48 Version 2.1.48
(1.14 Only)
1.14 Support 1.14 Support
Added Cats, Foxes, and Pandas to Taming XP rewards Added Cats, Foxes, and Pandas to Taming XP rewards
Added Cats, Foxes, Pandas, Trader Llamas, Pillagers, and Ravagers to Combat XP rewards Added Cats, Foxes, Pandas, Trader Llamas, Pillagers, and Ravagers to Combat XP rewards
"Experience" section of experience.yml has been renamed to "Experience_114" "Experience" section of experience.yml has been renamed to "Experience_Values"
Dodge now gives 800 XP Dodge now gives 800 XP
Roll now gives 600 XP Roll now gives 600 XP
Fall now gives 600 XP Fall now gives 600 XP
The first 5/50 levels of skills now give large amounts of XP so players get key early skills much faster The first 5/50 levels of skills now give large amounts of XP so players get key early skills much faster
Note: First 50 in Standard, first 50 in Retro Note: First 5 in Standard, first 50 in Retro
Dev Notes: Dev Notes:
I will be making a write up soon explaining near future plans for mcMMO and what is going on with the config update, abstraction update, etc... I will be making a write up soon explaining near future plans for mcMMO and what is going on with the config update, abstraction update, etc...
Due to some changes in 1.14, you will not be able to play the 1.14 version of mcMMO on a 1.13 server Currently this version of mcMMO will work on both 1.13 and 1.14, in the abstraction update I will expand compatible versions of mcMMO to include: 1.14 / 1.13.2 / 1.12.2 / 1.8.8 / Sponge 1.14
I plan to support 1.13 for the time being, in the abstraction update I will expand compatible versions of mcMMO to include: 1.14 / 1.13.2 / 1.12.2 / 1.8.8 / Sponge 1.14
It is not necessary to update your configs if you are upgrading from 1.13 -> 1.14, however if you had custom XP values in your experience.yml you will want to update your config. It is not necessary to update your configs if you are upgrading from 1.13 -> 1.14, however if you had custom XP values in your experience.yml you will want to update your config.
Acrobatics XP was buffed since many AFK counter-measures were put into place to prevent repetitive grinding. Acrobatics XP was buffed since many AFK counter-measures were put into place to prevent repetitive grinding.
Experience node in experience.yml was renamed to "automatically" update configs for 1.14 Experience node in experience.yml was renamed to "automatically" update configs for the new stuff 1.14
There are 4 updates planned for mcMMO, including a patreon rewards update, a large content update, a config update, and backwards compatibility for 1.13/1.12/1.8.8 and support for Sponge There are 4 updates planned for mcMMO, including a patreon rewards update, a large content update, a config update, and backwards compatibility for 1.13/1.12/1.8.8 and support for Sponge
Version 2.1.47 Version 2.1.47

View File

@ -87,18 +87,18 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
/* Alchemy */ /* Alchemy */
for (PotionStage potionStage : PotionStage.values()) { for (PotionStage potionStage : PotionStage.values()) {
if (getPotionXP(potionStage) < 0) { if (getPotionXP(potionStage) < 0) {
reason.add("Experience_114.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!"); reason.add("Experience_Values.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!");
} }
} }
/* Archery */ /* Archery */
if (getArcheryDistanceMultiplier() < 0) { if (getArcheryDistanceMultiplier() < 0) {
reason.add("Experience_114.Archery.Distance_Multiplier should be at least 0!"); reason.add("Experience_Values.Archery.Distance_Multiplier should be at least 0!");
} }
/* Combat XP Multipliers */ /* Combat XP Multipliers */
if (getAnimalsXP() < 0) { if (getAnimalsXP() < 0) {
reason.add("Experience_114.Combat.Multiplier.Animals should be at least 0!"); reason.add("Experience_Values.Combat.Multiplier.Animals should be at least 0!");
} }
if (getDodgeXPModifier() < 0) { if (getDodgeXPModifier() < 0) {
@ -117,21 +117,21 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
// TODO: Add validation for each fish type once enum is available. // TODO: Add validation for each fish type once enum is available.
if (getFishingShakeXP() <= 0) { if (getFishingShakeXP() <= 0) {
reason.add("Experience_114.Fishing.Shake should be greater than 0!"); reason.add("Experience_Values.Fishing.Shake should be greater than 0!");
} }
/* Repair */ /* Repair */
if (getRepairXPBase() <= 0) { if (getRepairXPBase() <= 0) {
reason.add("Experience_114.Repair.Base should be greater than 0!"); reason.add("Experience_Values.Repair.Base should be greater than 0!");
} }
/* Taming */ /* Taming */
if (getTamingXP(EntityType.WOLF) <= 0) { if (getTamingXP(EntityType.WOLF) <= 0) {
reason.add("Experience_114.Taming.Animal_Taming.Wolf should be greater than 0!"); reason.add("Experience_Values.Taming.Animal_Taming.Wolf should be greater than 0!");
} }
if (getTamingXP(EntityType.OCELOT) <= 0) { if (getTamingXP(EntityType.OCELOT) <= 0) {
reason.add("Experience_114.Taming.Animal_Taming.Ocelot should be greater than 0!"); reason.add("Experience_Values.Taming.Animal_Taming.Ocelot should be greater than 0!");
} }
return noErrorsInConfig(reason); return noErrorsInConfig(reason);
@ -188,18 +188,18 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
*/ */
/* General Settings */ /* General Settings */
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience_114.PVP.Rewards", true); } public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience_Values.PVP.Rewards", true); }
/* Combat XP Multipliers */ /* Combat XP Multipliers */
public double getCombatXP(EntityType entity) { return config.getDouble("Experience_114.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); } public double getCombatXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience_114.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); } public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
public double getAnimalsXP() { return config.getDouble("Experience_114.Combat.Multiplier.Animals", 1.0); } public double getAnimalsXP() { return config.getDouble("Experience_Values.Combat.Multiplier.Animals", 1.0); }
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience_114.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); } public boolean hasCombatXP(EntityType entity) {return config.contains("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
/* Materials */ /* Materials */
public int getXp(PrimarySkillType skill, Material data) public int getXp(PrimarySkillType skill, Material data)
{ {
String baseString = "Experience_114." + StringUtils.getCapitalized(skill.toString()) + "."; String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data); String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
if (config.contains(explicitString)) if (config.contains(explicitString))
return config.getInt(explicitString); return config.getInt(explicitString);
@ -215,7 +215,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
/* Materials */ /* Materials */
public int getXp(PrimarySkillType skill, BlockData data) public int getXp(PrimarySkillType skill, BlockData data)
{ {
String baseString = "Experience_114." + StringUtils.getCapitalized(skill.toString()) + "."; String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
if (config.contains(explicitString)) if (config.contains(explicitString))
return config.getInt(explicitString); return config.getInt(explicitString);
@ -230,7 +230,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data) public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data)
{ {
String baseString = "Experience_114." + StringUtils.getCapitalized(skill.toString()) + "."; String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data); String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
if (config.contains(explicitString)) if (config.contains(explicitString))
return true; return true;
@ -243,7 +243,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data) public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data)
{ {
String baseString = "Experience_114." + StringUtils.getCapitalized(skill.toString()) + "."; String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data); String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
if (config.contains(explicitString)) if (config.contains(explicitString))
return true; return true;
@ -306,27 +306,27 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
} }
/* Acrobatics */ /* Acrobatics */
public int getDodgeXPModifier() { return config.getInt("Experience_114.Acrobatics.Dodge", 120); } public int getDodgeXPModifier() { return config.getInt("Experience_Values.Acrobatics.Dodge", 120); }
public int getRollXPModifier() { return config.getInt("Experience_114.Acrobatics.Roll", 80); } public int getRollXPModifier() { return config.getInt("Experience_Values.Acrobatics.Roll", 80); }
public int getFallXPModifier() { return config.getInt("Experience_114.Acrobatics.Fall", 120); } public int getFallXPModifier() { return config.getInt("Experience_Values.Acrobatics.Fall", 120); }
public double getFeatherFallXPModifier() { return config.getDouble("Experience_114.Acrobatics.FeatherFall_Multiplier", 2.0); } public double getFeatherFallXPModifier() { return config.getDouble("Experience_Values.Acrobatics.FeatherFall_Multiplier", 2.0); }
/* Alchemy */ /* Alchemy */
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience_114.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); } public double getPotionXP(PotionStage stage) { return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
/* Archery */ /* Archery */
public double getArcheryDistanceMultiplier() { return config.getDouble("Experience_114.Archery.Distance_Multiplier", 0.025); } public double getArcheryDistanceMultiplier() { return config.getDouble("Experience_Values.Archery.Distance_Multiplier", 0.025); }
public int getFishingShakeXP() { return config.getInt("Experience_114.Fishing.Shake", 50); } public int getFishingShakeXP() { return config.getInt("Experience_Values.Fishing.Shake", 50); }
/* Repair */ /* Repair */
public double getRepairXPBase() { return config.getDouble("Experience_114.Repair.Base", 1000.0); } public double getRepairXPBase() { return config.getDouble("Experience_Values.Repair.Base", 1000.0); }
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience_114.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); } public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience_Values.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
/* Taming */ /* Taming */
public int getTamingXP(EntityType type) public int getTamingXP(EntityType type)
{ {
return config.getInt("Experience_114.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type)); return config.getInt("Experience_Values.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
} }
} }

View File

@ -72,6 +72,7 @@ public class mcMMO extends JavaPlugin {
private static FormulaManager formulaManager; private static FormulaManager formulaManager;
private static HolidayManager holidayManager; private static HolidayManager holidayManager;
private static UpgradeManager upgradeManager; private static UpgradeManager upgradeManager;
private static MaterialMapStore materialMapStore;
/* Blacklist */ /* Blacklist */
private static WorldBlacklist worldBlacklist; private static WorldBlacklist worldBlacklist;
@ -243,10 +244,17 @@ public class mcMMO extends JavaPlugin {
getServer().getPluginManager().disablePlugin(this); getServer().getPluginManager().disablePlugin(this);
} }
//Init Material Maps
materialMapStore = new MaterialMapStore();
//Init the blacklist //Init the blacklist
worldBlacklist = new WorldBlacklist(this); worldBlacklist = new WorldBlacklist(this);
} }
public static MaterialMapStore getMaterialMapStore() {
return materialMapStore;
}
private void checkForOutdatedAPI() { private void checkForOutdatedAPI() {
try { try {
Class<?> checkForClass = Class.forName("org.bukkit.event.block.BlockDropItemEvent"); Class<?> checkForClass = Class.forName("org.bukkit.event.block.BlockDropItemEvent");

View File

@ -19,15 +19,16 @@ import java.util.HashSet;
public final class BlockUtils { public final class BlockUtils {
private BlockUtils() {} private BlockUtils() {
}
/** /**
* Mark a block for giving bonus drops, double drops are used if triple is false * Mark a block for giving bonus drops, double drops are used if triple is false
*
* @param blockState target blockstate * @param blockState target blockstate
* @param triple marks the block to give triple drops * @param triple marks the block to give triple drops
*/ */
public static void markDropsAsBonus(BlockState blockState, boolean triple) public static void markDropsAsBonus(BlockState blockState, boolean triple) {
{
if (triple) if (triple)
blockState.setMetadata(mcMMO.tripleDrops, mcMMO.metadataValue); blockState.setMetadata(mcMMO.tripleDrops, mcMMO.metadataValue);
else else
@ -36,13 +37,12 @@ public final class BlockUtils {
/** /**
* Checks if a player successfully passed the double drop check * Checks if a player successfully passed the double drop check
*
* @param blockState the blockstate * @param blockState the blockstate
* @return true if the player succeeded in the check * @return true if the player succeeded in the check
*/ */
public static boolean checkDoubleDrops(Player player, BlockState blockState, PrimarySkillType skillType, SubSkillType subSkillType) public static boolean checkDoubleDrops(Player player, BlockState blockState, PrimarySkillType skillType, SubSkillType subSkillType) {
{ if (Config.getInstance().getDoubleDropsEnabled(skillType, blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
if(Config.getInstance().getDoubleDropsEnabled(skillType, blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType))
{
return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true)); return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
} }
@ -52,8 +52,7 @@ public final class BlockUtils {
/** /**
* Checks to see if a given block awards XP. * Checks to see if a given block awards XP.
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block awards XP, false otherwise * @return true if the block awards XP, false otherwise
*/ */
public static boolean shouldBeWatched(BlockState blockState) { public static boolean shouldBeWatched(BlockState blockState) {
@ -63,245 +62,30 @@ public final class BlockUtils {
/** /**
* Check if a given block should allow for the activation of abilities * Check if a given block should allow for the activation of abilities
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block should allow ability activation, false * @return true if the block should allow ability activation, false
* otherwise * otherwise
*/ */
public static boolean canActivateAbilities(BlockState blockState) { public static boolean canActivateAbilities(BlockState blockState) {
switch (blockState.getType()) { return !mcMMO.getMaterialMapStore().isAbilityActivationBlackListed(blockState.getType());
case BLACK_BED:
case BLUE_BED:
case BROWN_BED:
case CYAN_BED:
case GRAY_BED:
case GREEN_BED:
case LIGHT_BLUE_BED:
case LIGHT_GRAY_BED:
case LIME_BED:
case MAGENTA_BED:
case ORANGE_BED:
case PINK_BED:
case PURPLE_BED:
case RED_BED:
case WHITE_BED:
case YELLOW_BED:
case BREWING_STAND :
case BOOKSHELF :
case CAKE:
case CHEST :
case DISPENSER :
case ENCHANTING_TABLE:
case ENDER_CHEST :
case OAK_FENCE_GATE:
case ACACIA_FENCE_GATE :
case DARK_OAK_FENCE_GATE :
case SPRUCE_FENCE_GATE :
case BIRCH_FENCE_GATE :
case JUNGLE_FENCE_GATE :
case FURNACE :
case JUKEBOX :
case LEVER :
case NOTE_BLOCK :
case STONE_BUTTON :
case OAK_BUTTON:
case BIRCH_BUTTON:
case ACACIA_BUTTON:
case DARK_OAK_BUTTON:
case JUNGLE_BUTTON:
case SPRUCE_BUTTON:
case ACACIA_TRAPDOOR:
case BIRCH_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case OAK_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case ACACIA_SIGN:
case ACACIA_WALL_SIGN:
case BIRCH_SIGN:
case BIRCH_WALL_SIGN:
case DARK_OAK_SIGN:
case DARK_OAK_WALL_SIGN:
case JUNGLE_SIGN:
case JUNGLE_WALL_SIGN:
case SPRUCE_SIGN:
case SPRUCE_WALL_SIGN:
case OAK_SIGN:
case OAK_WALL_SIGN:
case CRAFTING_TABLE:
case BEACON :
case ANVIL :
case DROPPER :
case HOPPER :
case TRAPPED_CHEST :
case IRON_DOOR :
case IRON_TRAPDOOR :
case OAK_DOOR:
case ACACIA_DOOR :
case SPRUCE_DOOR :
case BIRCH_DOOR :
case JUNGLE_DOOR :
case DARK_OAK_DOOR :
case OAK_FENCE:
case ACACIA_FENCE :
case DARK_OAK_FENCE :
case BIRCH_FENCE :
case JUNGLE_FENCE :
case SPRUCE_FENCE :
case ARMOR_STAND :
case BLACK_SHULKER_BOX :
case BLUE_SHULKER_BOX :
case BROWN_SHULKER_BOX :
case CYAN_SHULKER_BOX :
case GRAY_SHULKER_BOX :
case GREEN_SHULKER_BOX :
case LIGHT_BLUE_SHULKER_BOX :
case LIME_SHULKER_BOX :
case MAGENTA_SHULKER_BOX :
case ORANGE_SHULKER_BOX :
case PINK_SHULKER_BOX :
case PURPLE_SHULKER_BOX :
case RED_SHULKER_BOX :
case LIGHT_GRAY_SHULKER_BOX:
case WHITE_SHULKER_BOX :
case YELLOW_SHULKER_BOX :
return false;
default :
return !isMcMMOAnvil(blockState) && !mcMMO.getModManager().isCustomAbilityBlock(blockState);
}
} }
/** /**
* Check if a given block should allow for the activation of tools * Check if a given block should allow for the activation of tools
* Activating a tool is step 1 of a 2 step process for super ability activation * Activating a tool is step 1 of a 2 step process for super ability activation
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block should allow ability activation, false * @return true if the block should allow ability activation, false
* otherwise * otherwise
*/ */
public static boolean canActivateTools(BlockState blockState) { public static boolean canActivateTools(BlockState blockState) {
switch (blockState.getType()) { return !mcMMO.getMaterialMapStore().isToolActivationBlackListed(blockState.getType());
case BLACK_BED:
case BLUE_BED:
case BROWN_BED:
case CYAN_BED:
case GRAY_BED:
case GREEN_BED:
case LIGHT_BLUE_BED:
case LIGHT_GRAY_BED:
case LIME_BED:
case MAGENTA_BED:
case ORANGE_BED:
case PINK_BED:
case PURPLE_BED:
case RED_BED:
case WHITE_BED:
case YELLOW_BED:
case BREWING_STAND :
case BOOKSHELF :
case CAKE:
case CHEST :
case DISPENSER :
case ENCHANTING_TABLE:
case ENDER_CHEST :
case OAK_FENCE_GATE:
case ACACIA_FENCE_GATE :
case DARK_OAK_FENCE_GATE :
case SPRUCE_FENCE_GATE :
case BIRCH_FENCE_GATE :
case JUNGLE_FENCE_GATE :
case FURNACE :
case JUKEBOX :
case LEVER :
case NOTE_BLOCK :
case STONE_BUTTON :
case OAK_BUTTON:
case BIRCH_BUTTON:
case ACACIA_BUTTON:
case DARK_OAK_BUTTON:
case JUNGLE_BUTTON:
case SPRUCE_BUTTON:
case ACACIA_TRAPDOOR:
case BIRCH_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case OAK_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case CRAFTING_TABLE:
case BEACON :
case ANVIL :
case DROPPER :
case HOPPER :
case TRAPPED_CHEST :
case IRON_DOOR :
case IRON_TRAPDOOR :
case OAK_DOOR:
case ACACIA_DOOR :
case SPRUCE_DOOR :
case BIRCH_DOOR :
case JUNGLE_DOOR :
case DARK_OAK_DOOR :
case OAK_FENCE:
case ACACIA_FENCE :
case DARK_OAK_FENCE :
case BIRCH_FENCE :
case JUNGLE_FENCE :
case SPRUCE_FENCE :
case ARMOR_STAND :
case BLACK_SHULKER_BOX :
case BLUE_SHULKER_BOX :
case BROWN_SHULKER_BOX :
case CYAN_SHULKER_BOX :
case GRAY_SHULKER_BOX :
case GREEN_SHULKER_BOX :
case LIGHT_BLUE_SHULKER_BOX :
case LIME_SHULKER_BOX :
case MAGENTA_SHULKER_BOX :
case ORANGE_SHULKER_BOX :
case PINK_SHULKER_BOX :
case PURPLE_SHULKER_BOX :
case RED_SHULKER_BOX :
case LIGHT_GRAY_SHULKER_BOX:
case WHITE_SHULKER_BOX :
case YELLOW_SHULKER_BOX :
case STRIPPED_ACACIA_LOG:
case STRIPPED_ACACIA_WOOD:
case STRIPPED_BIRCH_LOG:
case STRIPPED_BIRCH_WOOD:
case STRIPPED_DARK_OAK_LOG:
case STRIPPED_DARK_OAK_WOOD:
case STRIPPED_JUNGLE_LOG:
case STRIPPED_JUNGLE_WOOD:
case STRIPPED_OAK_LOG:
case STRIPPED_OAK_WOOD:
case STRIPPED_SPRUCE_LOG:
case STRIPPED_SPRUCE_WOOD:
case ACACIA_LOG:
case ACACIA_WOOD:
case BIRCH_LOG:
case BIRCH_WOOD:
case DARK_OAK_LOG:
case DARK_OAK_WOOD:
case JUNGLE_LOG:
case JUNGLE_WOOD:
case OAK_LOG:
case OAK_WOOD:
case SPRUCE_LOG:
case SPRUCE_WOOD:
return false;
default :
return !isMcMMOAnvil(blockState) && !mcMMO.getModManager().isCustomAbilityBlock(blockState);
}
} }
/** /**
* Check if a given block is an ore * Check if a given block is an ore
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block is an ore, false otherwise * @return true if the block is an ore, false otherwise
*/ */
public static boolean isOre(BlockState blockState) { public static boolean isOre(BlockState blockState) {
@ -311,33 +95,17 @@ public final class BlockUtils {
/** /**
* Determine if a given block can be made mossy * Determine if a given block can be made mossy
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block can be made mossy, false otherwise * @return true if the block can be made mossy, false otherwise
*/ */
public static boolean canMakeMossy(BlockState blockState) { public static boolean canMakeMossy(BlockState blockState) {
switch (blockState.getType()) { return mcMMO.getMaterialMapStore().isMossyWhiteListed(blockState.getType());
case COBBLESTONE :
case DIRT :
case GRASS_PATH :
return true;
case STONE_BRICKS:
return true;
case COBBLESTONE_WALL:
return true;
default :
return false;
}
} }
/** /**
* Determine if a given block should be affected by Green Terra * Determine if a given block should be affected by Green Terra
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block should affected by Green Terra, false otherwise * @return true if the block should affected by Green Terra, false otherwise
*/ */
public static boolean affectedByGreenTerra(BlockState blockState) { public static boolean affectedByGreenTerra(BlockState blockState) {
@ -351,8 +119,7 @@ public final class BlockUtils {
/** /**
* Determine if a given block should be affected by Super Breaker * Determine if a given block should be affected by Super Breaker
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block should affected by Super Breaker, false * @return true if the block should affected by Super Breaker, false
* otherwise * otherwise
*/ */
@ -366,8 +133,7 @@ public final class BlockUtils {
/** /**
* Determine if a given block should be affected by Giga Drill Breaker * Determine if a given block should be affected by Giga Drill Breaker
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block should affected by Giga Drill Breaker, false * @return true if the block should affected by Giga Drill Breaker, false
* otherwise * otherwise
*/ */
@ -380,8 +146,7 @@ public final class BlockUtils {
/** /**
* Check if a given block is a log * Check if a given block is a log
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block is a log, false otherwise * @return true if the block is a log, false otherwise
*/ */
public static boolean isLog(BlockState blockState) { public static boolean isLog(BlockState blockState) {
@ -393,30 +158,17 @@ public final class BlockUtils {
/** /**
* Check if a given block is a leaf * Check if a given block is a leaf
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block is a leaf, false otherwise * @return true if the block is a leaf, false otherwise
*/ */
public static boolean isLeaves(BlockState blockState) { public static boolean isLeaves(BlockState blockState) {
switch (blockState.getType()) { return mcMMO.getMaterialMapStore().isLeavesWhiteListed(blockState.getType());
case OAK_LEAVES:
case ACACIA_LEAVES:
case BIRCH_LEAVES:
case DARK_OAK_LEAVES:
case JUNGLE_LEAVES:
case SPRUCE_LEAVES:
return true;
default :
return mcMMO.getModManager().isCustomLeaf(blockState);
}
} }
/** /**
* Determine if a given block should be affected by Flux Mining * Determine if a given block should be affected by Flux Mining
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block should affected by Flux Mining, false otherwise * @return true if the block should affected by Flux Mining, false otherwise
*/ */
public static boolean affectedByFluxMining(BlockState blockState) { public static boolean affectedByFluxMining(BlockState blockState) {
@ -433,66 +185,39 @@ public final class BlockUtils {
/** /**
* Determine if a given block can activate Herbalism abilities * Determine if a given block can activate Herbalism abilities
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block can be activate Herbalism abilities, false * @return true if the block can be activate Herbalism abilities, false
* otherwise * otherwise
*/ */
public static boolean canActivateHerbalism(BlockState blockState) { public static boolean canActivateHerbalism(BlockState blockState) {
switch (blockState.getType()) { return mcMMO.getMaterialMapStore().isHerbalismAbilityWhiteListed(blockState.getType());
case DIRT :
case GRASS :
case GRASS_PATH :
case FARMLAND:
return false;
default :
return true;
}
} }
/** /**
* Determine if a given block should be affected by Block Cracker * Determine if a given block should be affected by Block Cracker
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block should affected by Block Cracker, false * @return true if the block should affected by Block Cracker, false
* otherwise * otherwise
*/ */
public static boolean affectedByBlockCracker(BlockState blockState) { public static boolean affectedByBlockCracker(BlockState blockState) {
switch (blockState.getType()) { return mcMMO.getMaterialMapStore().isBlockCrackerWhiteListed(blockState.getType());
case STONE_BRICKS:
return true;
default :
return false;
}
} }
/** /**
* Determine if a given block can be made into Mycelium * Determine if a given block can be made into Mycelium
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block can be made into Mycelium, false otherwise * @return true if the block can be made into Mycelium, false otherwise
*/ */
public static boolean canMakeShroomy(BlockState blockState) { public static boolean canMakeShroomy(BlockState blockState) {
switch (blockState.getType()) { return mcMMO.getMaterialMapStore().isShroomyWhiteListed(blockState.getType());
case DIRT :
case GRASS :
case GRASS_PATH :
return true;
default :
return false;
}
} }
/** /**
* Determine if a given block is an mcMMO anvil * Determine if a given block is an mcMMO anvil
* *
* @param blockState * @param blockState The {@link BlockState} of the block to check
* The {@link BlockState} of the block to check
* @return true if the block is an mcMMO anvil, false otherwise * @return true if the block is an mcMMO anvil, false otherwise
*/ */
public static boolean isMcMMOAnvil(BlockState blockState) { public static boolean isMcMMOAnvil(BlockState blockState) {
@ -528,8 +253,7 @@ public final class BlockUtils {
BlockData data = blockState.getBlockData(); BlockData data = blockState.getBlockData();
if (data.getMaterial() == Material.CACTUS || data.getMaterial() == Material.SUGAR_CANE) if (data.getMaterial() == Material.CACTUS || data.getMaterial() == Material.SUGAR_CANE)
return true; return true;
if (data instanceof Ageable) if (data instanceof Ageable) {
{
Ageable ageable = (Ageable) data; Ageable ageable = (Ageable) data;
return ageable.getAge() == ageable.getMaximumAge(); return ageable.getAge() == ageable.getMaximumAge();
} }

View File

@ -0,0 +1,351 @@
package com.gmail.nossr50.util;
import org.bukkit.Material;
import java.util.HashSet;
/**
* Stores hash tables for item and block names
* This allows for better support across multiple versions of Minecraft
*
* This is a temporary class, mcMMO is spaghetti and I'l clean it up later
*
*/
public class MaterialMapStore {
private HashSet<String> abilityBlackList;
private HashSet<String> toolBlackList;
private HashSet<String> mossyWhiteList;
private HashSet<String> leavesWhiteList;
private HashSet<String> herbalismAbilityBlackList;
private HashSet<String> blockCrackerWhiteList;
private HashSet<String> canMakeShroomyWhiteList;
public MaterialMapStore()
{
abilityBlackList = new HashSet<>();
toolBlackList = new HashSet<>();
mossyWhiteList = new HashSet<>();
leavesWhiteList = new HashSet<>();
herbalismAbilityBlackList = new HashSet<>();
blockCrackerWhiteList = new HashSet<>();
canMakeShroomyWhiteList = new HashSet<>();
fillHardcodedHashSets();
}
public boolean isAbilityActivationBlackListed(Material material)
{
return abilityBlackList.contains(material.getKey().getKey());
}
public boolean isToolActivationBlackListed(Material material)
{
return toolBlackList.contains(material.getKey().getKey());
}
public boolean isMossyWhiteListed(Material material)
{
return mossyWhiteList.contains(material.getKey().getKey());
}
public boolean isLeavesWhiteListed(Material material)
{
return leavesWhiteList.contains(material.getKey().getKey());
}
public boolean isHerbalismAbilityWhiteListed(Material material)
{
return herbalismAbilityBlackList.contains(material.getKey().getKey());
}
public boolean isBlockCrackerWhiteListed(Material material)
{
return blockCrackerWhiteList.contains(material.getKey().getKey());
}
public boolean isShroomyWhiteListed(Material material)
{
return canMakeShroomyWhiteList.contains(material.getKey().getKey());
}
private void fillHardcodedHashSets()
{
fillAbilityBlackList();
filltoolBlackList();
fillMossyWhiteList();
fillLeavesWhiteList();
fillHerbalismAbilityBlackList();
fillBlockCrackerWhiteList();
fillShroomyWhiteList();
}
private void fillShroomyWhiteList()
{
canMakeShroomyWhiteList.add("dirt");
canMakeShroomyWhiteList.add("grass");
canMakeShroomyWhiteList.add("grass_path");
}
private void fillBlockCrackerWhiteList()
{
blockCrackerWhiteList.add("stone_bricks");
}
private void fillHerbalismAbilityBlackList()
{
herbalismAbilityBlackList.add("dirt");
herbalismAbilityBlackList.add("grass");
herbalismAbilityBlackList.add("grass_path");
herbalismAbilityBlackList.add("farmland");
}
private void fillLeavesWhiteList()
{
leavesWhiteList.add("oak_leaves");
leavesWhiteList.add("acacia_leaves");
leavesWhiteList.add("birch_leaves");
leavesWhiteList.add("dark_oak_leaves");
leavesWhiteList.add("jungle_leaves");
leavesWhiteList.add("spruce_leaves");
}
private void fillMossyWhiteList()
{
mossyWhiteList.add("cobblestone");
mossyWhiteList.add("dirt");
mossyWhiteList.add("grass_path");
mossyWhiteList.add("stone_bricks");
mossyWhiteList.add("cobblestone_wall");
}
private void fillAbilityBlackList()
{
abilityBlackList.add("black_bed");
abilityBlackList.add("blue_bed");
abilityBlackList.add("brown_bed");
abilityBlackList.add("cyan_bed");
abilityBlackList.add("gray_bed");
abilityBlackList.add("green_bed");
abilityBlackList.add("light_blue_bed");
abilityBlackList.add("light_gray_bed");
abilityBlackList.add("lime_bed");
abilityBlackList.add("magenta_bed");
abilityBlackList.add("orange_bed");
abilityBlackList.add("pink_bed");
abilityBlackList.add("purple_bed");
abilityBlackList.add("red_bed");
abilityBlackList.add("white_bed");
abilityBlackList.add("yellow_bed");
abilityBlackList.add("brewing_stand");
abilityBlackList.add("bookshelf");
abilityBlackList.add("cake");
abilityBlackList.add("chest");
abilityBlackList.add("dispenser");
abilityBlackList.add("enchanting_table");
abilityBlackList.add("ender_chest");
abilityBlackList.add("oak_fence_gate");
abilityBlackList.add("acacia_fence_gate");
abilityBlackList.add("dark_oak_fence_gate");
abilityBlackList.add("spruce_fence_gate");
abilityBlackList.add("birch_fence_gate");
abilityBlackList.add("jungle_fence_gate");
abilityBlackList.add("furnace");
abilityBlackList.add("jukebox");
abilityBlackList.add("lever");
abilityBlackList.add("note_block");
abilityBlackList.add("stone_button");
abilityBlackList.add("oak_button");
abilityBlackList.add("birch_button");
abilityBlackList.add("acacia_button");
abilityBlackList.add("dark_oak_button");
abilityBlackList.add("jungle_button");
abilityBlackList.add("spruce_button");
abilityBlackList.add("acacia_trapdoor");
abilityBlackList.add("birch_trapdoor");
abilityBlackList.add("dark_oak_trapdoor");
abilityBlackList.add("jungle_trapdoor");
abilityBlackList.add("oak_trapdoor");
abilityBlackList.add("spruce_trapdoor");
abilityBlackList.add("acacia_sign");
abilityBlackList.add("acacia_wall_sign");
abilityBlackList.add("birch_sign");
abilityBlackList.add("birch_wall_sign");
abilityBlackList.add("dark_oak_sign");
abilityBlackList.add("dark_oak_wall_sign");
abilityBlackList.add("jungle_sign");
abilityBlackList.add("jungle_wall_sign");
abilityBlackList.add("spruce_sign");
abilityBlackList.add("spruce_wall_sign");
abilityBlackList.add("oak_sign");
abilityBlackList.add("oak_wall_sign");
abilityBlackList.add("crafting_table");
abilityBlackList.add("beacon");
abilityBlackList.add("anvil");
abilityBlackList.add("dropper");
abilityBlackList.add("hopper");
abilityBlackList.add("trapped_chest");
abilityBlackList.add("iron_door");
abilityBlackList.add("iron_trapdoor");
abilityBlackList.add("oak_door");
abilityBlackList.add("acacia_door");
abilityBlackList.add("spruce_door");
abilityBlackList.add("birch_door");
abilityBlackList.add("jungle_door");
abilityBlackList.add("dark_oak_door");
abilityBlackList.add("oak_fence");
abilityBlackList.add("acacia_fence");
abilityBlackList.add("dark_oak_fence");
abilityBlackList.add("birch_fence");
abilityBlackList.add("jungle_fence");
abilityBlackList.add("spruce_fence");
abilityBlackList.add("armor_stand");
abilityBlackList.add("black_shulker_box");
abilityBlackList.add("blue_shulker_box");
abilityBlackList.add("brown_shulker_box");
abilityBlackList.add("cyan_shulker_box");
abilityBlackList.add("gray_shulker_box");
abilityBlackList.add("green_shulker_box");
abilityBlackList.add("light_blue_shulker_box");
abilityBlackList.add("lime_shulker_box");
abilityBlackList.add("magenta_shulker_box");
abilityBlackList.add("orange_shulker_box");
abilityBlackList.add("pink_shulker_box");
abilityBlackList.add("purple_shulker_box");
abilityBlackList.add("red_shulker_box");
abilityBlackList.add("light_gray_shulker_box");
abilityBlackList.add("white_shulker_box");
abilityBlackList.add("yellow_shulker_box");
abilityBlackList.add("wall_sign"); //1.13 and lower?
abilityBlackList.add("sign"); //1.13 and lower?
}
private void filltoolBlackList()
{
//TODO: Add anvils / missing logs
toolBlackList.add("black_bed");
toolBlackList.add("blue_bed");
toolBlackList.add("brown_bed");
toolBlackList.add("cyan_bed");
toolBlackList.add("gray_bed");
toolBlackList.add("green_bed");
toolBlackList.add("light_blue_bed");
toolBlackList.add("light_gray_bed");
toolBlackList.add("lime_bed");
toolBlackList.add("magenta_bed");
toolBlackList.add("orange_bed");
toolBlackList.add("pink_bed");
toolBlackList.add("purple_bed");
toolBlackList.add("red_bed");
toolBlackList.add("white_bed");
toolBlackList.add("yellow_bed");
toolBlackList.add("brewing_stand");
toolBlackList.add("bookshelf");
toolBlackList.add("cake");
toolBlackList.add("chest");
toolBlackList.add("dispenser");
toolBlackList.add("enchanting_table");
toolBlackList.add("ender_chest");
toolBlackList.add("oak_fence_gate");
toolBlackList.add("acacia_fence_gate");
toolBlackList.add("dark_oak_fence_gate");
toolBlackList.add("spruce_fence_gate");
toolBlackList.add("birch_fence_gate");
toolBlackList.add("jungle_fence_gate");
toolBlackList.add("furnace");
toolBlackList.add("jukebox");
toolBlackList.add("lever");
toolBlackList.add("note_block");
toolBlackList.add("stone_button");
toolBlackList.add("oak_button");
toolBlackList.add("birch_button");
toolBlackList.add("acacia_button");
toolBlackList.add("dark_oak_button");
toolBlackList.add("jungle_button");
toolBlackList.add("spruce_button");
toolBlackList.add("acacia_trapdoor");
toolBlackList.add("birch_trapdoor");
toolBlackList.add("dark_oak_trapdoor");
toolBlackList.add("jungle_trapdoor");
toolBlackList.add("oak_trapdoor");
toolBlackList.add("spruce_trapdoor");
toolBlackList.add("crafting_table");
toolBlackList.add("beacon");
toolBlackList.add("anvil");
toolBlackList.add("dropper");
toolBlackList.add("hopper");
toolBlackList.add("trapped_chest");
toolBlackList.add("iron_door");
toolBlackList.add("iron_trapdoor");
toolBlackList.add("oak_door");
toolBlackList.add("acacia_door");
toolBlackList.add("spruce_door");
toolBlackList.add("birch_door");
toolBlackList.add("jungle_door");
toolBlackList.add("dark_oak_door");
toolBlackList.add("oak_fence");
toolBlackList.add("acacia_fence");
toolBlackList.add("dark_oak_fence");
toolBlackList.add("birch_fence");
toolBlackList.add("jungle_fence");
toolBlackList.add("spruce_fence");
toolBlackList.add("armor_stand");
toolBlackList.add("black_shulker_box");
toolBlackList.add("blue_shulker_box");
toolBlackList.add("brown_shulker_box");
toolBlackList.add("cyan_shulker_box");
toolBlackList.add("gray_shulker_box");
toolBlackList.add("green_shulker_box");
toolBlackList.add("light_blue_shulker_box");
toolBlackList.add("lime_shulker_box");
toolBlackList.add("magenta_shulker_box");
toolBlackList.add("orange_shulker_box");
toolBlackList.add("pink_shulker_box");
toolBlackList.add("purple_shulker_box");
toolBlackList.add("red_shulker_box");
toolBlackList.add("light_gray_shulker_box");
toolBlackList.add("white_shulker_box");
toolBlackList.add("yellow_shulker_box");
toolBlackList.add("acacia_sign");
toolBlackList.add("acacia_wall_sign");
toolBlackList.add("birch_sign");
toolBlackList.add("birch_wall_sign");
toolBlackList.add("dark_oak_sign");
toolBlackList.add("dark_oak_wall_sign");
toolBlackList.add("jungle_sign");
toolBlackList.add("jungle_wall_sign");
toolBlackList.add("spruce_sign");
toolBlackList.add("spruce_wall_sign");
toolBlackList.add("oak_sign");
toolBlackList.add("oak_wall_sign");
toolBlackList.add("stripped_acacia_log");
toolBlackList.add("stripped_acacia_wood");
toolBlackList.add("stripped_birch_log");
toolBlackList.add("stripped_birch_wood");
toolBlackList.add("stripped_dark_oak_log");
toolBlackList.add("stripped_dark_oak_wood");
toolBlackList.add("stripped_jungle_log");
toolBlackList.add("stripped_jungle_wood");
toolBlackList.add("stripped_oak_log");
toolBlackList.add("stripped_oak_wood");
toolBlackList.add("stripped_spruce_log");
toolBlackList.add("stripped_spruce_wood");
toolBlackList.add("acacia_log");
toolBlackList.add("acacia_wood");
toolBlackList.add("birch_log");
toolBlackList.add("birch_wood");
toolBlackList.add("dark_oak_log");
toolBlackList.add("dark_oak_wood");
toolBlackList.add("jungle_log");
toolBlackList.add("jungle_wood");
toolBlackList.add("oak_log");
toolBlackList.add("oak_wood");
toolBlackList.add("spruce_log");
toolBlackList.add("spruce_wood");
}
private void addToHashSet(String string, HashSet<String> stringHashSet)
{
stringHashSet.add(string.toLowerCase());
}
}

View File

@ -196,7 +196,7 @@ Conversion:
# #
# Settings for XP distribution # Settings for XP distribution
### ###
Experience_114: Experience_Values:
PVP: PVP:
Rewards: true Rewards: true
Acrobatics: Acrobatics:

View File

@ -16,7 +16,7 @@ website: https://www.mcmmo.org
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
softdepend: [WorldGuard, CombatTag, HealthBar] softdepend: [WorldGuard, CombatTag, HealthBar]
load: STARTUP load: STARTUP
api-version: 1.14 api-version: 1.13
commands: commands:
mmoinfo: mmoinfo: