Tools with durability enchant will be damaged properly by super

abilities again (at a reduced rated)
This commit is contained in:
nossr50 2019-06-24 17:49:02 -07:00
parent a135e08e12
commit 764b4c20f5
3 changed files with 17 additions and 9 deletions

View File

@ -1,16 +1,21 @@
Version 2.1.89
When using WG with mcMMO, mcMMO now examines WG during runtime to determine if its a compatible version or not, see the notes
Fixed a bug that could result in Tree Feller failing to remove parts of a tree
When using WorldGuard (WG) with mcMMO, mcMMO now examines WG more carefully to determine if it is a compatible version or not, see the notes. Keep in mind WG is optional and not needed to run mcMMO.
Fixed a bug that could result in Tree Feller failing to remove parts of a tree in snowy biomes. (This fix won't apply retroactively to old trees, see the notes)
Updated Japanese locale (thanks snake)
Tree Feller and other Super Abilities will damage tools with the Enchantment named 'Durability/Unbreaking' again, this does not apply to the NBT tag named Unbreaking (Unbreaking NBT tag is safe from damage however, try not to confuse them as they share the same name)
NOTES:
https://mcmmo.org/wiki/World_guard - A list of WG flags
https://mcmmo.org/wiki/World_guard - A list of WG flags supported by mcMMO.
It is not necessary to have WG installed, but if you do have WG installed mcMMO hooks into it to provide some additional features.
Previously mcMMO used to determine if WG was compatible just by checking to see if it was version 7 of WG, however version 7 of WG is not guaranteed to be compatible as necessary classes that mcMMO hooks into were added during its development and some users are still running early dev versions of WG7.
In order to decrease the chance of error, mcMMO now uses reflection when checking to see if WG is compatible in addition to checking its version number, if its not compatible mcMMO will print a message and refrain from hooking into WG.
WG is an optional dependency for mcMMO, and unfortunately before this change if mcMMO thought you were running a compatible version of WG and it turned out you weren't then mcMMO would not function correctly.
In a prior patch I removed damage on tools if they had Unbreaking NBT or Unbreaking Enchantment, at the time I made this change I did not realize they were different things and just shared the same name, this patch fixes this mistake. My intention was to prevent damage on tools with the NBT unbreaking tag which makes an item never suffer from durability loss.
mcMMO reduces damage to tools from super abilities if they have the "Durability/Unbreaking" enchantment already, this behaviour has been in mcMMO for a long time.
There was a bug fixed in this patch that prevents an issue where Tree Feller was not removing all blocks left behind, unfortunately this will only affect new trees made in the world. The only trees that suffered from this bug were ones in snowy areas that had snow form on them.
Version 2.1.88
mcMMO is now more compatible with a plugin named Project Korra
mcMMO will no longer process combat triggers for damage at or below 0

View File

@ -243,8 +243,7 @@ public class SkillUtils {
* @param maxDamageModifier the amount to adjust the max damage by
*/
public static void handleDurabilityChange(ItemStack itemStack, double durabilityModifier, double maxDamageModifier) {
if((itemStack.getItemMeta().getEnchants().get(Enchantment.DURABILITY) != null && itemStack.getItemMeta().getEnchants().get(Enchantment.DURABILITY) >= 1)
|| (itemStack.getItemMeta() != null && itemStack.getItemMeta().isUnbreakable())) {
if(itemStack.getItemMeta() != null && itemStack.getItemMeta().isUnbreakable()) {
return;
}

View File

@ -16,6 +16,13 @@ import static org.bukkit.Bukkit.getServer;
public class WorldGuardManager {
private static WorldGuardManager instance;
private WorldGuardPlugin worldGuardPluginRef;
private RegionContainer container;
public WorldGuardManager() {
if(WorldGuardUtils.isWorldGuardLoaded()) {
container = WorldGuard.getInstance().getPlatform().getRegionContainer();
}
}
public static WorldGuardManager getInstance() {
if(instance == null)
@ -33,7 +40,6 @@ public class WorldGuardManager {
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
//WorldGuardPlugin worldGuard = getWorldGuard();
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
//ApplicableRegionSet set = query.getApplicableRegions(loc);
@ -50,7 +56,6 @@ public class WorldGuardManager {
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
//WorldGuardPlugin worldGuard = getWorldGuard();
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
//ApplicableRegionSet set = query.getApplicableRegions(loc);
@ -67,7 +72,6 @@ public class WorldGuardManager {
com.sk89q.worldedit.util.Location loc = localPlayer.getLocation();
//WorldGuardPlugin worldGuard = getWorldGuard();
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
//ApplicableRegionSet set = query.getApplicableRegions(loc);