Skip to content
Permalink
Browse files

Sentinel 1.3.2: Sneaky update!

  • Loading branch information...
mcmonkey4eva committed Jul 29, 2017
1 parent f002e13 commit b555aec6db71c95bba38c7e8d98095a6fcd48e45
Showing with 36 additions and 1 deletion.
  1. +11 −1 pom.xml
  2. +25 −0 src/main/java/org/mcmonkey/sentinel/SentinelTrait.java
12 pom.xml
@@ -7,7 +7,7 @@
<groupId>org.mcmonkey</groupId>
<artifactId>sentinel</artifactId>
<packaging>jar</packaging>
<version>1.3.1</version>
<version>1.3.2</version>
<name>Sentinel</name>
<description>Combat NPCs for Spigot</description>

@@ -115,6 +115,16 @@
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>

<url>https://github.com/mcmonkey4eva/Sentinel</url>
@@ -30,6 +30,7 @@
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.scheduler.BukkitRunnable;
@@ -1460,6 +1461,9 @@ public boolean isRegexTargeted(String name, List<String> regexes) {
}

public boolean isIgnored(LivingEntity entity) {
if (entity.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
return true;
}
if (entity.hasMetadata("NPC")) {
return ignores.contains(SentinelTarget.NPCS.name()) ||
isRegexTargeted(CitizensAPI.getNPCRegistry().getNPC(entity).getName(), npcNameIgnores);
@@ -1520,6 +1524,9 @@ else if (isRegexTargeted(entity.getCustomName() == null ? entity.getType().name(
}

public boolean isTargeted(LivingEntity entity) {
if (entity.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
return false;
}
SentinelCurrentTarget target = new SentinelCurrentTarget();
target.targetID = entity.getUniqueId();
if (entity.getUniqueId().equals(getLivingEntity().getUniqueId())) {
@@ -1636,6 +1643,10 @@ private void updateTargets() {
currentTargets.remove(uuid);
continue;
}
if (e instanceof LivingEntity && ((LivingEntity) e).hasPotionEffect(PotionEffectType.INVISIBILITY)) {
currentTargets.remove(uuid);
continue;
}
if (e.isDead()) {
currentTargets.remove(uuid);
continue;
@@ -1654,6 +1665,14 @@ private void updateTargets() {
}
}
}
if (chasing != null) {
SentinelCurrentTarget cte = new SentinelCurrentTarget();
cte.targetID = chasing.getUniqueId();
if (!currentTargets.contains(cte)) {
chasing = null;
npc.getNavigator().cancelNavigation();
}
}
}

int cleverTicks = 0;
@@ -1753,13 +1772,19 @@ else if(chasing != null && chasing.isValid()) {
chased = false;
}
else {
if (npc.getNavigator().getEntityTarget() != null) {
npc.getNavigator().cancelNavigation();
}
if (SentinelPlugin.debugMe) {
if (near != null && near.distanceSquared(getLivingEntity().getLocation()) > 3 * 3) {
SentinelPlugin.instance.getLogger().info("Sentinel: I'll just stand here and hope they come out...");
}
}
}
}
else if (chasing == null && npc.getNavigator().getEntityTarget() != null) {
npc.getNavigator().cancelNavigation();
}
}

private final static double MAX_DIST = 100000000;

0 comments on commit b555aec

Please sign in to comment.
You can’t perform that action at this time.