fixed comments not surviving restarts.

This commit is contained in:
Jesse Boyd 2015-01-24 18:17:11 -07:00
parent d7992eb587
commit 90856e4424
6 changed files with 23 additions and 23 deletions

View File

@ -815,7 +815,7 @@ public class PlotMain extends JavaPlugin implements Listener {
options.put("plotme-convert.enabled", Settings.CONVERT_PLOTME);
options.put("claim.max-auto-area", Settings.MAX_AUTO_SIZE);
options.put("UUID.offline", Settings.OFFLINE_MODE);
options.put("worldguard.enabled", Settings.WORLDGUARD);
// options.put("worldguard.enabled", Settings.WORLDGUARD);
options.put("kill_road_mobs", Settings.KILL_ROAD_MOBS_DEFAULT);
options.put("mob_pathfinding", Settings.MOB_PATHFINDING_DEFAULT);
options.put("console.color", Settings.CONSOLE_COLOR);
@ -850,8 +850,9 @@ public class PlotMain extends JavaPlugin implements Listener {
Settings.USE_PLOTME_ALIAS = config.getBoolean("plotme-alias");
Settings.CONVERT_PLOTME = config.getBoolean("plotme-convert.enabled");
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
Settings.WORLDGUARD = config.getBoolean("worldguard.enabled");
Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding");
// Settings.WORLDGUARD = config.getBoolean("worldguard.enabled");
Settings.MOB_PATHFINDING = config.getBoolean("mob_pathf"
+ "inding");
Settings.METRICS = config.getBoolean("metrics");
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
Settings.MAX_AUTO_SIZE = config.getInt("claim.max-auto-area");

View File

@ -52,7 +52,7 @@ public class Comment extends SubCommand {
final List<String> recipients = Arrays.asList("admin", "owner", "helper", "trusted", "everyone");
if ((args.length == 2) && recipients.contains(args[0].toLowerCase())) {
if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) {
if (PlotMain.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) {
final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");

View File

@ -183,8 +183,8 @@ public class Inbox extends SubCommand {
final StringBuilder message = new StringBuilder();
String prefix = "";
for (final PlotComment comment : comments) {
message.append(prefix).append("[").append(count).append("]&6[&c").append(recipients.get(tier2)).append("&6] &7").append(comment.senderName).append("&f: ").append(comment.comment);
prefix = "\n";
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;
count++;
}
if (comments.size() == 0) {

View File

@ -1007,12 +1007,12 @@ public class SQLManager implements AbstractDB {
final PreparedStatement statement;
String comparison = below ? ">=" : "=";
if (plot != null) {
statement = this.connection.prepareStatement("SELECT `*` FROM `" + this.prefix + "plot_comments` WHERE `plot_plot_id` = ? AND `tier` " + comparison + " ?");
statement = this.connection.prepareStatement("SELECT * FROM `" + this.prefix + "plot_comments` WHERE `plot_plot_id` = ? AND `tier` " + comparison + " ?");
statement.setInt(1, getId(plot.getWorld().getName(), plot.id));
statement.setInt(2, tier);
}
else {
statement = this.connection.prepareStatement("SELECT `*` FROM `" + this.prefix + "plot_comments` WHERE `tier` " + comparison + " ?");
statement = this.connection.prepareStatement("SELECT * FROM `" + this.prefix + "plot_comments` WHERE `tier` " + comparison + " ?");
statement.setInt(1, tier);
}
final ResultSet set = statement.executeQuery();
@ -1025,7 +1025,7 @@ public class SQLManager implements AbstractDB {
}
statement.close();
} catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString());
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch comment");
e.printStackTrace();
}
return comments;
@ -1046,7 +1046,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for plot " + plot.id);
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to set comment for plot " + plot.id);
}
}
});

View File

@ -156,19 +156,19 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (PlotHelper.worldBorder.containsKey(worldname)) {
int border = PlotHelper.getBorder(worldname);
boolean passed = false;
if (t.getBlockX() >= border) {
if (t.getBlockX() > border) {
q.setX(border);
passed = true;
}
else if (t.getBlockX() <= -border) {
else if (t.getBlockX() < -border) {
q.setX(-border);
passed = true;
}
if (t.getBlockZ() >= border) {
if (t.getBlockZ() > border) {
q.setZ(border);
passed = true;
}
else if (t.getBlockZ() <= -border) {
else if (t.getBlockZ() < -border) {
q.setZ(-border);
passed = true;
}
@ -181,15 +181,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Plot plot = getCurrentPlot(q);
if (plot != null) {
if (!plot.equals(getCurrentPlot(f))) {
event.setCancelled(true);
return;
if (plot.deny_entry(player)) {
if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) {
event.setCancelled(true);
return;
}
}
plotEntry(player, plot);
}
if (plot.deny_entry(player)) {
if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) {
event.setCancelled(true);
return;
}
}
} else if (leftPlot(f, q)) {
plot = getCurrentPlot(event.getFrom());
plotExit(player, plot);

View File

@ -157,7 +157,7 @@ import com.intellectualcrafters.plot.util.PlotHelper;
public ArrayList<PlotComment> getComments(final int tier) {
final ArrayList<PlotComment> c = new ArrayList<>();
if (this.comments == null) {
return c;
return null;
}
for (final PlotComment comment : this.comments) {
if (comment.tier == tier) {