From f52effb0fb383a486129e22f983cf8d042d954e7 Mon Sep 17 00:00:00 2001 From: Pablo <26825567+Pabsb@users.noreply.github.com> Date: Mon, 22 Mar 2021 15:13:51 -0500 Subject: [PATCH 01/19] Add '.all' to all existing perk xp multipliers (#4460) * Add '.all' to all existing perk xp multipliers Added '.all' usage for all existing perk xp mulipliers to enable use of mcmmo.perks.xp..all * Fixed a statement error --- .../com/gmail/nossr50/util/Permissions.java | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index 21df34696..a64c476f3 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -118,16 +118,39 @@ public final class Permissions { public static boolean lucky(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().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)); } From 317dc814a4481dc7536ae57e854c6a87584e8ca9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 23 Mar 2021 13:20:55 -0700 Subject: [PATCH 02/19] Add comment about power level cap issue --- .../java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 fb68f24ea..6921ad78a 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -775,7 +775,9 @@ public class McMMOPlayer implements Identified { * @return Modified experience */ private float modifyXpGain(PrimarySkillType primarySkillType, float xp) { - if ((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) { + //TODO: A rare situation can occur where the default Power Level cap can prevent a player with one skill edited to something silly like Integer.MAX_VALUE from gaining XP in any skill, we may need to represent power level with another data type + if ((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) + || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) { return 0; } From e40ab38bbd22f46e47b7e81e9832b0cf9b02efa0 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Mar 2021 13:42:20 -0700 Subject: [PATCH 03/19] Sweet Berry bushes now grant XP when harvested and no longer activate tools --- Changelog.txt | 2 + .../nossr50/listeners/PlayerListener.java | 5 +- .../skills/herbalism/HerbalismManager.java | 57 ++++++++++++++++++- .../gmail/nossr50/util/MaterialMapStore.java | 1 + 4 files changed, 63 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 0c6534d55..14831e829 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,6 @@ Version 2.1.182 + Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) + 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) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index b32083055..269d65967 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -841,10 +841,13 @@ public class PlayerListener implements Listener { 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)) { + if (herbalismManager.processShroomThumb(blockState) + && EventUtils.simulateBlockBreak(block, player, false)) { blockState.update(true); } } + } else { + herbalismManager.processBerryBushHarvesting(blockState); } break; 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 0d3279b1c..ab2cdcba4 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -40,6 +40,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; @@ -62,6 +63,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; @@ -69,7 +74,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/util/MaterialMapStore.java b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java index 3c88edd47..04564574b 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) { From eea922c31f30e7ee900d053b3521faacbe3a3ae6 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Mar 2021 14:08:22 -0700 Subject: [PATCH 04/19] TODO: Look into double drops for berry bushes --- Changelog.txt | 1 + .../database/FlatFileDatabaseManager.java | 2 -- .../nossr50/listeners/EntityListener.java | 31 +++++++++++++++++++ src/main/java/com/gmail/nossr50/mcMMO.java | 7 +---- .../skills/herbalism/HerbalismManager.java | 20 ++++++------ src/main/resources/config.yml | 1 + 6 files changed, 44 insertions(+), 18 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 14831e829..cec01067c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -9,6 +9,7 @@ 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: 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. diff --git a/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java index 46c36d07f..ca2c78681 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java @@ -6,13 +6,11 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.database.DatabaseType; import com.gmail.nossr50.datatypes.database.PlayerStat; -import com.gmail.nossr50.datatypes.database.UpgradeType; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.UniqueDataType; 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 org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index f354bd404..000f60797 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -1,10 +1,13 @@ package com.gmail.nossr50.listeners; +import com.gmail.nossr50.api.ItemSpawnReason; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.datatypes.meta.BonusDropMeta; import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; @@ -31,6 +34,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.OfflinePlayer; @@ -41,6 +45,7 @@ import org.bukkit.event.Cancellable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockDropItemEvent; import org.bukkit.event.entity.*; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; @@ -52,6 +57,8 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; import org.jetbrains.annotations.NotNull; +import java.util.HashSet; + public class EntityListener implements Listener { private final mcMMO pluginRef; private final @NotNull AbstractPersistentDataLayer persistentDataLayer; @@ -67,6 +74,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/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 335a7afbc..cc3143e5a 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -272,12 +272,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); @@ -290,6 +284,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 ab2cdcba4..f4bf66b1d 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -111,16 +111,16 @@ public class HerbalismManager extends SkillManager { 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); - } +// //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); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index a853f697f..bc640f363 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -464,6 +464,7 @@ Green_Thumb_Replanting_Crops: ### Bonus_Drops: Herbalism: + Sweet_Berry_Bush: true Weeping_Vines: true Twisting_Vines: true Shroomlight: true From fc3e580550167d11521d97573c08d3f9201157c0 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Mar 2021 14:13:16 -0700 Subject: [PATCH 05/19] Fix NPE with Scoreboards when updating --- Changelog.txt | 1 + .../util/scoreboards/ScoreboardWrapper.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index cec01067c..dc5998fdd 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.1.182 + Fixed a NPE with Scoreboards enabled when trying to update scoreboards Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) 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 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 2ba8715f5..e35bb958b 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -428,14 +428,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; From 7c8e14fd745057c51b5a59a169e62b01a0953c0d Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Mar 2021 14:49:36 -0700 Subject: [PATCH 06/19] Featherboard compatibility --- Changelog.txt | 2 ++ .../nossr50/datatypes/player/McMMOPlayer.java | 10 ++++++ .../util/scoreboards/ScoreboardManager.java | 25 +++++++++++-- .../util/scoreboards/ScoreboardWrapper.java | 35 ++++++++++++++++--- .../resources/locale/locale_en_US.properties | 3 +- 5 files changed, 68 insertions(+), 7 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index dc5998fdd..a1418d5bc 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,7 @@ Version 2.1.182 Fixed a NPE with Scoreboards enabled when trying to update scoreboards + Fixed an error when using mcMMO with Featherboard that broke mcMMO skill boards when using certain commands + Added 'Scoreboard.Recovery' locale key Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) 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 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 6921ad78a..cbcbbdba5 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -118,6 +118,8 @@ public class McMMOPlayer implements Identified { private final FixedMetadataValue playerMetadata; private final String playerName; + private PrimarySkillType lastSkillShownScoreboard = PrimarySkillType.values()[0]; + public McMMOPlayer(Player player, PlayerProfile profile) { this.playerName = player.getName(); UUID uuid = player.getUniqueId(); @@ -186,6 +188,14 @@ public class McMMOPlayer implements Identified { experienceBarManager.hideExperienceBar(primarySkillType); }*/ + public @NotNull PrimarySkillType getLastSkillShownScoreboard() { + return lastSkillShownScoreboard; + } + + public void setLastSkillShownScoreboard(PrimarySkillType primarySkillType) { + this.lastSkillShownScoreboard = primarySkillType; + } + public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource) { //Check if they've reached the power level cap just now 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 e6358ee2d..b6bb064b5 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -285,6 +285,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) { @@ -300,6 +303,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); @@ -528,8 +550,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 e35bb958b..e2669d4c0 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -14,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 org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -43,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; @@ -51,14 +53,27 @@ 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); @@ -399,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 diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 5a41eb424..efb979f8d 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -1137,4 +1137,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 From b189614d8de1b5ab76ae4a636c6cb02eb9829fc3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Mar 2021 14:51:28 -0700 Subject: [PATCH 07/19] 2.1.182 --- Changelog.txt | 7 ++++--- pom.xml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index a1418d5bc..c1e06d24d 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,8 +1,8 @@ Version 2.1.182 - Fixed a NPE with Scoreboards enabled when trying to update scoreboards - Fixed an error when using mcMMO with Featherboard that broke mcMMO skill boards when using certain commands - Added 'Scoreboard.Recovery' locale key 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 @@ -15,6 +15,7 @@ Version 2.1.182 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/pom.xml b/pom.xml index 1a9cd6cfe..59f9f9864 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.182-SNAPSHOT + 2.1.182 mcMMO https://github.com/mcMMO-Dev/mcMMO From 80e9111f78e84fc161d6876c5830478f5cf7dc8e Mon Sep 17 00:00:00 2001 From: Daniil Z Date: Tue, 30 Mar 2021 01:02:48 +0300 Subject: [PATCH 08/19] Update Russian localization (#4465) --- src/main/resources/locale/locale_ru.properties | 1 + 1 file changed, 1 insertion(+) 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... From df56d93aaa964cf5d4e954f535677fb1984747e9 Mon Sep 17 00:00:00 2001 From: Daniel Jarski <30324210+QuantumToasted@users.noreply.github.com> Date: Mon, 29 Mar 2021 17:08:40 -0500 Subject: [PATCH 09/19] Added Donkeys and Mules to the list of animals that display stats (#4282) ...in Beast Lore. I improperly assumed that donkeys and mules have fixed jump and movement speeds, but ones that are *bred* have variable stats just like horses. --- .../java/com/gmail/nossr50/skills/taming/TamingManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 eb42b9899..3b7f6315d 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -249,8 +249,9 @@ public class TamingManager extends SkillManager { message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth())); - if (beast instanceof Horse) { - Horse horse = (Horse) beast; + // Bred mules & donkeys can actually have horse-like stats, but llamas cannot. + if (beast instanceof AbstractHorse && !(beast instanceof Llama)) { + AbstractHorse horse = (AbstractHorse) 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; From c27b8dbd66cd6d1b0f4f0b988d95f1c72c739522 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 29 Mar 2021 15:11:08 -0700 Subject: [PATCH 10/19] Update changelog --- Changelog.txt | 4 ++++ pom.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index c1e06d24d..58e7b3e83 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,7 @@ +Version 2.1.183 + Updated Russian locale (thanks ImDaniX) + Added Donkeys to beat lore (thanks QuantumToasted) + 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 diff --git a/pom.xml b/pom.xml index 59f9f9864..d5b073f02 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.182 + 2.1.183-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO From fbd2eeb93d6104c374358a6902fd3922b0a5b070 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 29 Mar 2021 15:14:54 -0700 Subject: [PATCH 11/19] Avoid NPE on beast lore jump strength checks --- .../nossr50/skills/taming/TamingManager.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 3b7f6315d..859892c20 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -29,6 +29,7 @@ import com.gmail.nossr50.util.text.StringUtils; 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; @@ -251,12 +252,16 @@ public class TamingManager extends SkillManager { // Bred mules & donkeys can actually have horse-like stats, but llamas cannot. if (beast instanceof AbstractHorse && !(beast instanceof Llama)) { - AbstractHorse horse = (AbstractHorse) 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)); + 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); From d98bcea845f05197016b656c85033552c5f02f7f Mon Sep 17 00:00:00 2001 From: mldriscoll <53544431+mldriscoll@users.noreply.github.com> Date: Mon, 29 Mar 2021 23:22:24 +0100 Subject: [PATCH 12/19] Correcting references to the Potion of Leaping being made with Red Mushrooms (#4290) Co-authored-by: MLD Co-authored-by: Robert Alan Chapton --- src/main/resources/locale/locale_en_US.properties | 15 ++++++++------- src/main/resources/potions.yml | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index efb979f8d..3038d17b1 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -875,13 +875,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. 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 From f69c678f6c96aebd105b3119b2dd740e74001357 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 29 Mar 2021 15:23:48 -0700 Subject: [PATCH 13/19] Update changelog --- Changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.txt b/Changelog.txt index 58e7b3e83..aee814a51 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Version 2.1.183 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) Version 2.1.182 Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) From ae538d8c7215bae9cd705549ac2de2fce83fb599 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 29 Mar 2021 16:09:47 -0700 Subject: [PATCH 14/19] Sweet berry bush exploit fix --- Changelog.txt | 1 + .../nossr50/listeners/PlayerListener.java | 42 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index aee814a51..dbbeff792 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,6 +2,7 @@ Version 2.1.183 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 Version 2.1.182 Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 269d65967..f4938c319 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -824,30 +824,32 @@ public class PlayerListener implements Listener { } } - FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer()); //PlayerAnimationEvent compat - 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); + 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); + /* 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); } - } else { - herbalismManager.processBerryBushHarvesting(blockState); } break; From fdefea323577308354b059d076a5263195317fcf Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 30 Mar 2021 15:37:01 -0700 Subject: [PATCH 15/19] treasures.yml now has specific entries for Standard/Retro --- Changelog.txt | 5 + .../config/skills/salvage/SalvageConfig.java | 2 +- .../treasure/FishingTreasureConfig.java | 2 +- .../config/treasure/TreasureConfig.java | 42 +++++- .../nossr50/datatypes/treasure/Treasure.java | 5 - src/main/java/com/gmail/nossr50/mcMMO.java | 6 +- src/main/resources/treasures.yml | 121 +++++++++++++----- 7 files changed, 138 insertions(+), 45 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index dbbeff792..f48887c4b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,9 +1,14 @@ Version 2.1.183 + 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 + 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 + 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 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/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/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index cc3143e5a..66d698d1c 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 (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) { checkModConfigs(); } diff --git a/src/main/resources/treasures.yml b/src/main/resources/treasures.yml index 24de2fb86..f791b7416 100755 --- a/src/main/resources/treasures.yml +++ b/src/main/resources/treasures.yml @@ -1,133 +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 + 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 @@ -138,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 From 6b309f628ac4bdc4cf360abc5a09e6191981b0dc Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 30 Mar 2021 15:43:05 -0700 Subject: [PATCH 16/19] Roll will not have an mmoinfo read out for now --- Changelog.txt | 2 + .../skills/subskills/acrobatics/Roll.java | 51 ++++++++++--------- .../nossr50/listeners/EntityListener.java | 7 --- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index f48887c4b..b57dc6259 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -4,10 +4,12 @@ Version 2.1.183 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) 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 4ea8ad156..2f57a321b 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 @@ -370,31 +370,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/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 000f60797..414bbde52 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -1,13 +1,10 @@ package com.gmail.nossr50.listeners; -import com.gmail.nossr50.api.ItemSpawnReason; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.experience.ExperienceConfig; -import com.gmail.nossr50.datatypes.meta.BonusDropMeta; import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; @@ -34,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 org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.OfflinePlayer; @@ -45,7 +41,6 @@ import org.bukkit.event.Cancellable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockDropItemEvent; import org.bukkit.event.entity.*; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; @@ -57,8 +52,6 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; import org.jetbrains.annotations.NotNull; -import java.util.HashSet; - public class EntityListener implements Listener { private final mcMMO pluginRef; private final @NotNull AbstractPersistentDataLayer persistentDataLayer; From 0577701fd72795477dca4ef0dd262904f7cb89ca Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 30 Mar 2021 15:54:25 -0700 Subject: [PATCH 17/19] Tweak mmoinfo --- .../commands/skills/MmoInfoCommand.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) 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()) { From aa734c8b1a5d6f6267cfa0c105946e9a81d2dc12 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 30 Mar 2021 16:04:33 -0700 Subject: [PATCH 18/19] Acrobatics XP from falling no longer requires the Roll subskill --- Changelog.txt | 1 + .../nossr50/datatypes/skills/subskills/acrobatics/Roll.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index b57dc6259..4e2babd43 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ 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) 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 2f57a321b..f13f5b922 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 @@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason; 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; @@ -83,6 +84,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); } } From 0d955c3a945b18c063a0a90d59a4f5b7ea0a36cb Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 30 Mar 2021 16:11:26 -0700 Subject: [PATCH 19/19] 2.1.183 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d5b073f02..488916a86 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.183-SNAPSHOT + 2.1.183 mcMMO https://github.com/mcMMO-Dev/mcMMO