From 029fbd7f00b909607519a494da872e52aeac1bbe Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 22 Feb 2015 17:06:45 +1100 Subject: [PATCH] comment --- .../intellectualcrafters/plot/commands/Comment.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java index a04e250de..4ed631d4e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java @@ -27,9 +27,12 @@ import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotComment; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; public class Comment extends SubCommand { @@ -39,10 +42,11 @@ public class Comment extends SubCommand { @Override public boolean execute(final PlotPlayer plr, final String... args) { - if (!BukkitPlayerFunctions.isInPlot(plr)) { + Location loc = plr.getLocation(); + Plot plot = MainUtil.getPlot(loc); + if (plot == null) { return sendMessage(plr, C.NOT_IN_PLOT); } - final Plot plot = MainUtil.getPlot(loc); if (!plot.hasOwner()) { return sendMessage(plr, C.NOT_IN_PLOT); } @@ -52,7 +56,7 @@ 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); + DBFunc.setComment(loc.getWorld(), plot, comment); return sendMessage(plr, C.COMMENT_ADDED); } else { return sendMessage(plr, C.NO_PERMISSION, "plots.comment." + args[0].toLowerCase());