mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-12-17 14:28:46 +01:00
1.21.9 support for treasures.yml, experience.yml, fishing_treasures.yml, and settings for mannequins and a fix for armor stands
This commit is contained in:
@@ -201,6 +201,10 @@ public class ExperienceConfig extends BukkitConfig {
|
||||
return config.getBoolean("ExploitFix.PreventArmorStandInteraction", true);
|
||||
}
|
||||
|
||||
public boolean isMannequinInteractionPrevented() {
|
||||
return config.getBoolean("ExploitFix.PreventMannequinInteraction", true);
|
||||
}
|
||||
|
||||
public boolean isFishingExploitingPrevented() {
|
||||
return config.getBoolean("ExploitFix.Fishing", true);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.ProjectileUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@@ -352,11 +353,13 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't process this event for marked entities, for players this is handled above,
|
||||
// However, for entities, we do not wanna cancel this event to allow plugins to observe changes
|
||||
// properly
|
||||
if (ExperienceConfig.getInstance().isArmorStandInteractionPrevented()
|
||||
&& attacker.getType().toString().toLowerCase(Locale.ENGLISH).equals("armor_stand")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getEntity() instanceof ArmorStand) {
|
||||
if (ExperienceConfig.getInstance().isMannequinInteractionPrevented()
|
||||
&& attacker.getType().toString().toLowerCase(Locale.ENGLISH).equals("mannequin")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1408,6 +1408,7 @@ public class MaterialMapStore {
|
||||
blackList.add("dropper");
|
||||
blackList.add("hopper");
|
||||
blackList.add("armor_stand");
|
||||
blackList.add("mannequin");
|
||||
}
|
||||
|
||||
private void fillAbilityBlackList() {
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class CombatUtils {
|
||||
|
||||
private static final ThreadLocal<Boolean> IN_MCMO_DAMAGE
|
||||
private static final ThreadLocal<Boolean> IN_MCMMO_DAMAGE
|
||||
= ThreadLocal.withInitial(() -> false);
|
||||
|
||||
|
||||
@@ -75,14 +75,14 @@ public final class CombatUtils {
|
||||
*/
|
||||
public static void safeDealDamage(@NotNull LivingEntity target, double amount,
|
||||
@Nullable Entity attacker) {
|
||||
boolean prev = IN_MCMO_DAMAGE.get();
|
||||
boolean prev = IN_MCMMO_DAMAGE.get();
|
||||
|
||||
if (prev || target.isDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
IN_MCMO_DAMAGE.set(true);
|
||||
IN_MCMMO_DAMAGE.set(true);
|
||||
if (!hasIgnoreDamageMetadata(target)) {
|
||||
applyIgnoreDamageMetadata(target);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public final class CombatUtils {
|
||||
target.damage(amount);
|
||||
}
|
||||
} finally {
|
||||
IN_MCMO_DAMAGE.set(false);
|
||||
IN_MCMMO_DAMAGE.set(false);
|
||||
if (hasIgnoreDamageMetadata(target)) {
|
||||
removeIgnoreDamageMetadata(target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user