diff --git a/api/pom.xml b/api/pom.xml
index 525c41f..82bb8be 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.2.1
+ 1.2.2
${project.jdk.version}
diff --git a/core/pom.xml b/core/pom.xml
index 4745371..ac76152 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.2.1
+ 1.2.2
${project.jdk.version}
diff --git a/core/src/main/java/com/artformgames/plugin/votepass/core/conf/CommonConfig.java b/core/src/main/java/com/artformgames/plugin/votepass/core/conf/CommonConfig.java
index e293cbf..efaa620 100644
--- a/core/src/main/java/com/artformgames/plugin/votepass/core/conf/CommonConfig.java
+++ b/core/src/main/java/com/artformgames/plugin/votepass/core/conf/CommonConfig.java
@@ -4,7 +4,7 @@
import cc.carm.lib.configuration.core.annotation.ConfigPath;
import cc.carm.lib.configuration.core.annotation.HeaderComment;
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import com.artformgames.plugin.votepass.core.database.DBConfiguration;
import com.artformgames.plugin.votepass.core.utils.TimeStringUtils;
import org.bukkit.Material;
diff --git a/game/api/pom.xml b/game/api/pom.xml
index bc63004..2a606d7 100644
--- a/game/api/pom.xml
+++ b/game/api/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.2.1
+ 1.2.2
../../pom.xml
diff --git a/game/plugin/pom.xml b/game/plugin/pom.xml
index c0adcd4..c169bef 100644
--- a/game/plugin/pom.xml
+++ b/game/plugin/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.2.1
+ 1.2.2
../../pom.xml
diff --git a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/conf/PluginConfig.java b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/conf/PluginConfig.java
index 2731c95..f748628 100644
--- a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/conf/PluginConfig.java
+++ b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/conf/PluginConfig.java
@@ -4,7 +4,7 @@
import cc.carm.lib.configuration.core.annotation.HeaderComment;
import cc.carm.lib.configuration.core.value.type.ConfiguredMap;
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredSound;
import com.artformgames.plugin.votepass.core.utils.TimeStringUtils;
@@ -126,8 +126,6 @@ public static final class COMMENT extends ConfigurationRoot {
@HeaderComment("How many letters are displayed in a single line")
public static final ConfiguredValue LINE = ConfiguredValue.of(Integer.class, 25);
- @HeaderComment("Prefix for each line")
- public static final ConfiguredValue PREFIX = ConfiguredValue.of(String.class, "&f&o ");
}
@@ -139,9 +137,6 @@ public static final class ANSWERS extends ConfigurationRoot {
@HeaderComment("Max lines that displayed in lore")
public static final ConfiguredValue MAX_LINES = ConfiguredValue.of(Integer.class, 6);
- @HeaderComment("Prefix for each line")
- public static final ConfiguredValue PREFIX = ConfiguredValue.of(String.class, "&f&o ");
-
@HeaderComment("Extra lore if answers are too long, tell voters to click to view details.")
public static final ConfiguredMessageList EXTRA = ConfiguredMessageList.ofStrings(
"&f&o ... More in details!"
@@ -182,6 +177,7 @@ public static final class ICON extends ConfigurationRoot {
}
+ @SuppressWarnings("unused")
public static final class GUIS extends ConfigurationRoot {
public static final Class> ABSTAIN_TOGGLE = AbstainToggleGUI.CONFIG.class;
diff --git a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/GUIUtils.java b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/GUIUtils.java
index 7ad7829..da5fe12 100644
--- a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/GUIUtils.java
+++ b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/GUIUtils.java
@@ -1,8 +1,8 @@
package com.artformgames.plugin.votepass.game.ui;
import cc.carm.lib.easyplugin.gui.paged.AutoPagedGUI;
-import cc.carm.lib.easyplugin.utils.ColorParser;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.PreparedItem;
import com.artformgames.plugin.votepass.api.data.request.RequestAnswer;
import com.artformgames.plugin.votepass.core.conf.CommonConfig;
import com.artformgames.plugin.votepass.game.api.vote.PendingVote;
@@ -21,14 +21,18 @@ public class GUIUtils {
public static ItemStack loadAnswersIcon(Player player,
RequestAnswer answer, ConfiguredItem itemConfig) {
int maxLine = PluginConfig.ANSWERS.MAX_LINES.getNotNull();
- ConfiguredItem.PreparedItem item = itemConfig.prepare(answer.question(), answer.countWords());
+ PreparedItem item = itemConfig.prepare(answer.question(), answer.countWords());
+ item.insertLore("question", sortContent(
+ answer.question(), PluginConfig.ANSWERS.LETTERS_PER_LINE.getNotNull()
+ ));
+
List lore = GUIUtils.formatAnswersLore(answer);
if (lore.size() > maxLine) {
- item.insertLore("contents", lore.subList(0, maxLine));
+ item.insertLore("contents", lore.subList(0, maxLine), true);
item.insertLore("more-contents", PluginConfig.ANSWERS.EXTRA);
} else if (!lore.isEmpty()) {
- item.insertLore("contents", lore);
+ item.insertLore("contents", lore, true);
}
return item.get(player);
}
@@ -46,48 +50,35 @@ public static List formatAnswersLore(@NotNull RequestAnswer answers) {
}
public static List formatAnswersLore(@NotNull List answers) {
- return formatAnswersLore(
- answers, PluginConfig.ANSWERS.PREFIX.getNotNull(),
- PluginConfig.ANSWERS.LETTERS_PER_LINE.getNotNull()
- );
+ return formatAnswersLore(answers, PluginConfig.ANSWERS.LETTERS_PER_LINE.getNotNull());
}
- public static List formatAnswersLore(List answers, String prefix, int lettersPreLine) {
+ public static List formatAnswersLore(List answers, int lettersPreLine) {
return answers.stream()
- .flatMap(answer -> sortContent(answer, prefix, lettersPreLine).stream())
+ .flatMap(answer -> sortContent(answer, lettersPreLine).stream())
.collect(Collectors.toList());
}
public static List formatCommentLine(String content) {
- return sortContent(
- content,
- PluginConfig.COMMENT.PREFIX.getNotNull(),
- PluginConfig.COMMENT.LINE.getNotNull()
- );
+ return sortContent(content, PluginConfig.COMMENT.LINE.getNotNull());
}
public static List formatCommentLine(PendingVote vote) {
return formatCommentLine(vote.getComments());
}
- public static List sortContent(String content, String prefix, int lineLength) {
+ public static List sortContent(String content, int lineLength) {
List lore = new ArrayList<>();
- if (content == null) return lore;
+ if (content == null || content.isBlank()) return lore;
- content = content
- .replaceAll("%+([一-龥_a-zA-Z0-9-]+)%+", "$1")
- .replaceAll(Pattern.quote("§"), "&")
- .replaceAll("^&+$", "");// Prevent color problems
- content = ColorParser.clear(content);
-
- if (content.isBlank()) return lore;
+ content = content.replaceAll(Pattern.quote("§"), "&");// Prevent color problems
int length = content.length();
int lines = length / lineLength + (length % lineLength == 0 ? 0 : 1);
for (int i = 0; i < lines; i++) {
int start = i * lineLength;
int end = Math.min((i + 1) * lineLength, length);
- lore.add(prefix + content.substring(start, end));
+ lore.add(content.substring(start, end));
}
return lore;
diff --git a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/RequestIconInfo.java b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/RequestIconInfo.java
index df40817..203f387 100644
--- a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/RequestIconInfo.java
+++ b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/RequestIconInfo.java
@@ -1,6 +1,6 @@
package com.artformgames.plugin.votepass.game.ui;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.PreparedItem;
import com.artformgames.plugin.votepass.api.data.request.RequestInformation;
import com.artformgames.plugin.votepass.api.data.vote.VoteInformation;
import com.artformgames.plugin.votepass.core.conf.CommonConfig;
@@ -65,7 +65,7 @@ public Object[] generateParams() {
};
}
- public ConfiguredItem.PreparedItem prepareIcon() {
+ public PreparedItem prepareIcon() {
return PluginConfig.ICON.INFO
.prepare(generateParams())
.setSkullOwner(info.getUserUUID());
diff --git a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/admin/AdminHandleGUI.java b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/admin/AdminHandleGUI.java
index 08562a6..98ae769 100644
--- a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/admin/AdminHandleGUI.java
+++ b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/admin/AdminHandleGUI.java
@@ -4,7 +4,7 @@
import cc.carm.lib.easyplugin.gui.GUIItem;
import cc.carm.lib.easyplugin.gui.GUIType;
import cc.carm.lib.easyplugin.gui.paged.AutoPagedGUI;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessage;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList;
import com.artformgames.plugin.votepass.api.data.request.RequestAnswer;
@@ -131,7 +131,7 @@ public static final class ITEMS extends ConfigurationRoot {
.defaultLore(
" ",
"&fThis answer contains &e%(words) &fletters.",
- "#contents#{1}",
+ "{ &f&o}#contents#{1}",
"#more-contents#{1}",
" ",
"&a ▶ Click &8|&f View full answer contents"
diff --git a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/request/RequestCommentsGUI.java b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/request/RequestCommentsGUI.java
index 9091c26..a74b6b5 100644
--- a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/request/RequestCommentsGUI.java
+++ b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/request/RequestCommentsGUI.java
@@ -5,7 +5,7 @@
import cc.carm.lib.easyplugin.gui.GUIItem;
import cc.carm.lib.easyplugin.gui.GUIType;
import cc.carm.lib.easyplugin.gui.paged.AutoPagedGUI;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessage;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList;
import com.artformgames.plugin.votepass.api.data.request.RequestInformation;
@@ -56,13 +56,13 @@ public void onClick(Player clicker, ClickType type) {
if (vote.isApproved()) {
addItem(new GUIItem(CONFIG.ITEMS.APPROVED
.prepare(vote.voter().getDisplayName(), vote.getTimeString())
- .insertLore("comment", GUIUtils.formatCommentLine(vote.comment()))
+ .insertLore("comment", GUIUtils.formatCommentLine(vote.comment()), true)
.get(player)
));
} else {
addItem(new GUIItem(CONFIG.ITEMS.REJECTED
.prepare(vote.voter().getDisplayName(), vote.getTimeString())
- .insertLore("comment", GUIUtils.formatCommentLine(vote.comment()))
+ .insertLore("comment", GUIUtils.formatCommentLine(vote.comment()), true)
.get(player)
));
}
diff --git a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteConfirmGUI.java b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteConfirmGUI.java
index 8dc2e2b..3370fc6 100644
--- a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteConfirmGUI.java
+++ b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteConfirmGUI.java
@@ -4,7 +4,7 @@
import cc.carm.lib.easyplugin.gui.GUI;
import cc.carm.lib.easyplugin.gui.GUIItem;
import cc.carm.lib.easyplugin.gui.GUIType;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessage;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList;
import com.artformgames.plugin.votepass.api.data.request.RequestInformation;
@@ -129,6 +129,7 @@ public void executeCommands(Player player, ConfiguredMessageList list, O
}
public void executeCommands(@Nullable List commands) {
+ if (commands == null) return;
for (String command : commands) {
try {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
diff --git a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteHandleGUI.java b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteHandleGUI.java
index 7e43ce5..0de172a 100644
--- a/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteHandleGUI.java
+++ b/game/plugin/src/main/java/com/artformgames/plugin/votepass/game/ui/vote/VoteHandleGUI.java
@@ -4,7 +4,7 @@
import cc.carm.lib.easyplugin.gui.GUIItem;
import cc.carm.lib.easyplugin.gui.GUIType;
import cc.carm.lib.easyplugin.gui.paged.AutoPagedGUI;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessage;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList;
import com.artformgames.plugin.votepass.api.data.request.RequestAnswer;
@@ -197,7 +197,7 @@ public static final class ITEMS extends ConfigurationRoot {
.defaultLore(
" ",
"&fThis answer contains &e%(words) &fletters.",
- "#contents#{1}",
+ "{ &f&o}#contents#{1}",
"#more-contents#{1}",
" ",
"&a ▶ Click &8|&f View full answer contents"
diff --git a/game/plugin/src/test/java/AnswerFormatTest.java b/game/plugin/src/test/java/AnswerFormatTest.java
index 8bac9ec..b197bbf 100644
--- a/game/plugin/src/test/java/AnswerFormatTest.java
+++ b/game/plugin/src/test/java/AnswerFormatTest.java
@@ -18,7 +18,7 @@ public void onTest() {
"answer3 %player_name% %%player%%"
);
- List formatted = GUIUtils.formatAnswersLore(contents, "-->", 35);
+ List formatted = GUIUtils.formatAnswersLore(contents, 35);
System.out.println("Formatted ");
formatted.forEach(System.out::println);
diff --git a/lobby/api/pom.xml b/lobby/api/pom.xml
index 2336b43..8853ad0 100644
--- a/lobby/api/pom.xml
+++ b/lobby/api/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.2.1
+ 1.2.2
../../pom.xml
diff --git a/lobby/plugin/pom.xml b/lobby/plugin/pom.xml
index ca6ca8e..784e801 100644
--- a/lobby/plugin/pom.xml
+++ b/lobby/plugin/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.2.1
+ 1.2.2
../../pom.xml
diff --git a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/conf/PluginConfig.java b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/conf/PluginConfig.java
index ebff52b..868beaf 100644
--- a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/conf/PluginConfig.java
+++ b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/conf/PluginConfig.java
@@ -3,10 +3,9 @@
import cc.carm.lib.configuration.core.ConfigurationRoot;
import cc.carm.lib.configuration.core.value.type.ConfiguredList;
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessage;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList;
-import com.artformgames.plugin.votepass.core.conf.CommonConfig;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import org.bukkit.Material;
public class PluginConfig extends ConfigurationRoot {
diff --git a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java
index 0a78a51..b1751f5 100644
--- a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java
+++ b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java
@@ -5,7 +5,7 @@
import cc.carm.lib.easyplugin.gui.paged.AutoPagedGUI;
import cc.carm.lib.easyplugin.utils.ColorParser;
import cc.carm.lib.easyplugin.utils.ItemStackFactory;
-import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredItem;
+import cc.carm.lib.mineconfiguration.bukkit.value.item.ConfiguredItem;
import com.artformgames.plugin.votepass.api.data.request.RequestAnswer;
import com.artformgames.plugin.votepass.api.data.request.RequestInformation;
import com.artformgames.plugin.votepass.core.conf.CommonConfig;
diff --git a/pom.xml b/pom.xml
index d3c656c..59ce173 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,14 +16,14 @@
1.5.8
0.4.7
- 2.8.4
+ 2.8.5
1.6
1.7.1-SNAPSHOT
com.artformgames
votepass-parent
- 1.2.1
+ 1.2.2
api
lobby/api