mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
fixed comments not surviving restarts.
This commit is contained in:
parent
d7992eb587
commit
90856e4424
@ -815,7 +815,7 @@ public class PlotMain extends JavaPlugin implements Listener {
|
|||||||
options.put("plotme-convert.enabled", Settings.CONVERT_PLOTME);
|
options.put("plotme-convert.enabled", Settings.CONVERT_PLOTME);
|
||||||
options.put("claim.max-auto-area", Settings.MAX_AUTO_SIZE);
|
options.put("claim.max-auto-area", Settings.MAX_AUTO_SIZE);
|
||||||
options.put("UUID.offline", Settings.OFFLINE_MODE);
|
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("kill_road_mobs", Settings.KILL_ROAD_MOBS_DEFAULT);
|
||||||
options.put("mob_pathfinding", Settings.MOB_PATHFINDING_DEFAULT);
|
options.put("mob_pathfinding", Settings.MOB_PATHFINDING_DEFAULT);
|
||||||
options.put("console.color", Settings.CONSOLE_COLOR);
|
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.USE_PLOTME_ALIAS = config.getBoolean("plotme-alias");
|
||||||
Settings.CONVERT_PLOTME = config.getBoolean("plotme-convert.enabled");
|
Settings.CONVERT_PLOTME = config.getBoolean("plotme-convert.enabled");
|
||||||
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
|
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
|
||||||
Settings.WORLDGUARD = config.getBoolean("worldguard.enabled");
|
// Settings.WORLDGUARD = config.getBoolean("worldguard.enabled");
|
||||||
Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding");
|
Settings.MOB_PATHFINDING = config.getBoolean("mob_pathf"
|
||||||
|
+ "inding");
|
||||||
Settings.METRICS = config.getBoolean("metrics");
|
Settings.METRICS = config.getBoolean("metrics");
|
||||||
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
||||||
Settings.MAX_AUTO_SIZE = config.getInt("claim.max-auto-area");
|
Settings.MAX_AUTO_SIZE = config.getInt("claim.max-auto-area");
|
||||||
|
@ -52,7 +52,7 @@ public class Comment extends SubCommand {
|
|||||||
|
|
||||||
final List<String> recipients = Arrays.asList("admin", "owner", "helper", "trusted", "everyone");
|
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())) {
|
if (PlotMain.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), " ");
|
||||||
|
@ -183,8 +183,8 @@ public class Inbox extends SubCommand {
|
|||||||
final StringBuilder message = new StringBuilder();
|
final StringBuilder message = new StringBuilder();
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
for (final PlotComment comment : comments) {
|
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);
|
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";
|
prefix = "\n" + C.PREFIX;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (comments.size() == 0) {
|
if (comments.size() == 0) {
|
||||||
|
@ -1007,12 +1007,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
final PreparedStatement statement;
|
final PreparedStatement statement;
|
||||||
String comparison = below ? ">=" : "=";
|
String comparison = below ? ">=" : "=";
|
||||||
if (plot != null) {
|
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(1, getId(plot.getWorld().getName(), plot.id));
|
||||||
statement.setInt(2, tier);
|
statement.setInt(2, tier);
|
||||||
}
|
}
|
||||||
else {
|
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);
|
statement.setInt(1, tier);
|
||||||
}
|
}
|
||||||
final ResultSet set = statement.executeQuery();
|
final ResultSet set = statement.executeQuery();
|
||||||
@ -1025,7 +1025,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return comments;
|
return comments;
|
||||||
@ -1046,7 +1046,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
e.printStackTrace();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -156,19 +156,19 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (PlotHelper.worldBorder.containsKey(worldname)) {
|
if (PlotHelper.worldBorder.containsKey(worldname)) {
|
||||||
int border = PlotHelper.getBorder(worldname);
|
int border = PlotHelper.getBorder(worldname);
|
||||||
boolean passed = false;
|
boolean passed = false;
|
||||||
if (t.getBlockX() >= border) {
|
if (t.getBlockX() > border) {
|
||||||
q.setX(border);
|
q.setX(border);
|
||||||
passed = true;
|
passed = true;
|
||||||
}
|
}
|
||||||
else if (t.getBlockX() <= -border) {
|
else if (t.getBlockX() < -border) {
|
||||||
q.setX(-border);
|
q.setX(-border);
|
||||||
passed = true;
|
passed = true;
|
||||||
}
|
}
|
||||||
if (t.getBlockZ() >= border) {
|
if (t.getBlockZ() > border) {
|
||||||
q.setZ(border);
|
q.setZ(border);
|
||||||
passed = true;
|
passed = true;
|
||||||
}
|
}
|
||||||
else if (t.getBlockZ() <= -border) {
|
else if (t.getBlockZ() < -border) {
|
||||||
q.setZ(-border);
|
q.setZ(-border);
|
||||||
passed = true;
|
passed = true;
|
||||||
}
|
}
|
||||||
@ -181,15 +181,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
Plot plot = getCurrentPlot(q);
|
Plot plot = getCurrentPlot(q);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.equals(getCurrentPlot(f))) {
|
if (!plot.equals(getCurrentPlot(f))) {
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (plot.deny_entry(player)) {
|
if (plot.deny_entry(player)) {
|
||||||
if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) {
|
if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
plotEntry(player, plot);
|
||||||
|
}
|
||||||
} else if (leftPlot(f, q)) {
|
} else if (leftPlot(f, q)) {
|
||||||
plot = getCurrentPlot(event.getFrom());
|
plot = getCurrentPlot(event.getFrom());
|
||||||
plotExit(player, plot);
|
plotExit(player, plot);
|
||||||
|
@ -157,7 +157,7 @@ import com.intellectualcrafters.plot.util.PlotHelper;
|
|||||||
public ArrayList<PlotComment> getComments(final int tier) {
|
public ArrayList<PlotComment> getComments(final int tier) {
|
||||||
final ArrayList<PlotComment> c = new ArrayList<>();
|
final ArrayList<PlotComment> c = new ArrayList<>();
|
||||||
if (this.comments == null) {
|
if (this.comments == null) {
|
||||||
return c;
|
return null;
|
||||||
}
|
}
|
||||||
for (final PlotComment comment : this.comments) {
|
for (final PlotComment comment : this.comments) {
|
||||||
if (comment.tier == tier) {
|
if (comment.tier == tier) {
|
||||||
|
Loading…
Reference in New Issue
Block a user