This commit is contained in:
boy0001 2015-07-17 00:44:27 +10:00
parent 2e528073fd
commit 02120e7692
3 changed files with 12 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import com.intellectualcrafters.plot.object.comment.CommentInbox;
import com.intellectualcrafters.plot.object.comment.CommentManager;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan;
public class Inbox extends SubCommand {
public Inbox() {
@ -60,7 +61,7 @@ public class Inbox extends SubCommand {
max = comments.length;
}
final StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER_PAGED.s().replaceAll("plot","comment").replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "").replaceAll("%word%", "all")).append("\n");
string.append(StringMan.replaceAll(C.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur", page + 1, "%max", totalPages + 1, "%word", "all") + "\n");
PlotComment c;
// This might work xD
for (int x = (page * 12); x < max; x++) {

View File

@ -395,6 +395,7 @@ public enum C {
/*
* List
*/
COMMENT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% comments", "List"),
PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", "List"),
PLOT_LIST_HEADER("$1List of %word% plots", "List"),
PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"),

View File

@ -1,5 +1,6 @@
package com.intellectualcrafters.plot.util;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@ -20,4 +21,12 @@ public class StringMan {
}
return sb.toString();
}
public static String replaceAll(String string, Object... pairs) {
HashMap<String, String> replacements = new HashMap<>();
for (int i = 0; i < pairs.length; i+=2) {
replacements.put(pairs[i] + "", pairs[i+1] + "");
}
return replaceFromMap(string, replacements);
}
}