diff --git a/Changelog.txt b/Changelog.txt index 1ca092279..75caf3b69 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -103,7 +103,26 @@ Version 2.2.000 Parties got unnecessarily complex in my absence, I have removed many party features in order to simplify parties and bring them closer to my vision. I have also added new features which should improve parties where it matters. About the removed party features, all the features I removed I consider poor quality features and I don't think they belong in mcMMO. Feel free to yell at me in discord if you disagree. I don't know what genius decided to make parties public by default, when I found out that parties had been changed to such a system I could barely contain my disgust. Parties are back to being private, you get invited by a party leader or party officer. That is the only way to join a party. +Version 2.1.183 + Players now gain Acrobatics XP from falling even if they don't have the Roll permission node (checks for Acrobatics skill permission) + treasures.yml now has separate settings for Drop_Level for Standard/Retro mode (see notes / this change is automatic) + Updated Russian locale (thanks ImDaniX) + Added Donkeys to beat lore (thanks QuantumToasted) + Alchemy guide now correctly labels Rabbit's foot for potion of leaping (thanks mldriscoll) + Fixed a bug where sweet berry bushes would give XP in situations where they shouldn't + The /mmoinfo for Roll is removed for the time being, it will return in a future update (see notes) + + NOTES: + Previously treasures.yml would take drop_level and multiply it by 10 if you were on Retro Mode, this is confusing so it has been changed + treasures.yml will update old entries to follow the new format automatically, please review them to make sure they match expected values, and if not edit them and save then reboot your server + Roll is actually the only skill that had an /mmoinfo, its one big mess, I'll fix it in the future + Version 2.1.182 + Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) + Fixed an error when using mcMMO with Featherboard that broke mcMMO skill boards when using certain commands + Fixed a NPE with Scoreboards enabled when trying to update scoreboards + Added 'Scoreboard.Recovery' locale key + Sweet Berry Bush will no longer ready tools for Super Abilities You can now use '.all' (for example: mcmmo.perks.xp.customboost.all) to give an XP perk to all skills Removed hardcore and vampirism commands, these commands are dangerous, just modify the config file if you want to use hardcore / vampirism Fixed several errors in de locale (Thanks TheBusyBiscuit & w1tcherrr) @@ -112,8 +131,10 @@ Version 2.1.182 Removed a few silent exceptions for scoreboards & mcMMO Added warning about UltraPermissions to mcMMO Fixed a potential NPE in McMMOPlayerExperienceEvent + Added Sweet Berry Bush to config.yml bonus drops for Herbalism NOTES: + Sweet Berry Bushes won't give double drops for now, looking into an elegant solution mcMMO will do a better job reporting if something went wrong with scoreboards, which may lead to improved plugin compatibility between mcMMO and other plugins touching scoreboards. Version 2.1.181 diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java index e562e9429..0169c3918 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java @@ -71,22 +71,10 @@ public class MmoInfoCommand implements TabExecutor { private void displayInfo(Player player, String subSkillName) { - //Check to see if the skill exists in the new system - AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName); - if(abstractSubSkill != null) - { - /* New System Skills are programmable */ - abstractSubSkill.printInfo(player); - //TextComponentFactory.sendPlayerUrlHeader(player); - } else { - /* - * Skill is only in the old system - */ - player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header")); - player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName)); - player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); - player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill")); - } + player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header")); + player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName)); + player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); + player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill")); for(SubSkillType subSkillType : SubSkillType.values()) { diff --git a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java index f01f41940..66e107d09 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java @@ -43,7 +43,7 @@ public class SalvageConfig extends ConfigLoader { if(mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) { mcMMO.p.getLogger().info("Fixing incorrect Salvage quantities on Netherite gear, this will only run once..."); for(String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) { - config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); + config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything } try { diff --git a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java index 41fa349ce..bfd814889 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java @@ -164,7 +164,7 @@ public class FishingTreasureConfig extends ConfigLoader { } if (dropLevel < 0) { - reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel); + reason.add("Fishing Config: " + treasureName + " has an invalid Drop_Level: " + dropLevel); } /* diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index 370f2baa3..6e02731c9 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.config.treasure; import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.datatypes.treasure.HylianTreasure; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -14,6 +15,7 @@ import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionType; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -21,6 +23,9 @@ import java.util.List; public class TreasureConfig extends ConfigLoader { public static final String FILENAME = "treasures.yml"; + public static final String LEVEL_REQUIREMENT_RETRO_MODE = ".Level_Requirement.Retro_Mode"; + public static final String LEVEL_REQUIREMENT_STANDARD_MODE = ".Level_Requirement.Standard_Mode"; + public static final String LEGACY_DROP_LEVEL = ".Drop_Level"; private static TreasureConfig instance; public HashMap> excavationMap = new HashMap<>(); @@ -60,6 +65,7 @@ public class TreasureConfig extends ConfigLoader { } private void loadTreasures(String type) { + boolean updatedFile = false; boolean isExcavation = type.equals("Excavation"); boolean isHylian = type.equals("Hylian_Luck"); @@ -103,7 +109,29 @@ public class TreasureConfig extends ConfigLoader { int xp = config.getInt(type + "." + treasureName + ".XP"); double dropChance = config.getDouble(type + "." + treasureName + ".Drop_Chance"); - int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level"); + int legacyDropLevel = config.getInt(type + "." + treasureName + LEGACY_DROP_LEVEL, -1); + int dropLevel = -1; + + if(legacyDropLevel >= 0) { + //Config needs to be updated to be more specific + mcMMO.p.getLogger().info("(" + treasureName + ") Updating Drop_Level in treasures.yml for treasure to match new expected format"); + config.set(type + "." + treasureName + LEGACY_DROP_LEVEL, null); + config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, legacyDropLevel * 10); + config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel); + updatedFile = true; + } + + if(mcMMO.isRetroModeEnabled()) { + dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, 0); + } else { + dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, 0); + } + + if(dropLevel < 0) { + mcMMO.p.getLogger().info("Treasure drop level wasn't valid, using a default value."); + //Set it to the "max" if we don't have a drop level + dropLevel = 0; + } if (xp < 0) { reason.add(treasureName + " has an invalid XP value: " + xp); @@ -113,9 +141,6 @@ public class TreasureConfig extends ConfigLoader { reason.add(treasureName + " has an invalid Drop_Chance: " + dropChance); } - if (dropLevel < 0) { - reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel); - } /* * Itemstack @@ -219,6 +244,15 @@ public class TreasureConfig extends ConfigLoader { } } } + + //Apply our fix + if(updatedFile) { + try { + config.save(getFile()); + } catch (IOException e) { + e.printStackTrace(); + } + } } private void AddHylianTreasure(String dropper, HylianTreasure treasure) { diff --git a/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java index 9b2dc42f3..f0d08f3f8 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java @@ -12,7 +12,6 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.experience.MMOExperienceBarManager; import com.gmail.nossr50.util.skills.SkillUtils; diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 1c31a3d6e..8f0331d7b 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -80,6 +80,8 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident private final @NotNull SuperSkillManagerImpl superSkillManagerImpl; private final @NotNull AbilityActivationProcessor abilityActivationProcessor; + private PrimarySkillType lastSkillShownScoreboard = PrimarySkillType.values()[0]; + /** * Create a new {@link OnlineMMOPlayer} with default values for a {@link Player} * @param player target player @@ -176,6 +178,14 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident } } + public @NotNull PrimarySkillType getLastSkillShownScoreboard() { + return lastSkillShownScoreboard; + } + + public void setLastSkillShownScoreboard(PrimarySkillType primarySkillType) { + this.lastSkillShownScoreboard = primarySkillType; + } + /** * Update the last login to the current system time */ diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index ff6ceb615..4b5f77c1a 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -3,6 +3,9 @@ package com.gmail.nossr50.datatypes.skills.subskills.acrobatics; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.interactions.NotificationType; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.player.PlayerProfile; +import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; @@ -80,6 +83,9 @@ public class Roll extends AcrobaticsSubSkill { entityDamageEvent.setCancelled(true); return true; } + } else if(Permissions.skillEnabled(player, PrimarySkillType.ACROBATICS)) { + //Give XP Anyways + SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, ((EntityDamageEvent) event).getFinalDamage(), false), XPGainReason.PVE); } } @@ -367,31 +373,34 @@ public class Roll extends AcrobaticsSubSkill { MaxBonusLevel: 100 DamageThreshold: 7.0 */ - double rollChanceHalfMax, graceChanceHalfMax, damageThreshold, chancePerLevel; - //Chance to roll at half max skill - RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(null, subSkillType); - int halfMaxSkillValue = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL)/2; - rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue); - - //Chance to graceful roll at full skill - RandomChanceSkill rollGraceHalfMaxSkill = new RandomChanceSkill(null, subSkillType); - rollGraceHalfMaxSkill.setSkillLevel(halfMaxSkillValue * 2); //Double the effective odds - - //Chance to roll per level - RandomChanceSkill rollOneSkillLevel = new RandomChanceSkill(null, subSkillType); - rollGraceHalfMaxSkill.setSkillLevel(1); //Level 1 skill - - //Chance Stat Calculations - rollChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollHalfMaxSkill); - graceChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollGraceHalfMaxSkill); - damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold(); - - chancePerLevel = RandomChanceUtil.getRandomChanceExecutionChance(rollOneSkillLevel); - - double maxLevel = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL); - - return LocaleLoader.getString("Acrobatics.SubSkill.Roll.Mechanics", rollChanceHalfMax, graceChanceHalfMax, maxLevel, chancePerLevel, damageThreshold, damageThreshold * 2,halfMaxSkillValue); + return "Under Construction: This will work in a future update."; +// +// double rollChanceHalfMax, graceChanceHalfMax, damageThreshold, chancePerLevel; +// +// //Chance to roll at half max skill +// RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(null, subSkillType); +// int halfMaxSkillValue = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL)/2; +// rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue); +// +// //Chance to graceful roll at full skill +// RandomChanceSkill rollGraceHalfMaxSkill = new RandomChanceSkill(null, subSkillType); +// rollGraceHalfMaxSkill.setSkillLevel(halfMaxSkillValue * 2); //Double the effective odds +// +// //Chance to roll per level +// RandomChanceSkill rollOneSkillLevel = new RandomChanceSkill(null, subSkillType); +// rollGraceHalfMaxSkill.setSkillLevel(1); //Level 1 skill +// +// //Chance Stat Calculations +// rollChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollHalfMaxSkill); +// graceChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollGraceHalfMaxSkill); +// damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold(); +// +// chancePerLevel = RandomChanceUtil.getRandomChanceExecutionChance(rollOneSkillLevel); +// +// double maxLevel = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL); +// +// return LocaleLoader.getString("Acrobatics.SubSkill.Roll.Mechanics", rollChanceHalfMax, graceChanceHalfMax, maxLevel, chancePerLevel, damageThreshold, damageThreshold * 2,halfMaxSkillValue); } /** diff --git a/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java b/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java index 04ce7cca7..013849de2 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java +++ b/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.datatypes.treasure; -import com.gmail.nossr50.config.Config; import org.bukkit.inventory.ItemStack; public abstract class Treasure { @@ -41,10 +40,6 @@ public abstract class Treasure { } public int getDropLevel() { - //If they are in retro mode all requirements are scaled up by 10 - if(Config.getInstance().getIsRetroMode()) - return dropLevel * 10; - return dropLevel; } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 9c3ae708e..0c36e9117 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -31,7 +31,6 @@ import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; -import com.neetgames.mcmmo.player.OnlineMMOPlayer; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.OfflinePlayer; @@ -68,6 +67,30 @@ public class EntityListener implements Listener { persistentDataLayer = mcMMO.getCompatibilityManager().getPersistentDataLayer(); } +// @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) +// public void onBlockDropItemEvent(EntityDropItemEvent event) { +// if(event.getEntity() instanceof Block) { +// Block itemDispensingBlock = (Block) event.getEntity(); +// +// //Is it a berry bush? +// if(itemDispensingBlock.getType().toString().equalsIgnoreCase("sweet_berry_bush")) { +// //Berry Bush Time! +// if (event.getEntity().getMetadata(mcMMO.BONUS_DROPS_METAKEY).size() > 0) { +// Bukkit.broadcastMessage("Pop pop!"); +// BonusDropMeta bonusDropMeta = (BonusDropMeta) event.getEntity().getMetadata(mcMMO.BONUS_DROPS_METAKEY).get(0); +// int bonusCount = bonusDropMeta.asInt(); +// +// for (int i = 0; i < bonusCount; i++) { +// Misc.spawnItemNaturally(event.getEntity().getLocation(), event.getItemDrop().getItemStack(), ItemSpawnReason.BONUS_DROPS); +// } +// } +// } +// +// if(event.getEntity().hasMetadata(mcMMO.BONUS_DROPS_METAKEY)) +// event.getEntity().removeMetadata(mcMMO.BONUS_DROPS_METAKEY, pluginRef); +// } +// } + @EventHandler(priority = EventPriority.MONITOR) public void onEntityTransform(EntityTransformEvent event) { if(event.getEntity() instanceof LivingEntity) { diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 6b1ae3efd..7eaf25d3d 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -195,6 +195,7 @@ public class PlayerListener implements Listener { * * @param event The event to monitor */ + */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerWorldChange(PlayerChangedWorldEvent event) { Player player = event.getPlayer(); @@ -204,19 +205,15 @@ public class PlayerListener implements Listener { } //Profile not loaded - if(UserManager.queryPlayer(player) == null) + if(UserManager.getPlayer(player) == null) { return; } - OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); + McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - if(mmoPlayer == null) { - return; - } - - mmoPlayer.validateGodMode(); - mmoPlayer.validateParty(); + mcMMOPlayer.checkGodMode(); + mcMMOPlayer.checkParty(); } /** @@ -781,7 +778,134 @@ public class PlayerListener implements Listener { } } - mmoPlayer.getAbilityActivationProcessor().processAbilityAndToolActivations(playerInteractEvent); + switch (event.getAction()) { + case RIGHT_CLICK_BLOCK: + if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) { + break; + } + + //Hmm + if(event.getClickedBlock() == null) + return; + + Block block = event.getClickedBlock(); + BlockState blockState = block.getState(); + + /* ACTIVATION & ITEM CHECKS */ + if (BlockUtils.canActivateTools(blockState)) { + if (Config.getInstance().getAbilitiesEnabled()) { + if (BlockUtils.canActivateHerbalism(blockState)) { + mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM); + } + + mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.MINING); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.SWORDS); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.UNARMED); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING); + } + + ChimaeraWing.activationCheck(player); + } + + /* GREEN THUMB CHECK */ + HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager(); + + if (heldItem.getType() == Material.BONE_MEAL) { + switch (blockState.getType()) { + case BEETROOTS: + case CARROT: + case COCOA: + case WHEAT: + case NETHER_WART_BLOCK: + case POTATO: + mcMMO.getPlaceStore().setFalse(blockState); + } + } + + FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer()); //PlayerAnimationEvent compat + if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) { + if (herbalismManager.canGreenThumbBlock(blockState)) { + //call event for Green Thumb Block + if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) { + Bukkit.getPluginManager().callEvent(fakeSwing); + player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1); + player.updateInventory(); + if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) { + blockState.update(true); + } + } + } + /* SHROOM THUMB CHECK */ + else if (herbalismManager.canUseShroomThumb(blockState)) { + if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) { + Bukkit.getPluginManager().callEvent(fakeSwing); + event.setCancelled(true); + if (herbalismManager.processShroomThumb(blockState) + && EventUtils.simulateBlockBreak(block, player, false)) { + blockState.update(true); + } + } + } else { + herbalismManager.processBerryBushHarvesting(blockState); + } + } + break; + + case RIGHT_CLICK_AIR: + if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) { + break; + } + + /* ACTIVATION CHECKS */ + if (Config.getInstance().getAbilitiesEnabled()) { + mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.MINING); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.SWORDS); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.UNARMED); + mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING); + } + + /* ITEM CHECKS */ + ChimaeraWing.activationCheck(player); + + /* BLAST MINING CHECK */ + MiningManager miningManager = mcMMOPlayer.getMiningManager(); + if (miningManager.canDetonate()) { + miningManager.remoteDetonation(); + } + + break; + + case LEFT_CLICK_AIR: + case LEFT_CLICK_BLOCK: + + if (!player.isSneaking()) { + break; + } + + /* CALL OF THE WILD CHECKS */ + Material type = heldItem.getType(); + TamingManager tamingManager = mcMMOPlayer.getTamingManager(); + + if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry())) { + tamingManager.summonWolf(); + } + else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) { + tamingManager.summonOcelot(); + } + else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) { + tamingManager.summonHorse(); + } + + break; + + default: + break; + } } /** diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index aba711ca0..acd1883d1 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -163,6 +163,9 @@ public class mcMMO extends JavaPlugin { @Override public void onEnable() { try { + //Store this value so other plugins can check it + isRetroModeEnabled = Config.getInstance().getIsRetroMode(); + //Platform Manager platformManager = new PlatformManager(); @@ -190,9 +193,6 @@ public class mcMMO extends JavaPlugin { return; } - //Store this value so other plugins can check it - isRetroModeEnabled = Config.getInstance().getIsRetroMode(); - if(projectKorraEnabled) { getLogger().info("ProjectKorra was detected, this can cause some issues with weakness potions and combat skills for mcMMO"); } @@ -268,12 +268,6 @@ public class mcMMO extends JavaPlugin { metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard")); } - //Can't confirm this bug myself as the plugin is premium -// //TODO: Remove this when ChatControlRed fixes itself -// if(pluginManager.getPlugin("ChatControlRed") != null) { -// getLogger().severe("mcMMO has detected ChatControlRed on your server, users have reported a severe plugin conflict between these two plugins which degrades server performance and wastes many server resources."); -// getLogger().severe("It is HIGHLY RECOMMENDED that you do --NOT-- use ChatControlRed until this issue is resolved!"); -// } if(pluginManager.getPlugin(ULTRA_PERMISSONS) != null) { Bukkit.getScheduler().runTaskTimer(this, () -> { getLogger().severe(UP_WARNING_1); @@ -286,6 +280,7 @@ public class mcMMO extends JavaPlugin { }, 0L, 1200L); } } + catch (Throwable t) { getLogger().severe("There was an error while enabling mcMMO!"); diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 6da34ba0f..674545ad5 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -38,6 +38,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; @@ -60,6 +61,10 @@ public class HerbalismManager extends SkillManager { } public boolean canUseShroomThumb(BlockState blockState) { + if(!BlockUtils.canMakeShroomy(blockState)) { + return false; + } + if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB)) return false; @@ -67,7 +72,57 @@ public class HerbalismManager extends SkillManager { PlayerInventory inventory = player.getInventory(); Material itemType = inventory.getItemInMainHand().getType(); - return (itemType == Material.BROWN_MUSHROOM || itemType == Material.RED_MUSHROOM) && inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1) && BlockUtils.canMakeShroomy(blockState) && Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB); + return (itemType == Material.BROWN_MUSHROOM + || itemType == Material.RED_MUSHROOM) + && inventory.contains(Material.BROWN_MUSHROOM, 1) + && inventory.contains(Material.RED_MUSHROOM, 1) + && Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB); + } + + public void processBerryBushHarvesting(@NotNull BlockState blockState) { + /* Check if the player is harvesting a berry bush */ + if(blockState.getType().toString().equalsIgnoreCase("sweet_berry_bush")) { + if(mmoPlayer.isDebugMode()) { + mmoPlayer.getPlayer().sendMessage("Processing sweet berry bush rewards"); + } + //Check the age + if(blockState.getBlockData() instanceof Ageable) { + int rewardByAge = 0; + + Ageable ageable = (Ageable) blockState.getBlockData(); + + if(ageable.getAge() == 2) { + rewardByAge = 1; //Normal XP + } else if(ageable.getAge() == 3) { + rewardByAge = 2; //Double XP + } else { + return; //Not old enough, back out of processing + } + + if(mmoPlayer.isDebugMode()) { + mmoPlayer.getPlayer().sendMessage("Bush Reward Multiplier: " + rewardByAge); + } + + int xpReward = ExperienceConfig.getInstance().getXp(PrimarySkillType.HERBALISM, blockState) * rewardByAge; + + if(mmoPlayer.isDebugMode()) { + mmoPlayer.getPlayer().sendMessage("Bush XP: " + xpReward); + } + +// //Check for double drops +// if(checkDoubleDrop(blockState)) { +// +// if(mmoPlayer.isDebugMode()) { +// mmoPlayer.getPlayer().sendMessage("Double Drops succeeded for Berry Bush"); +// } +// +// //Add metadata to mark this block for double or triple drops +// markForBonusDrops(blockState); +// } + + applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF); + } + } } public boolean canUseHylianLuck() { diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 0cbf1f61b..f55f0c9dd 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -28,6 +28,7 @@ import com.neetgames.mcmmo.player.OnlineMMOPlayer; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.attribute.Attribute; +import org.bukkit.attribute.AttributeInstance; import org.bukkit.entity.*; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -248,13 +249,18 @@ public class TamingManager extends SkillManager { message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth())); - if (beast instanceof Horse) { - Horse horse = (Horse) beast; - double jumpStrength = horse.getAttribute(Attribute.HORSE_JUMP_STRENGTH).getValue(); - // Taken from https://minecraft.gamepedia.com/Horse#Jump_strength - jumpStrength = -0.1817584952 * Math.pow(jumpStrength, 3) + 3.689713992 * Math.pow(jumpStrength, 2) + 2.128599134 * jumpStrength - 0.343930367; - message = message.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseSpeed", horse.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getValue() * 43)) - .concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseJumpStrength", jumpStrength)); + // Bred mules & donkeys can actually have horse-like stats, but llamas cannot. + if (beast instanceof AbstractHorse && !(beast instanceof Llama)) { + AbstractHorse horseLikeCreature = (AbstractHorse) beast; + AttributeInstance jumpAttribute = horseLikeCreature.getAttribute(Attribute.HORSE_JUMP_STRENGTH); + + if(jumpAttribute != null) { + double jumpStrength = jumpAttribute.getValue(); + // Taken from https://minecraft.gamepedia.com/Horse#Jump_strength + jumpStrength = -0.1817584952 * Math.pow(jumpStrength, 3) + 3.689713992 * Math.pow(jumpStrength, 2) + 2.128599134 * jumpStrength - 0.343930367; + message = message.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseSpeed", horseLikeCreature.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getValue() * 43)) + .concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseJumpStrength", jumpStrength)); + } } player.sendMessage(message); diff --git a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java index cc04d7f78..9503c3ba6 100644 --- a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java +++ b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java @@ -1265,6 +1265,7 @@ public class MaterialMapStore { toolBlackList.add("stonecutter"); toolBlackList.add("lodestone"); toolBlackList.add("respawn_anchor"); + toolBlackList.add("sweet_berry_bush"); } public boolean isIntendedToolPickaxe(Material material) { diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index 9272df9c9..3d8026311 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -120,16 +120,39 @@ public final class Permissions { public static boolean lucky(Permissible permissible, PrimarySkillType primarySkillType) { return permissible.hasPermission("mcmmo.perks.lucky." + primarySkillType.getRawSkillName().toLowerCase(Locale.ENGLISH)); } /* XP PERKS */ - public static boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase(Locale.ENGLISH)); } - public static boolean tripleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase(Locale.ENGLISH)); } - public static boolean doubleAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); } - public static boolean doubleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase(Locale.ENGLISH)); } - public static boolean oneAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); } - public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); } + public static boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) { + return permissible.hasPermission("mcmmo.perks.xp.quadruple.all") + || permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase(Locale.ENGLISH)); + } + + public static boolean tripleXp(Permissible permissible, PrimarySkillType skill) { + return permissible.hasPermission("mcmmo.perks.xp.triple.all") + || permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase(Locale.ENGLISH)); + } + + public static boolean doubleAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { + return permissible.hasPermission("mcmmo.perks.xp.150percentboost.all") + || permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); + } + + public static boolean doubleXp(Permissible permissible, PrimarySkillType skill) { + return permissible.hasPermission("mcmmo.perks.xp.double.all") + || permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase(Locale.ENGLISH)); + } + + public static boolean oneAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { + return permissible.hasPermission("mcmmo.perks.xp.50percentboost.all") + || permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); + } + + public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) { + return permissible.hasPermission("mcmmo.perks.xp.10percentboost.all") + || permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); + } public static boolean customXpBoost(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.customboost.all") - ||permissible.hasPermission("mcmmo.perks.xp.customboost." + skill.toString().toLowerCase(Locale.ENGLISH)); + || permissible.hasPermission("mcmmo.perks.xp.customboost." + skill.toString().toLowerCase(Locale.ENGLISH)); } diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index 3a0350983..b4c24ff40 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -284,6 +284,9 @@ public class ScoreboardManager { // **** Setup methods **** // public static void enablePlayerSkillScoreboard(Player player, PrimarySkillType skill) { + McMMOPlayer mmoPlayer = UserManager.getPlayer(player); + mmoPlayer.setLastSkillShownScoreboard(skill); + ScoreboardWrapper wrapper = getWrapper(player); if(wrapper == null) { @@ -299,6 +302,25 @@ public class ScoreboardManager { } } + public static void retryLastSkillBoard(Player player) { + McMMOPlayer mmoPlayer = UserManager.getPlayer(player); + PrimarySkillType primarySkillType = mmoPlayer.getLastSkillShownScoreboard(); + + ScoreboardWrapper wrapper = getWrapper(player); + + if(wrapper == null) { + setupPlayer(player); + wrapper = getWrapper(player); + } + + if(wrapper != null) { + wrapper.setOldScoreboard(); + wrapper.setTypeSkill(primarySkillType); + + changeScoreboard(wrapper, Config.getInstance().getSkillScoreboardTime()); + } + } + public static void enablePlayerSkillLevelUpScoreboard(Player player, PrimarySkillType skill) { ScoreboardWrapper wrapper = getWrapper(player); @@ -527,8 +549,7 @@ public class ScoreboardManager { return mcMMO.p.getServer().getScoreboardManager(); } - - private static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) { + public static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) { if (displayTime == -1) { wrapper.showBoardWithNoRevert(); } diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java index 046ad610c..0b85db49f 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.util.scoreboards; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.database.PlayerStat; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; @@ -13,9 +14,11 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.player.NotificationManager; +import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager.SidebarType; -import com.neetgames.mcmmo.player.OnlineMMOPlayer; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -42,7 +45,7 @@ public class ScoreboardWrapper { // Internal usage variables (should exist) private SidebarType sidebarType; private Objective sidebarObjective; - private final Objective powerObjective; + private Objective powerObjective; // Parameter variables (May be null / invalid) private Scoreboard oldBoard = null; @@ -50,21 +53,34 @@ public class ScoreboardWrapper { public PrimarySkillType targetSkill = null; private PlayerProfile targetProfile = null; public int leaderboardPage = -1; + private boolean registered = false; public ScoreboardWrapper(Player player, Scoreboard scoreboard) { this.player = player; this.playerName = player.getName(); this.scoreboard = scoreboard; + initBoard(); + } + + private void initBoard() { sidebarType = SidebarType.NONE; - sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy", SIDE_OBJECTIVE); - powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy", POWER_OBJECTIVE); + if(registered) { + //Make sure our references are pointed at the right things + sidebarObjective = scoreboard.getObjective(ScoreboardManager.SIDEBAR_OBJECTIVE); + powerObjective = scoreboard.getObjective(ScoreboardManager.POWER_OBJECTIVE); + } else { + //Register Objectives + sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy", SIDE_OBJECTIVE); + powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy", POWER_OBJECTIVE); + registered = true; + } if (Config.getInstance().getPowerLevelTagsEnabled()) { powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL); powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME); - for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) { - powerObjective.getScore(mmoPlayer.getPlayerName()).setScore(mmoPlayer.getExperienceHandler().getPowerLevel()); + for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) { + powerObjective.getScore(mcMMOPlayer.getProfile().getPlayerName()).setScore(mcMMOPlayer.getPowerLevel()); } } } @@ -207,7 +223,7 @@ public class ScoreboardWrapper { if(UserManager.getPlayer(playerName) == null) return; - PlayerProfile profile = UserManager.queryPlayer(player); + PlayerProfile profile = UserManager.getPlayer(player).getProfile(); if (profile.getScoreboardTipsShown() >= Config.getInstance().getTipsAmount()) { return; @@ -244,7 +260,7 @@ public class ScoreboardWrapper { oldBoard = null; } else { - mcMMO.p.getLogger().info("Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)"); + mcMMO.p.debug("Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)"); } } @@ -398,7 +414,19 @@ public class ScoreboardWrapper { //Unregister objective McMMOScoreboardObjectiveEvent unregisterEvent = callObjectiveEvent(ScoreboardObjectiveEventReason.UNREGISTER_THIS_OBJECTIVE); if(!unregisterEvent.isCancelled()) { - sidebarObjective.unregister(); + try { + sidebarObjective.unregister(); + } catch (IllegalStateException e) { + McMMOPlayer mmoPlayer = UserManager.getPlayer(player); + + mcMMO.p.debug("Recovering scoreboard for player: " + player.getName()); + + if(mmoPlayer.isDebugMode()) + NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery"); + + initBoard(); //Start over + Bukkit.getScheduler().runTaskLater(mcMMO.p, () -> ScoreboardManager.retryLastSkillBoard(player), 0); + } } //Register objective @@ -427,14 +455,16 @@ public class ScoreboardWrapper { * Load new values into the sidebar. */ private void updateSidebar() { - try { - updateTask.cancel(); - } - catch (Exception e) { - e.printStackTrace(); + if(updateTask != null) { + try { + updateTask.cancel(); + } catch (Exception e) { + e.printStackTrace(); + } + + updateTask = null; } - updateTask = null; if (sidebarType == SidebarType.NONE) { return; @@ -447,9 +477,9 @@ public class ScoreboardWrapper { return; } - OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); + McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - if(mmoPlayer == null) + if(mcMMOPlayer == null) return; switch (sidebarType) { @@ -460,28 +490,28 @@ public class ScoreboardWrapper { Validate.notNull(targetSkill); if (!targetSkill.isChildSkill()) { - int currentXP = mmoPlayer.getExperienceHandler().getSkillXpValue(targetSkill); + int currentXP = mcMMOPlayer.getSkillXpLevel(targetSkill); sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP); - sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mmoPlayer.getExperienceHandler().getExperienceToNextLevel(targetSkill) - currentXP); + sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP); } else { for (PrimarySkillType parentSkill : FamilyTree.getParents(targetSkill)) { - sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mmoPlayer.getExperienceHandler().getSkillLevel(parentSkill)); + sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill)); } } - sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mmoPlayer.getExperienceHandler().getSkillLevel(targetSkill)); + sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mcMMOPlayer.getSkillLevel(targetSkill)); - if (targetSkill.getSuperAbilityType() != null) { + if (targetSkill.getAbility() != null) { boolean stopUpdating; if (targetSkill == PrimarySkillType.MINING) { // Special-Case: Mining has two abilities, both with cooldowns Score cooldownSB = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(SuperAbilityType.SUPER_BREAKER)); Score cooldownBM = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(SuperAbilityType.BLAST_MINING)); - int secondsSB = Math.max(mmoPlayer.getCooldownSeconds(SuperAbilityType.SUPER_BREAKER), 0); - int secondsBM = Math.max(mmoPlayer.getCooldownSeconds(SuperAbilityType.BLAST_MINING), 0); + int secondsSB = Math.max(mcMMOPlayer.calculateTimeRemaining(SuperAbilityType.SUPER_BREAKER), 0); + int secondsBM = Math.max(mcMMOPlayer.calculateTimeRemaining(SuperAbilityType.BLAST_MINING), 0); cooldownSB.setScore(secondsSB); cooldownBM.setScore(secondsBM); @@ -489,9 +519,9 @@ public class ScoreboardWrapper { stopUpdating = (secondsSB == 0 && secondsBM == 0); } else { - SuperAbilityType ability = targetSkill.getSuperAbilityType(); + SuperAbilityType ability = targetSkill.getAbility(); Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability)); - int seconds = Math.max(mmoPlayer.getCooldownSeconds(ability), 0); + int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0); cooldown.setScore(seconds); @@ -511,7 +541,7 @@ public class ScoreboardWrapper { boolean anyCooldownsActive = false; for (SuperAbilityType ability : SuperAbilityType.values()) { - int seconds = Math.max(mmoPlayer.getCooldownSeconds(ability), 0); + int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0); if (seconds != 0) { anyCooldownsActive = true; @@ -536,16 +566,16 @@ public class ScoreboardWrapper { newProfile = targetProfile; // offline } else if (targetPlayer == null) { - newProfile = mmoPlayer; // self + newProfile = mcMMOPlayer.getProfile(); // self } else { - newProfile = UserManager.getPlayer(targetPlayer); // online + newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online } // Calculate power level here int powerLevel = 0; for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long - int level = newProfile.getExperienceHandler().getSkillLevel(skill); + int level = newProfile.getSkillLevel(skill); powerLevel += level; @@ -562,10 +592,10 @@ public class ScoreboardWrapper { case RANK_BOARD: case TOP_BOARD: - /* - * @see #acceptRankData(Map rank) - * @see #acceptLeaderboardData(List stats) - */ + /* + * @see #acceptRankData(Map rank) + * @see #acceptLeaderboardData(List stats) + */ break; default: diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index cc92813f8..5387ac1f1 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -472,6 +472,7 @@ Green_Thumb_Replanting_Crops: ### Bonus_Drops: Herbalism: + Sweet_Berry_Bush: true Weeping_Vines: true Twisting_Vines: true Shroomlight: true diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index d36beb86d..e4ef7a895 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -904,13 +904,14 @@ Guides.Acrobatics.Section.0=&3About Acrobatics:\n&eAcrobatics is the art of movi Guides.Acrobatics.Section.1=&3How does Rolling work?\n&eYou have a passive chance when you take fall damage\n&eto negate the damage done. You can hold the sneak button to\n&edouble your chances during the fall.\n&eThis triggers a Graceful Roll instead of a standard one.\n&eGraceful Rolls are like regular rolls but are twice as likely to\n&eoccur and provide more damage safety than regular rolls.\n&eRolling chance is tied to your skill level Guides.Acrobatics.Section.2=&3How does Dodge work?\n&eDodge is a passive chance when you are\n&einjured in combat to halve the damage taken.\n&eIt is tied to your skill level. ##Alchemy -Guides.Alchemy.Section.0=&3About Alchemy:\n&eAlchemy is about brewing potions.\n&eIt provides a speed increase in the potion brew time, as well\n&eas the addition of new (previously) unobtainable potions.\n\n\n&3XP GAIN:\n&eTo gain XP in this skill you need to brew potions. -Guides.Alchemy.Section.1=&3How does Catalysis work?\n&eCatalysis speeds of the brewing process, with a\n&emax speed of 4x at level 1000.\n&eThis ability is unlocked at level 100 by default. -Guides.Alchemy.Section.2=&3How does Concoctions work?\n&eConcoctions allows brewing of more potions with custom ingredients.\n&eWhich special ingredients are unlocked is determined\n&eby your Rank. There are 8 ranks to unlock. -Guides.Alchemy.Section.3=&3Concoctions tier 1 ingredients:\n&eBlaze Powder, Fermented Spider Eye, Ghast Tear, Redstone,\n&eGlowstone Dust, Sugar, Glistering Melon, Golden Carrot,\n&eMagma Cream, Nether Wart, Spider Eye, Suplhur, Water Lily,\n&ePufferfish\n&e(Vanilla Potions) -Guides.Alchemy.Section.4=&3Concoctions tier 2 ingredients:\n&eCarrot (Potion of Haste)\n&eSlimeball (Potion of Dullness)\n\n&3Concoctions tier 3 ingredients:\n&eQuartz (Potion of Absorption)\n&eRed Mushroom (Potion of Leaping) -Guides.Alchemy.Section.5=&3Concoctions tier 4 ingredients:\n&eApple (Potion of Health Boost)\n&eRotten Flesh (Potion of Hunger)\n\n&3Concoctions tier 5 ingredients:\n&eBrown Mushroom (Potion of Nausea)\n&eInk Sack (Potion of Blindness) -Guides.Alchemy.Section.6=&3Concoctions tier 6 ingredients:\n&eFern (Potion of Saturation)\n\n&3Concoctions tier 7 ingredients:\n&ePoisonous Potato (Potion of Decay)\n\n&3Concoctions tier 8 ingredients:\n&eRegular Golden Apple (Potion of Resistance) +Guides.Alchemy.Section.0=[[DARK_AQUA]]About Alchemy:\n[[YELLOW]]Alchemy is about brewing potions.\n[[YELLOW]]It provides a speed increase in the potion brew time, as well\n[[YELLOW]]as the addition of new (previously) unobtainable potions.\n\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill you need to brew potions. +Guides.Alchemy.Section.1=[[DARK_AQUA]]How does Catalysis work?\n[[YELLOW]]Catalysis speeds of the brewing process, with a\n[[YELLOW]]max speed of 4x at level 1000.\n[[YELLOW]]This ability is unlocked at level 100 by default. +Guides.Alchemy.Section.2=[[DARK_AQUA]]How does Concoctions work?\n[[YELLOW]]Concoctions allows brewing of more potions with custom ingredients.\n[[YELLOW]]Which special ingredients are unlocked is determined\n[[YELLOW]]by your Rank. There are 8 ranks to unlock. +Guides.Alchemy.Section.3=[[DARK_AQUA]]Concoctions tier 1 ingredients:\n[[YELLOW]]Blaze Powder, Fermented Spider Eye, Ghast Tear, Redstone,\n[[YELLOW]]Glowstone Dust, Sugar, Glistering Melon, Golden Carrot,\n[[YELLOW]]Magma Cream, Nether Wart, Spider Eye, Suplhur, Water Lily,\n[[YELLOW]]Pufferfish\n[[YELLOW]](Vanilla Potions) +Guides.Alchemy.Section.4=[[DARK_AQUA]]Concoctions tier 2 ingredients:\n[[YELLOW]]Carrot (Potion of Haste)\n[[YELLOW]]Slimeball (Potion of Dullness)\n\n[[DARK_AQUA]]Concoctions tier 3 ingredients:\n[[YELLOW]]Quartz (Potion of Absorption)\n[[YELLOW]]Rabbit's Foot (Potion of Leaping) +Guides.Alchemy.Section.5=[[DARK_AQUA]]Concoctions tier 4 ingredients:\n[[YELLOW]]Apple (Potion of Health Boost)\n[[YELLOW]]Rotten Flesh (Potion of Hunger)\n\n[[DARK_AQUA]]Concoctions tier 5 ingredients:\n[[YELLOW]]Brown Mushroom (Potion of Nausea)\n[[YELLOW]]Ink Sack (Potion of Blindness) +Guides.Alchemy.Section.6=[[DARK_AQUA]]Concoctions tier 6 ingredients:\n[[YELLOW]]Fern (Potion of Saturation)\n\n[[DARK_AQUA]]Concoctions tier 7 ingredients:\n[[YELLOW]]Poisonous Potato (Potion of Decay)\n\n[[DARK_AQUA]]Concoctions tier 8 ingredients:\n[[YELLOW]]Regular Golden Apple (Potion of Resistance) + ##Archery Guides.Archery.Section.0=&3About Archery:\n&eArchery is about shooting with your bow and arrow.\n&eIt provides various combat bonuses, such as a damage boost\nðat scales with your level and the ability to daze your\n&eopponents in PvP. In addition to this, you can retrieve\n&esome of your spent arrows from the corpses of your foes.\n\n\n&3XP GAIN:\n&eTo gain XP in this skill you need to shoot mobs or\n&eother players. Guides.Archery.Section.1=&3How does Skill Shot work?\n&eSkill Shot provides additional damage to your shots.\n&eThe bonus damage from Skill Shot increases as you\n&elevel in Archery.\n&eWith the default settings, your archery damage increases 10%\n&eevery 50 levels, to a maximum of 200% bonus damage. @@ -1187,4 +1188,5 @@ Chat.Channel.On=&6(&amcMMO-Chat&6) &eYour chat messages will now be automaticall Chat.Channel.Off=&6(&amcMMO-Chat&6) &7Your chat messages will no longer be automatically delivered to specific chat channels. Chat.Spy.Party=&6[&eSPY&6-&a{2}&6] &r{0} &b\u2192 &r{1} Broadcasts.LevelUpMilestone=&6(&amcMMO&6) {0}&7 has reached level &a{1}&7 in &3{2}&7! -Broadcasts.PowerLevelUpMilestone=&6(&amcMMO&6) {0}&7 has reached a Power level of &a{1}&7! \ No newline at end of file +Broadcasts.PowerLevelUpMilestone=&6(&amcMMO&6) {0}&7 has reached a Power level of &a{1}&7! +Scoreboard.Recovery=Attempting to recover mcMMO scoreboard... \ No newline at end of file diff --git a/src/main/resources/locale/locale_ru.properties b/src/main/resources/locale/locale_ru.properties index 3878e1ab1..54f768564 100644 --- a/src/main/resources/locale/locale_ru.properties +++ b/src/main/resources/locale/locale_ru.properties @@ -1138,3 +1138,4 @@ Chat.Channel.Off=&6(&amcMMO-\u0447\u0430\u0442&6) &e\u0412\u0430\u0448\u0438 \u0 Chat.Spy.Party=&6[&e\u0428\u041F\u0418\u041A&6-&a{2}&6] &r{0} &b\u2192 &r{1} Broadcasts.LevelUpMilestone=&6(&amcMMO&6) {0}&7 \u0434\u043E\u0441\u0442\u0438\u0433 \u0443\u0440\u043E\u0432\u043D\u044F &a{1}&7 \u0432 &e{2}&7\\! Broadcasts.PowerLevelUpMilestone=&6(&amcMMO&6) {0}&7 \u0434\u043E\u0441\u0442\u0438\u0433 \u0443\u0440\u043E\u0432\u043D\u044F \u0441\u0438\u043B\u044B &a{1}&7\\! +Scoreboard.Recovery=\u041F\u043E\u043F\u044B\u0442\u043A\u0430 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0440\u0430\u0431\u043E\u0442\u0443 \u0442\u0430\u0431\u043B\u0438\u0446\u044B mcMMO... diff --git a/src/main/resources/potions.yml b/src/main/resources/potions.yml index b85bd9739..4e14491b7 100644 --- a/src/main/resources/potions.yml +++ b/src/main/resources/potions.yml @@ -25,7 +25,7 @@ Concoctions: - PHANTOM_MEMBRANE Tier_Three_Ingredients: - QUARTZ - - RED_MUSHROOM + - RABBIT_FOOT Tier_Four_Ingredients: - APPLE - ROTTEN_FLESH diff --git a/src/main/resources/treasures.yml b/src/main/resources/treasures.yml index c6fd7ae43..f791b7416 100755 --- a/src/main/resources/treasures.yml +++ b/src/main/resources/treasures.yml @@ -1,137 +1,174 @@ # # Settings for Excavation's Archaeology -# If you are in retro mode, Drop_Level is multiplied by 10. ### Excavation: CAKE: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 75 + Drop_Level: + Standard: 75 + Retro_Mode: 750 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] GUNPOWDER: Amount: 1 XP: 30 Drop_Chance: 10.0 - Drop_Level: 10 + Drop_Level: + Standard: 10 + Retro_Mode: 1000 Drops_From: [Gravel] BONE: Amount: 1 XP: 30 Drop_Chance: 10.0 - Drop_Level: 20 + Drop_Level: + Standard: 20 + Retro_Mode: 200 Drops_From: [Gravel] APPLE: Amount: 1 XP: 100 Drop_Chance: 0.1 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Grass_Block, Mycelium] SLIME_BALL: Amount: 1 XP: 100 Drop_Chance: 5.0 - Drop_Level: 15 + Drop_Level: + Standard: 15 + Retro_Mode: 150 Drops_From: [Clay] BUCKET: Amount: 1 XP: 100 Drop_Chance: 0.1 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Clay] NETHERRACK: Amount: 1 XP: 30 Drop_Chance: 0.5 - Drop_Level: 85 + Drop_Level: + Standard: 85 + Retro_Mode: 850 Drops_From: [Gravel] RED_MUSHROOM: Amount: 1 XP: 80 Drop_Chance: 0.5 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Mycelium] BROWN_MUSHROOM: Amount: 1 XP: 80 Drop_Chance: 0.5 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Mycelium] EGG: Amount: 1 XP: 100 Drop_Chance: 1.0 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Grass_Block] SOUL_SAND: Amount: 1 XP: 80 Drop_Chance: 0.5 - Drop_Level: 65 + Drop_Level: + Standard: 65 + Retro_Mode: 650 Drops_From: [Sand, Red_Sand] CLOCK: Amount: 1 XP: 100 Drop_Chance: 0.1 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Clay] COBWEB: Amount: 1 XP: 150 Drop_Chance: 5.0 - Drop_Level: 75 - Lore: - - Line 1 - - Line 2 - Custom_Name: Custom Name Test + Drop_Level: + Standard: 75 + Retro_Mode: 750 Drops_From: [Clay] STRING: Amount: 1 XP: 200 Drop_Chance: 5.0 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Clay] GLOWSTONE_DUST: Amount: 1 XP: 80 Drop_Chance: 5.0 - Drop_Level: 5 + Drop_Level: + Standard: 5 + Retro_Mode: 50 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Mycelium] MUSIC_DISC_13: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] MUSIC_DISC_CAT: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] DIAMOND: Amount: 1 XP: 1000 Drop_Chance: 0.13 - Drop_Level: 35 + Drop_Level: + Standard: 35 + Retro_Mode: 350 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] COCOA_BEANS: Amount: 1 XP: 100 Drop_Chance: 1.33 - Drop_Level: 35 + Drop_Level: + Standard: 35 + Retro_Mode: 350 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Mycelium] QUARTZ: Amount: 1 XP: 100 Drop_Chance: 0.5 - Drop_Level: 85 + Drop_Level: + Standard: 85 + Retro_Mode: 850 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand, Soul_Soil] NAME_TAG: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] # # Settings for Hylian Luck @@ -142,53 +179,71 @@ Hylian_Luck: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Bushes] PUMPKIN_SEEDS: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Bushes] COCOA_BEANS: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Bushes] CARROT: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Flowers] POTATO: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Flowers] APPLE: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Flowers] EMERALD: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Pots] DIAMOND: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Pots] GOLD_NUGGET: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Pots] \ No newline at end of file