mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-08-07 13:03:06 +00:00
Working on plot commenting... Can you do the DB stuff?
This commit is contained in:
parent
6a050f5287
commit
cfbf0086fa
9 changed files with 184 additions and 4 deletions
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
|
||||
* and/or monetize any of our intellectual property. IntellectualCrafters is not
|
||||
* affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
||||
*
|
||||
* >> File = Clear.java >> Generated by: Citymonstret at 2014-08-09 01:41
|
||||
*/
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-01.
|
||||
*/
|
||||
public class Comment extends SubCommand {
|
||||
|
||||
public Comment() {
|
||||
super(Command.COMMENT, "Comment on a plot", "comment", CommandCategory.ACTIONS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player plr, String... args) {
|
||||
if (!PlayerFunctions.isInPlot(plr)) {
|
||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||
if (!plot.hasOwner()) {
|
||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
|
||||
List<String> recipients = Arrays.asList(new String[] {"admin", "owner", "helper", "trusted", "everyone" });
|
||||
|
||||
if (args.length==2 && recipients.contains(args[0].toLowerCase())) {
|
||||
|
||||
if (PlotMain.hasPermission(plr, "plots.comment."+args[0].toLowerCase())) {
|
||||
String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " ");
|
||||
PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase()));
|
||||
plot.settings.addComment(comment);
|
||||
|
||||
DBFunc.addComment(...) // Can you do this?
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.comment."+args[0].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
PlayerFunctions.sendMessage(plr, C.COMMENT_SYNTAX);
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue