mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-04 09:10:17 +01:00
Fixed #399
This commit is contained in:
parent
2e528073fd
commit
02120e7692
@ -33,6 +33,7 @@ import com.intellectualcrafters.plot.object.comment.CommentInbox;
|
|||||||
import com.intellectualcrafters.plot.object.comment.CommentManager;
|
import com.intellectualcrafters.plot.object.comment.CommentManager;
|
||||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
|
||||||
public class Inbox extends SubCommand {
|
public class Inbox extends SubCommand {
|
||||||
public Inbox() {
|
public Inbox() {
|
||||||
@ -60,7 +61,7 @@ public class Inbox extends SubCommand {
|
|||||||
max = comments.length;
|
max = comments.length;
|
||||||
}
|
}
|
||||||
final StringBuilder string = new StringBuilder();
|
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;
|
PlotComment c;
|
||||||
// This might work xD
|
// This might work xD
|
||||||
for (int x = (page * 12); x < max; x++) {
|
for (int x = (page * 12); x < max; x++) {
|
||||||
|
@ -395,6 +395,7 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* List
|
* 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_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", "List"),
|
||||||
PLOT_LIST_HEADER("$1List of %word% plots", "List"),
|
PLOT_LIST_HEADER("$1List of %word% plots", "List"),
|
||||||
PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"),
|
PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@ -20,4 +21,12 @@ public class StringMan {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user