From 1213c5462c781f6acee878d8efa7c793239e5391 Mon Sep 17 00:00:00 2001 From: fullwall Date: Thu, 13 Oct 2022 11:08:16 +0800 Subject: [PATCH] Remove from text --- .../main/java/net/citizensnpcs/npc/ai/speech/Chat.java | 8 ++++---- .../java/net/citizensnpcs/npc/skin/SkinUpdateTracker.java | 4 +--- main/src/main/java/net/citizensnpcs/trait/text/Text.java | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java b/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java index 2b0e648e3..ff6d0c884 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/speech/Chat.java @@ -30,7 +30,7 @@ public class Chat implements VocalChord { // chat to the world with CHAT_FORMAT and CHAT_RANGE settings if (!context.hasRecipients()) { String text = Setting.CHAT_FORMAT.asString().replace("", npc.getName()).replace("", - "" + context.getMessage()); + context.getMessage()); talkToBystanders(npc, text, context); return; } @@ -38,7 +38,7 @@ public class Chat implements VocalChord { // Assumed recipients at this point else if (context.size() <= 1) { String text = Setting.CHAT_FORMAT_TO_TARGET.asString().replace("", npc.getName()).replace("", - "" + context.getMessage()); + context.getMessage()); String targetName = ""; // For each recipient for (Talkable entity : context) { @@ -57,7 +57,7 @@ public class Chat implements VocalChord { else { // Multiple recipients String text = Setting.CHAT_FORMAT_TO_TARGET.asString().replace("", npc.getName()).replace("", - "" + context.getMessage()); + context.getMessage()); List targetNames = new ArrayList(); // Talk to each recipient for (Talkable entity : context) { @@ -98,7 +98,7 @@ public class Chat implements VocalChord { String bystanderText = Setting.CHAT_FORMAT_WITH_TARGETS_TO_BYSTANDERS.asString() .replace("", npc.getName()).replace("", targets) - .replace("", "" + context.getMessage()); + .replace("", context.getMessage()); talkToBystanders(npc, bystanderText, context); } } diff --git a/main/src/main/java/net/citizensnpcs/npc/skin/SkinUpdateTracker.java b/main/src/main/java/net/citizensnpcs/npc/skin/SkinUpdateTracker.java index c74e2b20d..76938fc2a 100644 --- a/main/src/main/java/net/citizensnpcs/npc/skin/SkinUpdateTracker.java +++ b/main/src/main/java/net/citizensnpcs/npc/skin/SkinUpdateTracker.java @@ -287,7 +287,6 @@ public class SkinUpdateTracker { return; double viewDistance = Setting.NPC_SKIN_VIEW_DISTANCE.asDouble(); - viewDistance *= viewDistance; Location location = entity.getLocation(NPC_LOCATION); List players = entity.getWorld().getPlayers(); for (Player player : players) { @@ -296,8 +295,7 @@ public class SkinUpdateTracker { 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()); diff --git a/main/src/main/java/net/citizensnpcs/trait/text/Text.java b/main/src/main/java/net/citizensnpcs/trait/text/Text.java index a918b4281..ea2a60d7a 100644 --- a/main/src/main/java/net/citizensnpcs/trait/text/Text.java +++ b/main/src/main/java/net/citizensnpcs/trait/text/Text.java @@ -42,7 +42,6 @@ import net.citizensnpcs.util.Util; */ @TraitName("text") public class Text extends Trait implements Runnable, Listener, ConversationAbandonedListener { - private int bubbleTicks; private final Map cooldowns = Maps.newHashMap(); private int currentIndex; private int delay = -1; @@ -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 text = new ArrayList();