From 3fe27e8aab4ead528b38979d01c26a03a33990d2 Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Wed, 1 Nov 2023 16:25:27 +0100 Subject: [PATCH] fix \n bug & some hovers --- .../main/java/lol/pyr/znpcsplus/util/FileUtil.java | 8 +++++--- .../src/main/resources/messages/root-hover/skin.txt | 13 +++++++++++++ .../main/resources/messages/root-hover/teleport.txt | 6 ++++++ .../main/resources/messages/root-hover/toggle.txt | 6 ++++++ .../src/main/resources/messages/root-hover/type.txt | 6 ++++++ .../resources/messages/storage-hover/import.txt | 6 ++++++ .../resources/messages/storage-hover/reload.txt | 5 +++++ .../main/resources/messages/storage-hover/save.txt | 4 ++++ 8 files changed, 51 insertions(+), 3 deletions(-) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/util/FileUtil.java b/plugin/src/main/java/lol/pyr/znpcsplus/util/FileUtil.java index 47cb5a1..1bf3197 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/util/FileUtil.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/util/FileUtil.java @@ -3,17 +3,19 @@ package lol.pyr.znpcsplus.util; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; +import java.util.ArrayList; +import java.util.List; public class FileUtil { public static String dumpReaderAsString(Reader reader) { BufferedReader bReader = new BufferedReader(reader); try { - StringBuilder sb = new StringBuilder(); + List lines = new ArrayList<>(); String line; while ((line = bReader.readLine()) != null) { - sb.append(line).append("\n"); + lines.add(line); } - return sb.toString(); + return String.join("\n", lines); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/plugin/src/main/resources/messages/root-hover/skin.txt b/plugin/src/main/resources/messages/root-hover/skin.txt index e69de29..8e6f756 100644 --- a/plugin/src/main/resources/messages/root-hover/skin.txt +++ b/plugin/src/main/resources/messages/root-hover/skin.txt @@ -0,0 +1,13 @@ +Examples: + * /npc skin cool_npc1 static Notch + * /npc skin my_npc mirror + * /npc skin 12 dynamic %leaderboard_mining_top_1% + * /npc skin npc1234 url classic https://s.namemc.com/i/5d5eb6d84b57ea29.png + +Skin Types: + * Static - Only fetch the skin once and save the skin data + * Mirror - Copy the skin of the player who is viewing the npc + * Dynamic - Fetch the skin whenever the npc comes into viewing distance (supports placeholders) + * Url - Fetch the skin from an url to a raw skin file, this works like static + +Command used to change the skin of an npc \ No newline at end of file diff --git a/plugin/src/main/resources/messages/root-hover/teleport.txt b/plugin/src/main/resources/messages/root-hover/teleport.txt index e69de29..4e33f62 100644 --- a/plugin/src/main/resources/messages/root-hover/teleport.txt +++ b/plugin/src/main/resources/messages/root-hover/teleport.txt @@ -0,0 +1,6 @@ +Examples: + * /npc teleport cool_npc1 + * /npc teleport my_npc + * /npc teleport 12 + +Command used to teleport yourself to an npc \ No newline at end of file diff --git a/plugin/src/main/resources/messages/root-hover/toggle.txt b/plugin/src/main/resources/messages/root-hover/toggle.txt index e69de29..21bb7ad 100644 --- a/plugin/src/main/resources/messages/root-hover/toggle.txt +++ b/plugin/src/main/resources/messages/root-hover/toggle.txt @@ -0,0 +1,6 @@ +Examples: + * /npc toggle cool_npc1 + * /npc toggle my_npc + * /npc toggle 12 + +Command used to enable or disable an npc \ No newline at end of file diff --git a/plugin/src/main/resources/messages/root-hover/type.txt b/plugin/src/main/resources/messages/root-hover/type.txt index e69de29..90a123a 100644 --- a/plugin/src/main/resources/messages/root-hover/type.txt +++ b/plugin/src/main/resources/messages/root-hover/type.txt @@ -0,0 +1,6 @@ +Examples: + * /npc type cool_npc1 zombie + * /npc type my_npc skeleton + * /npc type 12 creeper + +Command used to change the type of an npc \ No newline at end of file diff --git a/plugin/src/main/resources/messages/storage-hover/import.txt b/plugin/src/main/resources/messages/storage-hover/import.txt index e69de29..ac114a5 100644 --- a/plugin/src/main/resources/messages/storage-hover/import.txt +++ b/plugin/src/main/resources/messages/storage-hover/import.txt @@ -0,0 +1,6 @@ +Examples: + * /npc storage import znpcs + * /npc storage import znpcsplus_legacy + * /npc storage import citizens + +Command used to import npcs from a different npc plugin \ No newline at end of file diff --git a/plugin/src/main/resources/messages/storage-hover/reload.txt b/plugin/src/main/resources/messages/storage-hover/reload.txt index e69de29..ab56365 100644 --- a/plugin/src/main/resources/messages/storage-hover/reload.txt +++ b/plugin/src/main/resources/messages/storage-hover/reload.txt @@ -0,0 +1,5 @@ +Examples: + * /npc storage reload + +Command used to re-load all npcs from storage +Warning: This command will delete all unsaved changes to npcs \ No newline at end of file diff --git a/plugin/src/main/resources/messages/storage-hover/save.txt b/plugin/src/main/resources/messages/storage-hover/save.txt index e69de29..40faf0a 100644 --- a/plugin/src/main/resources/messages/storage-hover/save.txt +++ b/plugin/src/main/resources/messages/storage-hover/save.txt @@ -0,0 +1,4 @@ +Examples: + * /npc storage save + +Command used to save the currently loaded npcs to storage \ No newline at end of file