mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
plot inbox tweaks
This commit is contained in:
parent
8ca654900d
commit
040045eed5
@ -84,6 +84,9 @@ public class Buy extends SubCommand {
|
||||
if (!plot.hasOwner()) {
|
||||
return sendMessage(plr, C.PLOT_UNOWNED);
|
||||
}
|
||||
if (plot.owner.equals(UUIDHandler.getUUID(plr))) {
|
||||
return sendMessage(plr, C.CANNOT_BUY_OWN);
|
||||
}
|
||||
Flag flag = FlagManager.getPlotFlag(plot, "price");
|
||||
if (flag == null) {
|
||||
return sendMessage(plr, C.NOT_FOR_SALE);
|
||||
@ -110,6 +113,7 @@ public class Buy extends SubCommand {
|
||||
if (owner != null) {
|
||||
sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), initPrice + "");
|
||||
}
|
||||
FlagManager.removePlotFlag(plot, "price");
|
||||
}
|
||||
plot.owner = UUIDHandler.getUUID(plr);
|
||||
DBFunc.setOwner(plot, plot.owner);
|
||||
|
@ -36,7 +36,7 @@ public enum Command {
|
||||
// (Rating system) (ratings can be stored as the average, and number of
|
||||
// ratings)
|
||||
// - /plot rate <number out of 10>
|
||||
BUY("b"),
|
||||
BUY("buy","b"),
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -57,10 +57,8 @@ public class Comment extends SubCommand {
|
||||
final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");
|
||||
final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
|
||||
plot.settings.addComment(comment);
|
||||
|
||||
DBFunc.setComment(plr.getWorld().getName(), plot, comment);
|
||||
|
||||
return true;
|
||||
return sendMessage(plr, C.COMMENT_ADDED);
|
||||
} else {
|
||||
return sendMessage(plr, C.NO_PERMISSION, "plots.comment." + args[0].toLowerCase());
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import java.util.UUID;
|
||||
public class Inbox extends SubCommand {
|
||||
|
||||
public Inbox() {
|
||||
super(Command.INBOX, "Review a the comments for a plot", "inbox", CommandCategory.ACTIONS, true);
|
||||
super(Command.INBOX, "Review the comments for a plot", "inbox", CommandCategory.ACTIONS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,7 +125,7 @@ public class Inbox extends SubCommand {
|
||||
public void run() {
|
||||
ArrayList<PlotComment> comments = plot.settings.getComments(tier2);
|
||||
if (comments == null) {
|
||||
comments = DBFunc.getCommenst(world, plot, tier2);
|
||||
comments = DBFunc.getComments(world, plot, tier2);
|
||||
plot.settings.setComments(comments);
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,11 @@ public class list extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("forsale") && (plr != null)) {
|
||||
if (PlotMain.economy == null) {
|
||||
return sendMessage(plr, C.ECON_DISABLED);
|
||||
}
|
||||
final StringBuilder string = new StringBuilder();
|
||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "your")).append("\n");
|
||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "buyable")).append("\n");
|
||||
int idx = 0;
|
||||
for (final Plot p : PlotMain.getPlots(plr.getWorld()).values()) {
|
||||
Flag price = FlagManager.getPlotFlag(p, "price");
|
||||
@ -85,7 +88,7 @@ public class list extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PLOTS);
|
||||
return true;
|
||||
}
|
||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "Includes").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
||||
PlayerFunctions.sendMessage(plr, string.toString());
|
||||
return true;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ public enum C {
|
||||
INVALID_INBOX("&cThat is not a valid inbox.\n&6Accepted values: %s"),
|
||||
NO_PERM_INBOX("&cYou do not have permission to read that inbox."),
|
||||
COMMENT_REMOVED("&aSuccessfully deleted %s."),
|
||||
COMMENT_ADDED("&aA comment has been left"),
|
||||
/*
|
||||
* Console
|
||||
*/
|
||||
@ -85,6 +86,7 @@ public enum C {
|
||||
ECON_DISABLED("&cEconomy is not enabled"),
|
||||
CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"),
|
||||
NOT_FOR_SALE("&cThis plot is not for sale"),
|
||||
CANNOT_BUY_OWN("&cYou cannot buy your own plot"),
|
||||
PLOT_SOLD("&aYour plot; &6%s&a, has been sold to &6%s&a for &6$%s"),
|
||||
CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"),
|
||||
ADDED_BALANCE("&6%s &chas been added to your balance"),
|
||||
|
@ -214,7 +214,7 @@ public class DBFunc {
|
||||
/**
|
||||
* @param plot
|
||||
*/
|
||||
public static ArrayList<PlotComment> getCommenst(final String world, final Plot plot, final int tier) {
|
||||
public static ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier) {
|
||||
return dbManager.getComments(world, plot, tier);
|
||||
}
|
||||
|
||||
|
@ -982,7 +982,7 @@ public class SQLManager implements AbstractDB {
|
||||
public ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier) {
|
||||
final ArrayList<PlotComment> comments = new ArrayList<PlotComment>();
|
||||
try {
|
||||
final PreparedStatement statement = this.connection.prepareStatement("SELECT `*` FROM `" + this.prefix + "plot_comments` WHERE `plot_plot_id` = ? AND `tier` = ?");
|
||||
final PreparedStatement statement = this.connection.prepareStatement("SELECT `*` FROM `" + this.prefix + "plot_comments` WHERE `plot_plot_id` = ? AND `tier` <= ?");
|
||||
statement.setInt(1, getId(plot.getWorld().getName(), plot.id));
|
||||
statement.setInt(2, tier);
|
||||
final ResultSet set = statement.executeQuery();
|
||||
|
Loading…
Reference in New Issue
Block a user