mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
comment
This commit is contained in:
parent
e572428e45
commit
029fbd7f00
@ -27,9 +27,12 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
import com.intellectualcrafters.plot.object.PlotComment;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
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;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
|
|
||||||
public class Comment extends SubCommand {
|
public class Comment extends SubCommand {
|
||||||
@ -39,10 +42,11 @@ public class Comment extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
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);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
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 String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");
|
||||||
final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
|
final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
|
||||||
plot.settings.addComment(comment);
|
plot.settings.addComment(comment);
|
||||||
DBFunc.setComment(plr.getWorld().getName(), plot, comment);
|
DBFunc.setComment(loc.getWorld(), plot, comment);
|
||||||
return sendMessage(plr, C.COMMENT_ADDED);
|
return sendMessage(plr, C.COMMENT_ADDED);
|
||||||
} else {
|
} else {
|
||||||
return sendMessage(plr, C.NO_PERMISSION, "plots.comment." + args[0].toLowerCase());
|
return sendMessage(plr, C.NO_PERMISSION, "plots.comment." + args[0].toLowerCase());
|
||||||
|
Loading…
Reference in New Issue
Block a user