Skip to content

Commit

Permalink
corrections to that pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 20, 2022
1 parent f9e8e07 commit ca59e47
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Sentinel is integrated into by external plugins as well, including:
- /sentinel avoidreturnpoint - Changes the location the NPC runs to when avoid mode is activated, or removes it if the NPC is already there.
- **Toggleable NPC configuration commands:**
- /sentinel invincible \['true'/'false'\] - Toggles whether the NPC is invincible.
- /sentinel protectfromignores \['true'/'false'\] - Toggles whether the NPC cannot be harmed by ignored targets.
- /sentinel protected \['true'/'false'\] - Toggles whether the NPC is protected from damage by ignore targets.
- /sentinel fightback \['true'/'false'\] - Toggles whether the NPC will fight back.
- /sentinel runaway \['true'/'false'\] - Toggles whether the NPC will run away when attacked.
- /sentinel needammo \['true'/'false'\] - Toggles whether the NPC will need ammo.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/mcmonkey/sentinel/SentinelPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ public ArrayList<SentinelTrait> cleanCurrentList() {
public boolean workaroundEntityChasePathfinder;

/**
* Configuration option: whether to protect the NPC from being harmed by ignored entities.
* Legacy configuration option: whether to protect all NPCs from being harmed by ignored entities.
*/
@Deprecated
public boolean protectFromIgnores;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/mcmonkey/sentinel/SentinelTrait.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ public void removeAvoid(String target) {
*/
@Persist("invincible")
public boolean invincible = false;

/**
* Whether the NPC cannot be harmed by ignored targets
* Whether the NPC should be protected from damage by ignore targets.
*/
@Persist ("protectFromIgnores")
@Persist ("protected")
public boolean protectFromIgnores = false;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.mcmonkey.sentinel.commands;

import java.util.Collection;
import net.citizensnpcs.api.command.Command;
import net.citizensnpcs.api.command.CommandContext;
import net.citizensnpcs.api.command.Requirements;

import org.bukkit.ChatColor;
import org.bukkit.Location;
Expand All @@ -10,9 +12,7 @@
import org.mcmonkey.sentinel.targeting.SentinelTargetLabel;
import org.mcmonkey.sentinel.targeting.SentinelTargetList;

import net.citizensnpcs.api.command.Command;
import net.citizensnpcs.api.command.CommandContext;
import net.citizensnpcs.api.command.Requirements;
import java.util.Collection;

/**
* Commands related to targeting.
Expand Down Expand Up @@ -265,7 +265,7 @@ public void runaway(CommandContext args, CommandSender sender, SentinelTrait sen
}

@Command(aliases = {"sentinel"}, usage = "protected ['true'/'false']",
desc = "Toggles whether the NPC cannot be harmed by ignored targets.",
desc = "Toggles whether the NPC should be protected from damage by ignore targets.",
modifiers = { "protected" }, permission = "sentinel.protected", min = 1, max = 2)
@Requirements(livingEntity = true, ownership = true, traits = {SentinelTrait.class})
public void protectedFromIgnores(CommandContext args, CommandSender sender, SentinelTrait sentinel) {
Expand All @@ -278,13 +278,13 @@ public void protectedFromIgnores(CommandContext args, CommandSender sender, Sent
}
sentinel.protectFromIgnores = mode;
if (sentinel.protectFromIgnores) {
sender.sendMessage(SentinelCommand.prefixGood + "NPC is now protected from ignored targets!");
sender.sendMessage(SentinelCommand.prefixGood + "NPC is now protected from ignore targets!");
}
else {
sender.sendMessage(SentinelCommand.prefixGood + "NPC no longer protected from ignored targets!");
sender.sendMessage(SentinelCommand.prefixGood + "NPC no longer protected from ignore targets!");
}
}

@Command(aliases = {"sentinel"}, usage = "fightback ['true'/'false']",
desc = "Toggles whether the NPC will fight back.",
modifiers = {"fightback"}, permission = "sentinel.fightback", min = 1, max = 2)
Expand Down
5 changes: 1 addition & 4 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sentinel defaults:
attack rate: 30
# Heal rate, in ticks.
heal rate: 100
# Whether NPCs are protected from damage by ignore targets.
# Whether the NPC should be protected from damage by ignore targets.
protected: true
# Whether this NPC fights back.
fightback: true
Expand Down Expand Up @@ -86,9 +86,6 @@ random:
# Whether to force damage through (particularly for ranged attacks).
# If enabled, this can cause unwanted side effects, like mobs not aggroing or some armor effects not applying.
enforce damage: false
# Whether NPCs are protected from damage by ignore targets.
# DEPRECATED - please use the default settings instead
protected: false
# Whether skull attack, evoker fang, or shulker bullets are allowed.
skull allowed: true
# How many calculation cycles before an NPC will give up on a good target.
Expand Down

0 comments on commit ca59e47

Please sign in to comment.