ratings api
misc-cap
other tweakes
This commit is contained in:
Jesse Boyd
2015-10-27 10:57:34 +11:00
parent 2e79f3d0f8
commit 95feaed870
18 changed files with 504 additions and 163 deletions

View File

@ -80,8 +80,8 @@ public class MainCommand extends CommandManager<PlotPlayer> {
createCommand(new DebugAllowUnsafe());
createCommand(new RegenAllRoads());
createCommand(new Claim());
createCommand(new Auto());
createCommand(new Auto());
createCommand(new Visit());
createCommand(new Home());
createCommand(new TP());
createCommand(new Set());
@ -171,47 +171,6 @@ public class MainCommand extends CommandManager<PlotPlayer> {
}
return commands;
}
//// public static List<String> helpMenu(final PlotPlayer player, final CommandCategory category, int page) {
// List<Command<PlotPlayer>> commands;
// // commands = getCommands(category, player);
// // final int totalPages = ((int) Math.ceil(12 * (commands.size()) /
// // 100));
// final int perPage = 5;
// // final int totalPages = (commands.size() / perPage) + (commands.size() % perPage == 0 ? 0 : 1);
// // if (page > totalPages) {
// // page = totalPages;
// // }
// int max = (page * perPage) + perPage;
// // if (max > commands.size()) {
// // max = commands.size();
// // }
// final List<String> help = new ArrayList<>();
// help.add(C.HELP_HEADER.s());
// // HELP_PAGE_HEADER("&cCategory: &6%category%&c, Page: %current%&c/&6%max%&c, Displaying: &6%dis%&c/&6%total%"),
// // help.add(C.HELP_PAGE_HEADER.s().replace("%category%", category == null ? "All" : category.toString()).replace("%current%", "" + (page + 1)).replace("%max%", "" + (totalPages)).replace("%dis%", "" + perPage).replace("%total%", "" + commands.size()));
// Command cmd;
// // HELP_CATEGORY("&cCategory: &6%category%&c, Page: %current%&c/&6%max%&c, Displaying: &6%dis%&c/&6%total%"),
// // help.add(C.HELP_CATEGORY.s().replace("%category%", category == null ? "All" : category.toString()).replace("%current%", "" + (page + 1)).replace("%max%", "" + (totalPages)).replace("%dis%", "" + perPage).replace("%total%", "" + commands.size()));
// // Command<PlotPlayer> cmd;
// final int start = page * perPage;
// for (int x = start; x < max; x++) {
// // cmd = commands.get(x);
// String s = C.HELP_ITEM.s();
// if (cmd.getAliases().size() > 0) {
// s = s.replace("%alias%", StringMan.join(cmd.getAliases(), "|"));
// }
// else {
// s = s.replace("%alias%", "");
// }
// s = s.replace("%usage%", cmd.getUsage().contains("plot") ? cmd.getUsage() : "/plot " + cmd.getUsage()).replace("%cmd%", cmd.getCommand()).replace("%desc%", cmd.getDescription()).replace("[]", "");
// help.add(s);
// }
// if (help.size() < 2) {
// help.add(C.NO_COMMANDS.s());
// }
// return help;
// }
public static void displayHelp(final PlotPlayer player, String cat, int page, final String label) {
CommandCategory catEnum = null;
@ -322,6 +281,11 @@ public class MainCommand extends CommandManager<PlotPlayer> {
public int getMatch(String[] args, Command<PlotPlayer> cmd) {
int count = 0;
String perm = cmd.getPermission();
HashSet<String> desc = new HashSet<String>();
for (String alias : cmd.getAliases()) {
if (alias.startsWith(args[0])) {
count += 5;
}
}
for (String word : cmd.getDescription().split(" ")) {
desc.add(word);

View File

@ -61,7 +61,7 @@ public class Rate extends SubCommand {
public boolean onCommand(final PlotPlayer player, final String[] args) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("next")) {
final ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
final ArrayList<Plot> plots = new ArrayList<>(PS.get().getBasePlots());
Collections.sort(plots, new Comparator<Plot>() {
@Override
public int compare(final Plot p1, final Plot p2) {
@ -96,7 +96,7 @@ public class Rate extends SubCommand {
}
}
final Location loc = player.getLocation();
final Plot plot = MainUtil.getPlotAbs(loc);
final Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
}

View File

@ -26,11 +26,9 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.PS.SortType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
@ -45,7 +43,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
command = "visit",
permission = "plots.visit",
description = "Visit someones plot",
usage = "/plot visit <player|alias|world|id> [#]",
usage = "/plot visit [player|alias|world|id] [#]",
aliases = { "v" },
requiredType = RequiredType.NONE,
category = CommandCategory.TELEPORT)

View File

@ -46,7 +46,13 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(command = "list", aliases = { "l" }, description = "List plots", permission = "plots.list", category = CommandCategory.INFO)
@CommandDeclaration(
command = "list",
aliases = { "l" },
description = "List plots",
permission = "plots.list",
category = CommandCategory.INFO,
usage = "/plot list <forsale|mine|shared|world|top|all|unowned|unknown|player|world|done> [#]")
public class list extends SubCommand {
private String[] getArgumentList(final PlotPlayer player) {