mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
fix luck of the sea being applied for super break and other abilities Fixes #5026
This commit is contained in:
parent
a11ac782fa
commit
e32bde3c32
@ -1,3 +1,6 @@
|
|||||||
|
Version 2.2.014
|
||||||
|
Fixed a bug where Luck Of The Sea was being applied for Super Breaker (and other abilities)
|
||||||
|
|
||||||
Version 2.2.013
|
Version 2.2.013
|
||||||
Added Breeze to experience.yml
|
Added Breeze to experience.yml
|
||||||
Added Bogged to experience.yml
|
Added Bogged to experience.yml
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.2.013</version>
|
<version>2.2.014-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.Registry;
|
import org.bukkit.Registry;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class EnchantmentMapper {
|
public class EnchantmentMapper {
|
||||||
private final mcMMO pluginRef;
|
private final mcMMO pluginRef;
|
||||||
@ -21,11 +26,17 @@ public class EnchantmentMapper {
|
|||||||
this.luckOfTheSea = initLuckOfTheSea();
|
this.luckOfTheSea = initLuckOfTheSea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static @Nullable Enchantment mockSpigotMatch(@NotNull String input) {
|
||||||
|
// Replicates match() behaviour for older versions lacking this API
|
||||||
|
final String filtered = input.toLowerCase(Locale.ROOT).replaceAll("\\s+", "_");
|
||||||
|
final NamespacedKey namespacedKey = NamespacedKey.fromString(filtered);
|
||||||
|
return (namespacedKey != null) ? Registry.ENCHANTMENT.get(namespacedKey) : null;
|
||||||
|
}
|
||||||
|
|
||||||
private Enchantment initLuckOfTheSea() {
|
private Enchantment initLuckOfTheSea() {
|
||||||
// TODO: Make use of match if present
|
if (mockSpigotMatch("luck_of_the_sea") != null) {
|
||||||
// if (Registry.ENCHANTMENT.match("luck_of_the_sea") != null) {
|
return mockSpigotMatch("luck_of_the_sea");
|
||||||
// return Registry.ENCHANTMENT.match("luck_of_the_sea");
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// Look for the enchantment by name
|
// Look for the enchantment by name
|
||||||
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
||||||
@ -43,9 +54,9 @@ public class EnchantmentMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Enchantment initFeatherFalling() {
|
private Enchantment initFeatherFalling() {
|
||||||
// if (Registry.ENCHANTMENT.match("feather_falling") != null) {
|
if (mockSpigotMatch("feather_falling") != null) {
|
||||||
// return Registry.ENCHANTMENT.match("feather_falling");
|
return mockSpigotMatch("feather_falling");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Look for the enchantment by name
|
// Look for the enchantment by name
|
||||||
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
||||||
@ -63,9 +74,9 @@ public class EnchantmentMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Enchantment initInfinity() {
|
private Enchantment initInfinity() {
|
||||||
// if (Registry.ENCHANTMENT.match("infinity") != null) {
|
if (mockSpigotMatch("infinity") != null) {
|
||||||
// return Registry.ENCHANTMENT.match("infinity");
|
return mockSpigotMatch("infinity");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Look for the enchantment by name
|
// Look for the enchantment by name
|
||||||
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
||||||
@ -83,9 +94,9 @@ public class EnchantmentMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Enchantment initEfficiency() {
|
private Enchantment initEfficiency() {
|
||||||
// if (Registry.ENCHANTMENT.match("efficiency") != null) {
|
if (mockSpigotMatch("efficiency") != null) {
|
||||||
// return Registry.ENCHANTMENT.match("efficiency");
|
return mockSpigotMatch("efficiency");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Look for the enchantment by name
|
// Look for the enchantment by name
|
||||||
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
||||||
@ -103,9 +114,9 @@ public class EnchantmentMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Enchantment initUnbreaking() {
|
private Enchantment initUnbreaking() {
|
||||||
// if (Registry.ENCHANTMENT.match("unbreaking") != null) {
|
if (mockSpigotMatch("unbreaking") != null) {
|
||||||
// return Registry.ENCHANTMENT.match("unbreaking");
|
return mockSpigotMatch("unbreaking");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Look for the enchantment by name
|
// Look for the enchantment by name
|
||||||
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
for (Enchantment enchantment : Registry.ENCHANTMENT) {
|
||||||
|
Loading…
Reference in New Issue
Block a user