mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixes #226
This commit is contained in:
parent
dabc551cc1
commit
1c0c28f5b1
@ -53,7 +53,7 @@ public class Comment extends SubCommand {
|
|||||||
if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) {
|
if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) {
|
||||||
if (Permissions.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) {
|
if (Permissions.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) {
|
||||||
final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");
|
final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");
|
||||||
final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
|
final PlotComment comment = new PlotComment(plot.id, text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
|
||||||
plot.settings.addComment(comment);
|
plot.settings.addComment(comment);
|
||||||
DBFunc.setComment(loc.getWorld(), plot, comment);
|
DBFunc.setComment(loc.getWorld(), plot, comment);
|
||||||
return sendMessage(plr, C.COMMENT_ADDED);
|
return sendMessage(plr, C.COMMENT_ADDED);
|
||||||
|
@ -171,11 +171,11 @@ public class Inbox extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E");
|
final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E");
|
||||||
int count = 1;
|
int count = 1;
|
||||||
final StringBuilder message = new StringBuilder();
|
final StringBuilder message = new StringBuilder(C.COMMENT_HEADER.s()+"\n");
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
for (final PlotComment comment : comments) {
|
for (final PlotComment comment : comments) {
|
||||||
message.append(prefix).append("&c[").append(count).append("]&6[").append(recipients.get(tier2 == -1 ? 0 : tier2)).append("] &7").append(comment.senderName).append("&f: ").append(comment.comment);
|
message.append(prefix).append("&c[").append(count).append("]&6[").append(recipients.get(tier2 == -1 ? 0 : tier2)).append("] &7").append(comment.senderName).append("&f: ").append(comment.comment);
|
||||||
prefix = "\n" + C.PREFIX;
|
prefix = "\n" + comment.id;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (comments.size() == 0) {
|
if (comments.size() == 0) {
|
||||||
|
@ -107,6 +107,7 @@ public enum C {
|
|||||||
INVALID_INBOX("$2That is not a valid inbox.\n$1Accepted values: %s"),
|
INVALID_INBOX("$2That is not a valid inbox.\n$1Accepted values: %s"),
|
||||||
COMMENT_REMOVED("$4Successfully deleted %s."),
|
COMMENT_REMOVED("$4Successfully deleted %s."),
|
||||||
COMMENT_ADDED("$4A comment has been left"),
|
COMMENT_ADDED("$4A comment has been left"),
|
||||||
|
COMMENT_HEADER("$2====== Comments ======"),
|
||||||
/*
|
/*
|
||||||
* Console
|
* Console
|
||||||
*/
|
*/
|
||||||
|
@ -1084,7 +1084,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
final String sender = set.getString("sender");
|
final String sender = set.getString("sender");
|
||||||
final String msg = set.getString("comment");
|
final String msg = set.getString("comment");
|
||||||
comment = new PlotComment(msg, sender, tier);
|
comment = new PlotComment(plot.id, msg, sender, tier);
|
||||||
comments.add(comment);
|
comments.add(comment);
|
||||||
}
|
}
|
||||||
statement.close();
|
statement.close();
|
||||||
|
@ -27,8 +27,10 @@ public class PlotComment {
|
|||||||
public final String comment;
|
public final String comment;
|
||||||
public final int tier;
|
public final int tier;
|
||||||
public final String senderName;
|
public final String senderName;
|
||||||
|
public final PlotId id;
|
||||||
|
|
||||||
public PlotComment(final String comment, final String senderName, final int tier) {
|
public PlotComment(final PlotId id, final String comment, final String senderName, final int tier) {
|
||||||
|
this.id = id;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
this.senderName = senderName;
|
this.senderName = senderName;
|
||||||
|
Loading…
Reference in New Issue
Block a user