mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +01:00
[UNTESTED] Added plot commenting
This commit is contained in:
parent
2dc935eed6
commit
45d8556b87
@ -31,6 +31,9 @@ public enum C {
|
||||
* Comment
|
||||
*/
|
||||
COMMENT_SYNTAX("&cUse /plots comment <everyone|trusted|helper|owner|admin> <comment>"),
|
||||
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."),
|
||||
/*
|
||||
* Console
|
||||
*/
|
||||
|
@ -32,11 +32,13 @@ package com.intellectualcrafters.plot;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@ -326,7 +328,16 @@ public class Metrics {
|
||||
// enabled
|
||||
String pluginVersion = description.getVersion();
|
||||
String serverVersion = Bukkit.getVersion();
|
||||
int playersOnline = 1337; /** it's a collection for me o.o */
|
||||
int playersOnline = 0;
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class)
|
||||
playersOnline = ((Collection<?>)Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).invoke(null, new Object[0])).size();
|
||||
else
|
||||
playersOnline = ((Player[])Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).invoke(null, new Object[0])).length;
|
||||
}
|
||||
catch (NoSuchMethodException ex){}
|
||||
catch (InvocationTargetException ex){}
|
||||
catch (IllegalAccessException ex){}
|
||||
// END server software specific section -- all code below does not use
|
||||
// any code outside of this class / Java
|
||||
// Construct the post data
|
||||
|
@ -36,7 +36,7 @@ public class PlotSettings {
|
||||
*/
|
||||
private Biome biome;
|
||||
|
||||
private ArrayList<PlotComment> comments;
|
||||
private ArrayList<PlotComment> comments = null;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -169,13 +169,20 @@ public class PlotSettings {
|
||||
public String getLeaveMessage() {
|
||||
return "";
|
||||
}
|
||||
public ArrayList<PlotComment> getComments() {
|
||||
if (this.comments == null) {
|
||||
return new ArrayList<PlotComment>();
|
||||
public ArrayList<PlotComment> getComments(int tier) {
|
||||
ArrayList<PlotComment> c = new ArrayList<PlotComment>();
|
||||
for (PlotComment comment : this.comments) {
|
||||
if (comment.tier == tier) {
|
||||
c.add(comment);
|
||||
}
|
||||
}
|
||||
return this.comments;
|
||||
return c;
|
||||
}
|
||||
|
||||
public void setComments(ArrayList<PlotComment> comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public void addComment(PlotComment comment) {
|
||||
if (this.comments == null) {
|
||||
this.comments = new ArrayList<PlotComment>();
|
||||
|
@ -9,6 +9,8 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -45,7 +47,7 @@ public class Comment extends SubCommand {
|
||||
PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
|
||||
plot.settings.addComment(comment);
|
||||
|
||||
//DBFunc.addComment(...) // Can you do this?
|
||||
DBFunc.setComment(plr.getWorld().getName(), plot, comment);
|
||||
|
||||
|
||||
return true;
|
||||
|
@ -14,8 +14,10 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
@ -24,16 +26,16 @@ import org.bukkit.entity.Player;
|
||||
public class Inbox extends SubCommand {
|
||||
|
||||
public Inbox() {
|
||||
super(Command.INBOX, "Comment on a plot", "comment", CommandCategory.ACTIONS, true);
|
||||
super(Command.INBOX, "Review a the comments for a plot", "comment", CommandCategory.ACTIONS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player plr, String... args) {
|
||||
public boolean execute(final Player plr, final String... args) {
|
||||
if (!PlayerFunctions.isInPlot(plr)) {
|
||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||
if (!plot.hasOwner()) {
|
||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
@ -56,23 +58,114 @@ public class Inbox extends SubCommand {
|
||||
else {
|
||||
tier = 4;
|
||||
}
|
||||
ArrayList<PlotComment> comments = plot.settings.getComments();
|
||||
List<String> recipients = Arrays.asList(new String[] {"admin", "owner", "helper", "trusted", "everyone" });
|
||||
|
||||
int counter = 0;
|
||||
StringBuilder message = new StringBuilder();
|
||||
String prefix = "";
|
||||
for (PlotComment comment : comments) {
|
||||
if (comment.tier>=tier) {
|
||||
message.append(prefix + "&6[&c" + recipients.get(tier) + "&6] &7"+comment.senderName+"&f: "+comment.comment);
|
||||
prefix = "\n";
|
||||
if (args.length > 0) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "admin":
|
||||
if (tier<=0) {
|
||||
tier = 0;
|
||||
}
|
||||
else {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "owner":
|
||||
if (tier<=1) {
|
||||
tier = 1;
|
||||
}
|
||||
else {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "helper":
|
||||
if (tier<=2) {
|
||||
tier = 2;
|
||||
}
|
||||
else {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "trusted":
|
||||
if (tier<=3) {
|
||||
tier = 3;
|
||||
}
|
||||
else {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "everyone":
|
||||
if (tier<=4) {
|
||||
tier = 4;
|
||||
}
|
||||
else {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "default":
|
||||
PlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[] {"admin", "owner", "helper", "trusted", "everyone" }, tier, 4));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (counter==0) {
|
||||
PlayerFunctions.sendMessage(plr, "&cNo messages.");
|
||||
return false;
|
||||
}
|
||||
PlayerFunctions.sendMessage(plr, message.toString());
|
||||
return true;
|
||||
|
||||
final String world = plr.getWorld().getName();
|
||||
final int tier2 = tier;
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(PlotMain.getMain(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArrayList<PlotComment> comments = plot.settings.getComments(tier2);
|
||||
if (comments == null) {
|
||||
comments = DBFunc.getCommenst(world, plot, tier2);
|
||||
plot.settings.setComments(comments);
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
String[] split = args[1].toLowerCase().split(":");
|
||||
if (!split[0].equals("clear")) {
|
||||
PlayerFunctions.sendMessage(plr, "&c/plot inbox [tier] [clear][:#]");
|
||||
return;
|
||||
}
|
||||
if (split.length > 1) {
|
||||
try {
|
||||
int index = Integer.parseInt(split[1]);
|
||||
PlotComment comment = comments.get(index-1);
|
||||
DBFunc.removeComment(world, plot, comment);
|
||||
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
|
||||
return;
|
||||
}
|
||||
catch (Exception e) {
|
||||
PlayerFunctions.sendMessage(plr, "&cInvalid index:\n/plot inbox [tier] [clear][:#]");
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (PlotComment comment : comments) {
|
||||
DBFunc.removeComment(world, plot, comment);
|
||||
}
|
||||
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
final List<String> recipients = Arrays.asList(new String[] {"A", "O", "H", "T", "E" });
|
||||
int count = 1;
|
||||
StringBuilder message = new StringBuilder();
|
||||
String prefix = "";
|
||||
for (PlotComment comment : comments) {
|
||||
message.append(prefix + "["+count+"]&6[&c" + recipients.get(tier2) + "&6] &7"+comment.senderName+"&f: "+comment.comment);
|
||||
prefix = "\n";
|
||||
count++;
|
||||
}
|
||||
if (comments.size()==0) {
|
||||
message.append("&cNo messages.");
|
||||
}
|
||||
PlayerFunctions.sendMessage(plr, message.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.OfflinePlayer;
|
||||
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotComment;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
|
||||
/**
|
||||
@ -149,4 +150,10 @@ public abstract class AbstractDB {
|
||||
public abstract void setDenied(final String world, final Plot plot, final OfflinePlayer player);
|
||||
|
||||
public abstract double getRatings(final Plot plot);
|
||||
|
||||
public abstract void removeComment(String world, Plot plot, PlotComment comment);
|
||||
|
||||
public abstract void setComment(String world, Plot plot, PlotComment comment);
|
||||
|
||||
public abstract ArrayList<PlotComment> getComments(String world, Plot plot, int tier);
|
||||
}
|
||||
|
@ -13,8 +13,10 @@ import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotComment;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
|
||||
/**
|
||||
@ -159,6 +161,30 @@ public class DBFunc {
|
||||
*/
|
||||
public static UUID everyone = UUID.fromString("1-1-3-3-7");
|
||||
|
||||
/**
|
||||
* @param plot
|
||||
* @param comment
|
||||
*/
|
||||
public static void removeComment(final String world, final Plot plot, final PlotComment comment) {
|
||||
dbManager.removeComment(world, plot, comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param plot
|
||||
* @param comment
|
||||
*/
|
||||
public static void setComment(final String world, final Plot plot, final PlotComment comment) {
|
||||
dbManager.setComment(world, plot, comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param plot
|
||||
* @param comment
|
||||
*/
|
||||
public static ArrayList<PlotComment> getCommenst(final String world, final Plot plot, final int tier) {
|
||||
return dbManager.getComments(world, plot, tier);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param plot
|
||||
* @param player
|
||||
|
@ -10,6 +10,7 @@ package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.Logger.LogLevel;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -64,7 +65,9 @@ public class SQLManager extends AbstractDB {
|
||||
|
||||
@Override
|
||||
public void createAllSettingsAndHelpers(ArrayList<Plot> plots) {
|
||||
|
||||
// TODO SEVERE [ More than 5000 plots will fail in a single SQLite query.
|
||||
|
||||
HashMap<String, HashMap<PlotId, Integer>> stored = new HashMap<String, HashMap<PlotId, Integer>>();
|
||||
HashMap<Integer, ArrayList<UUID>> helpers = new HashMap<Integer, ArrayList<UUID>>();
|
||||
try {
|
||||
@ -235,7 +238,11 @@ public class SQLManager extends AbstractDB {
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_denied` (" + "`plot_plot_id` INT(11) NOT NULL,"
|
||||
+ "`user_uuid` VARCHAR(40) NOT NULL" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_helpers` (" + "`plot_plot_id` INT(11) NOT NULL,"
|
||||
+ "`user_uuid` VARCHAR(40) NOT NULL" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
||||
+ "`user_uuid` VARCHAR(40) NOT NULL" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_comments` (" + "`plot_plot_id` INT(11) NOT NULL,"
|
||||
+ "`comment` VARCHAR(40) NOT NULL,"
|
||||
+ "`tier` INT(11) NOT NULL,"
|
||||
+ "`sender` VARCHAR(40) NOT NULL" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_trusted` (" + "`plot_plot_id` INT(11) NOT NULL,"
|
||||
+ "`user_uuid` VARCHAR(40) NOT NULL" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_settings` (" + " `plot_plot_id` INT(11) NOT NULL,"
|
||||
@ -262,6 +269,10 @@ public class SQLManager extends AbstractDB {
|
||||
+ "`user_uuid` VARCHAR(40) NOT NULL" + ")");
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_trusted` (" + "`plot_plot_id` INT(11) NOT NULL,"
|
||||
+ "`user_uuid` VARCHAR(40) NOT NULL" + ")");
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_comments` (" + "`plot_plot_id` INT(11) NOT NULL,"
|
||||
+ "`comment` VARCHAR(40) NOT NULL,"
|
||||
+ "`tier` INT(11) NOT NULL,"
|
||||
+ "`sender` VARCHAR(40) NOT NULL" + ")");
|
||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_settings` (" + " `plot_plot_id` INT(11) NOT NULL,"
|
||||
+ " `biome` VARCHAR(45) DEFAULT 'FOREST'," + " `rain` INT(1) DEFAULT 0,"
|
||||
+ " `custom_time` TINYINT(1) DEFAULT '0'," + " `time` INT(11) DEFAULT '8000',"
|
||||
@ -515,8 +526,6 @@ public class SQLManager extends AbstractDB {
|
||||
|
||||
stmt = connection.createStatement();
|
||||
r = stmt.executeQuery("SELECT * FROM `" + PREFIX + "plot_settings`");
|
||||
String var;
|
||||
Object val;
|
||||
while (r.next()) {
|
||||
id = r.getInt("plot_plot_id");
|
||||
Plot plot = plots.get(id);
|
||||
@ -542,7 +551,6 @@ public class SQLManager extends AbstractDB {
|
||||
plot.settings.setAlias(alias);
|
||||
}
|
||||
|
||||
PlotHomePosition position = null;
|
||||
String pos = r.getString("position");
|
||||
if (pos!=null) {
|
||||
for (PlotHomePosition plotHomePosition : PlotHomePosition.values()) {
|
||||
@ -950,79 +958,80 @@ public class SQLManager extends AbstractDB {
|
||||
}
|
||||
return h;
|
||||
}
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private ArrayList<UUID> plotDenied(int id) {
|
||||
ArrayList<UUID> l = new ArrayList<UUID>();
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
stmt = connection.prepareStatement("SELECT `user_uuid` FROM `" + PREFIX + "plot_denied` WHERE `plot_plot_id` = ?");
|
||||
stmt.setInt(1, id);
|
||||
ResultSet r = stmt.executeQuery();
|
||||
UUID u;
|
||||
while (r.next()) {
|
||||
u = UUID.fromString(r.getString("user_uuid"));
|
||||
l.add(u);
|
||||
}
|
||||
stmt.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Logger.add(LogLevel.DANGER, "Failed to load denied for plot: " + id);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private ArrayList<UUID> plotHelpers(int id) {
|
||||
ArrayList<UUID> l = new ArrayList<UUID>();
|
||||
Statement stmt = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
ResultSet r = stmt.executeQuery("SELECT `user_uuid` FROM `" + PREFIX + "plot_helpers` WHERE `plot_plot_id` = " + id);
|
||||
UUID u;
|
||||
while (r.next()) {
|
||||
u = UUID.fromString(r.getString("user_uuid"));
|
||||
l.add(u);
|
||||
}
|
||||
stmt.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
Logger.add(LogLevel.WARNING, "Failed to load helpers for plot: " + id);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return l;
|
||||
}
|
||||
@Override
|
||||
public void removeComment(final String world, final Plot plot, final PlotComment comment) {
|
||||
runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
PreparedStatement statement =
|
||||
connection.prepareStatement("DELETE FROM `"+PREFIX+"plot_comments` WHERE `plot_plot_id` = ? AND `comment` = ? AND `tier` = ? AND `sender` = ?");
|
||||
statement.setInt(1, getId(world, plot.id));
|
||||
statement.setString(2, comment.comment);
|
||||
statement.setInt(3, comment.tier);
|
||||
statement.setString(4, comment.senderName);
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
Logger.add(LogLevel.WARNING, "Failed to remove helper for plot " + plot.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private ArrayList<UUID> plotTrusted(int id) {
|
||||
ArrayList<UUID> l = new ArrayList<UUID>();
|
||||
Statement stmt = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
ResultSet r = stmt.executeQuery("SELECT `user_uuid` FROM `" + PREFIX + "plot_trusted` WHERE `plot_plot_id` = " + id);
|
||||
UUID u;
|
||||
while (r.next()) {
|
||||
u = UUID.fromString(r.getString("user_uuid"));
|
||||
l.add(u);
|
||||
}
|
||||
stmt.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
Logger.add(LogLevel.WARNING, "Failed to load trusted users for plot: " + id);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<PlotComment> getComments(String world, Plot plot, int tier) {
|
||||
ArrayList<PlotComment> comments = new ArrayList<PlotComment>();
|
||||
try {
|
||||
PreparedStatement statement =
|
||||
connection.prepareStatement("SELECT `*` FROM `" + PREFIX + "plot_comments` WHERE `plot_plot_id` = ? AND `tier` = ?");
|
||||
statement.setInt(1, getId(plot.getWorld().getName(), plot.id));
|
||||
statement.setInt(2, tier);
|
||||
ResultSet set = statement.executeQuery();
|
||||
PlotComment comment;
|
||||
while (set.next()) {
|
||||
String sender = set.getString("sender");
|
||||
String msg = set.getString("comment");
|
||||
comment = new PlotComment(msg, sender, tier);
|
||||
comments.add(comment);
|
||||
}
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
Logger.add(LogLevel.WARNING, "Failed to fetch rating for plot " + plot.getId().toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComment(final String world, final Plot plot, final PlotComment comment) {
|
||||
runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
PreparedStatement statement =
|
||||
connection.prepareStatement("INSERT INTO `" + PREFIX + "plot_comments` (`plot_plot_id`, `comment`, `tier`, `sender`) VALUES(?,?,?,?)");
|
||||
statement.setInt(1, getId(world, plot.id));
|
||||
statement.setString(2, comment.comment);
|
||||
statement.setInt(3, comment.tier);
|
||||
statement.setString(4, comment.senderName);
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
Logger.add(LogLevel.WARNING, "Failed to remove helper for plot " + plot.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param plot
|
||||
* @param player
|
||||
@ -1193,4 +1202,5 @@ public class SQLManager extends AbstractDB {
|
||||
}
|
||||
return 0.0d;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -384,7 +384,9 @@ public class DefaultPlotManager extends PlotManager {
|
||||
@Override
|
||||
public boolean setWallFilling(World w, PlotWorld plotworld, PlotId plotid, PlotBlock plotblock) {
|
||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||
|
||||
if (dpw.ROAD_WIDTH==0) {
|
||||
return false;
|
||||
}
|
||||
Location bottom = PlotHelper.getPlotBottomLoc(w, plotid);
|
||||
Location top = PlotHelper.getPlotTopLoc(w, plotid);
|
||||
|
||||
@ -428,7 +430,9 @@ public class DefaultPlotManager extends PlotManager {
|
||||
@Override
|
||||
public boolean setWall(World w, PlotWorld plotworld, PlotId plotid, PlotBlock plotblock) {
|
||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||
|
||||
if (dpw.ROAD_WIDTH==0) {
|
||||
return false;
|
||||
}
|
||||
Location bottom = PlotHelper.getPlotBottomLoc(w, plotid);
|
||||
Location top = PlotHelper.getPlotTopLoc(w, plotid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user