Skip to content

Commit

Permalink
Remove <reset> from text
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Oct 13, 2022
1 parent b686323 commit 1213c54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 4 additions & 4 deletions main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public void talk(SpeechContext context) {
// chat to the world with CHAT_FORMAT and CHAT_RANGE settings
if (!context.hasRecipients()) {
String text = Setting.CHAT_FORMAT.asString().replace("<npc>", npc.getName()).replace("<text>",
"<reset>" + context.getMessage());
context.getMessage());
talkToBystanders(npc, text, context);
return;
}

// Assumed recipients at this point
else if (context.size() <= 1) {
String text = Setting.CHAT_FORMAT_TO_TARGET.asString().replace("<npc>", npc.getName()).replace("<text>",
"<reset>" + context.getMessage());
context.getMessage());
String targetName = "";
// For each recipient
for (Talkable entity : context) {
Expand All @@ -57,7 +57,7 @@ else if (context.size() <= 1) {

else { // Multiple recipients
String text = Setting.CHAT_FORMAT_TO_TARGET.asString().replace("<npc>", npc.getName()).replace("<text>",
"<reset>" + context.getMessage());
context.getMessage());
List<String> targetNames = new ArrayList<String>();
// Talk to each recipient
for (Talkable entity : context) {
Expand Down Expand Up @@ -98,7 +98,7 @@ else if (context.size() <= 1) {

String bystanderText = Setting.CHAT_FORMAT_WITH_TARGETS_TO_BYSTANDERS.asString()
.replace("<npc>", npc.getName()).replace("<targets>", targets)
.replace("<text>", "<reset>" + context.getMessage());
.replace("<text>", context.getMessage());
talkToBystanders(npc, bystanderText, context);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ private void resetNearbyPlayers(SkinnableEntity skinnable) {
return;

double viewDistance = Setting.NPC_SKIN_VIEW_DISTANCE.asDouble();
viewDistance *= viewDistance;
Location location = entity.getLocation(NPC_LOCATION);
List<Player> players = entity.getWorld().getPlayers();
for (Player player : players) {
Expand All @@ -296,8 +295,7 @@ private void resetNearbyPlayers(SkinnableEntity skinnable) {
Location ploc = player.getLocation(CACHE_LOCATION);
if (ploc.getWorld() != location.getWorld())
continue;
double distanceSquared = ploc.distanceSquared(location);
if (distanceSquared > viewDistance)
if (ploc.distance(location) > viewDistance)
continue;

PlayerTracker tracker = playerTrackers.get(player.getUniqueId());
Expand Down
2 changes: 0 additions & 2 deletions main/src/main/java/net/citizensnpcs/trait/text/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
*/
@TraitName("text")
public class Text extends Trait implements Runnable, Listener, ConversationAbandonedListener {
private int bubbleTicks;
private final Map<UUID, Long> cooldowns = Maps.newHashMap();
private int currentIndex;
private int delay = -1;
Expand All @@ -52,7 +51,6 @@ public class Text extends Trait implements Runnable, Listener, ConversationAband
private double range = Setting.DEFAULT_TALK_CLOSE_RANGE.asDouble();
private boolean realisticLooker = Setting.DEFAULT_REALISTIC_LOOKING.asBoolean();
private boolean speechBubbles;
private final int speechIndex = -1;
private boolean talkClose = Setting.DEFAULT_TALK_CLOSE.asBoolean();
private final List<String> text = new ArrayList<String>();

Expand Down

0 comments on commit 1213c54

Please sign in to comment.