Skip to content

Commit 75e0b31

Browse files
committed
add config option to allow armor stand targets
1 parent e066471 commit 75e0b31

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/main/java/org/mcmonkey/sentinel/SentinelPlugin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ public ArrayList<SentinelTrait> cleanCurrentList() {
211211
*/
212212
public boolean enhanceLosTraces;
213213

214+
/**
215+
* Whether NPCs should be able to target armor stands.
216+
*/
217+
public boolean allowArmorStandTargets;
218+
214219
/**
215220
* Fills the {@code vaultPerms} object if possible.
216221
*/
@@ -298,6 +303,7 @@ public void loadConfigSettings() {
298303
preventExplosionBlockDamage = getConfig().getBoolean("random.prevent explosion block damage", true);
299304
tickRate = getConfig().getInt("update rate", 10);
300305
autoCorrectpathfinderMode = getConfig().getBoolean("random.auto correct pathfinder mode", true);
306+
allowArmorStandTargets = getConfig().getBoolean("random.allow armor stand targets", false);
301307
}
302308

303309
/**

src/main/java/org/mcmonkey/sentinel/targeting/SentinelTarget.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public class SentinelTarget {
6868
ENDERMEN = new SentinelTarget(new EntityType[]{EntityType.ENDERMAN}, "ENDERMAN", "ENDER_MAN", "ENDERMEN", "ENDER_MEN"),
6969
ENDERMITES = new SentinelTarget(new EntityType[]{EntityType.ENDERMITE}, "ENDERMITE", "ENDER_MITE"),
7070
WITHERS = new SentinelTarget(new EntityType[]{EntityType.WITHER}, "WITHER"),
71-
ENDERDRAGONS = new SentinelTarget(new EntityType[]{EntityType.ENDER_DRAGON}, "ENDERDRAGON", "ENDER_DRAGON");
71+
ENDERDRAGONS = new SentinelTarget(new EntityType[]{EntityType.ENDER_DRAGON}, "ENDERDRAGON", "ENDER_DRAGON"),
72+
ARMOR_STAND = new SentinelTarget(new EntityType[]{EntityType.ARMOR_STAND}, "ARMORSTAND", "ARMOR_STAND");
7273

7374
/**
7475
* Valid target types for 1.9 or higher.

src/main/java/org/mcmonkey/sentinel/targeting/SentinelTargetingHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public boolean shouldTarget(LivingEntity entity) {
4848
if (entity.getUniqueId().equals(getLivingEntity().getUniqueId())) {
4949
return false;
5050
}
51-
if (entity.getType() == EntityType.ARMOR_STAND) {
51+
if (entity.getType() == EntityType.ARMOR_STAND && !SentinelPlugin.instance.allowArmorStandTargets) {
5252
return false;
5353
}
5454
return isTargeted(entity) && !isIgnored(entity);
@@ -61,7 +61,7 @@ public boolean shouldAvoid(LivingEntity entity) {
6161
if (entity.getUniqueId().equals(getLivingEntity().getUniqueId())) {
6262
return false;
6363
}
64-
if (entity.getType() == EntityType.ARMOR_STAND) {
64+
if (entity.getType() == EntityType.ARMOR_STAND && !SentinelPlugin.instance.allowArmorStandTargets) {
6565
return false;
6666
}
6767
return isAvoided(entity) && !isIgnored(entity);
@@ -195,7 +195,7 @@ public boolean isIgnored(LivingEntity entity) {
195195
if (entity.getUniqueId().equals(getLivingEntity().getUniqueId())) {
196196
return true;
197197
}
198-
if (entity.getType() == EntityType.ARMOR_STAND) {
198+
if (entity.getType() == EntityType.ARMOR_STAND && !SentinelPlugin.instance.allowArmorStandTargets) {
199199
return true;
200200
}
201201
if (sentinel.getGuarding() != null && SentinelUtilities.uuidEquals(entity.getUniqueId(), sentinel.getGuarding())) {

src/main/resources/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ random:
115115
prevent explosion block damage: true
116116
# (Experimental) If enabled, will automatically change the NPC's pathfinding mode if the NPC appears to be getting stuck.
117117
auto correct pathfinder mode: true
118+
# If true, armor stands can be targeted. Unexpected behavior may result.
119+
allow armor stand targets: false
118120

119121
# How fast to recalculate, in ticks.
120122
update rate: 10

0 commit comments

Comments
 (0)