mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
Add ExploitFix.PreventPluginNPCInteraction to experience.yml
Read the changelog for why
This commit is contained in:
@ -152,6 +152,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
public boolean isPistonExploitPrevented() { return config.getBoolean("ExploitFix.Pistons", false); }
|
||||
public boolean allowUnsafeEnchantments() { return config.getBoolean("ExploitFix.UnsafeEnchantments", false); }
|
||||
public boolean isCOTWBreedingPrevented() { return config.getBoolean("ExploitFix.COTWBreeding", true); }
|
||||
public boolean isNPCInteractionPrevented() { return config.getBoolean("ExploitFix.PreventPluginNPCInteraction", true); }
|
||||
|
||||
public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); }
|
||||
public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }
|
||||
|
@ -312,7 +312,8 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Misc.isNPCEntityExcludingVillagers(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
||||
|
||||
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(defender)) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -322,7 +323,7 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Misc.isNPCEntityExcludingVillagers(attacker)) {
|
||||
if (ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(attacker)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -502,7 +503,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
*/
|
||||
|
||||
if (Misc.isNPCEntityExcludingVillagers(entity) || !entity.isValid() || !(entity instanceof LivingEntity)) {
|
||||
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(entity)) || !entity.isValid() || !(entity instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -649,7 +650,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (Misc.isNPCEntityExcludingVillagers(entity)) {
|
||||
if (ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -957,7 +958,7 @@ public class EntityListener implements Listener {
|
||||
LivingEntity livingEntity = event.getEntity();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)
|
||||
|| Misc.isNPCEntityExcludingVillagers(livingEntity)
|
||||
|| (ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(livingEntity))
|
||||
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity)
|
||||
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, livingEntity)) {
|
||||
return;
|
||||
|
@ -895,7 +895,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCEntityExcludingVillagers(player) || !UserManager.hasPlayerDataKey(player)) {
|
||||
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(player)) || !UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
|
@ -321,8 +321,10 @@ public final class CombatUtils {
|
||||
EntityType entityType = painSource.getType();
|
||||
|
||||
if (target instanceof Player) {
|
||||
if (Misc.isNPCEntityExcludingVillagers(target)) {
|
||||
return;
|
||||
if(ExperienceConfig.getInstance().isNPCInteractionPrevented()) {
|
||||
if (Misc.isNPCEntityExcludingVillagers(target)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Player player = (Player) target;
|
||||
@ -692,7 +694,7 @@ public final class CombatUtils {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Misc.isNPCEntityExcludingVillagers(entity) || !(entity instanceof LivingEntity) || !shouldBeAffected(attacker, entity)) {
|
||||
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(entity)) || !(entity instanceof LivingEntity) || !shouldBeAffected(attacker, entity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user