mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-09 09:59:48 +01:00
Merge pull request #1 from IntellectualCrafters/master
Update to current state
This commit is contained in:
commit
6d837dbf4c
@ -10,6 +10,9 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@ -139,12 +142,36 @@ public class PlotSquared {
|
|||||||
return new LinkedHashSet<>(newplots);
|
return new LinkedHashSet<>(newplots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LinkedHashSet<Plot> getPlotsSorted() {
|
public static ArrayList<Plot> sortPlots(Collection<Plot> plots) {
|
||||||
final ArrayList<Plot> newplots = new ArrayList<>();
|
ArrayList<Plot> newPlots = new ArrayList<>();
|
||||||
for (final HashMap<PlotId, Plot> world : plots.values()) {
|
newPlots.addAll(plots);
|
||||||
newplots.addAll(world.values());
|
Collections.sort(newPlots, new Comparator<Plot>() {
|
||||||
}
|
@Override
|
||||||
return new LinkedHashSet<>(newplots);
|
public int compare(Plot p1, Plot p2) {
|
||||||
|
return p1.hashCode() + p1.world.hashCode() - p2.hashCode() + p2.world.hashCode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newPlots;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Plot> sortPlots(Collection<Plot> plots, final String priorityWorld) {
|
||||||
|
ArrayList<Plot> newPlots = new ArrayList<>();
|
||||||
|
newPlots.addAll(plots);
|
||||||
|
Collections.sort(newPlots, new Comparator<Plot>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Plot p1, Plot p2) {
|
||||||
|
int w1 = 0;
|
||||||
|
int w2 = 0;
|
||||||
|
if (!p1.world.equals(priorityWorld)) {
|
||||||
|
w1 = p1.hashCode();
|
||||||
|
}
|
||||||
|
if (!p2.world.equals(priorityWorld)) {
|
||||||
|
w2 = p2.hashCode();
|
||||||
|
}
|
||||||
|
return p1.hashCode() + w1 - p2.hashCode() - w2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newPlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Plot> getPlots(final String world, final String player) {
|
public static Set<Plot> getPlots(final String world, final String player) {
|
||||||
@ -193,7 +220,10 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Plot> getPlots(final PlotPlayer player) {
|
public static Set<Plot> getPlots(final PlotPlayer player) {
|
||||||
final UUID uuid = player.getUUID();
|
return getPlots(player.getUUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<Plot> getPlots(final UUID uuid) {
|
||||||
final ArrayList<Plot> myplots = new ArrayList<>();
|
final ArrayList<Plot> myplots = new ArrayList<>();
|
||||||
for (final String world : plots.keySet()) {
|
for (final String world : plots.keySet()) {
|
||||||
if (isPlotWorld(world)) {
|
if (isPlotWorld(world)) {
|
||||||
|
@ -20,22 +20,12 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
|
||||||
import com.intellectualcrafters.plot.object.CmdInstance;
|
import com.intellectualcrafters.plot.object.CmdInstance;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
|
||||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -47,7 +37,6 @@ public class Confirm extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
String name = plr.getName();
|
|
||||||
CmdInstance command = CmdConfirm.getPending(plr);
|
CmdInstance command = CmdConfirm.getPending(plr);
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
MainUtil.sendMessage(plr, C.FAILED_CONFIRM);
|
MainUtil.sendMessage(plr, C.FAILED_CONFIRM);
|
||||||
|
@ -22,12 +22,10 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
@ -20,7 +20,10 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
@ -28,7 +31,6 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
@ -53,127 +55,180 @@ public class list extends SubCommand {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void noArgs(PlotPlayer plr) {
|
||||||
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
|
||||||
|
if (plr != null) {
|
||||||
|
if (PlotSquared.economy != null) {
|
||||||
|
builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "forsale", "<player>", "<world>"}));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "<player>", "<world>"}));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
builder.append(getArgumentList(new String[] { "world", "all", "unowned", "unknown", "<player>", "<world>"}));
|
||||||
|
}
|
||||||
|
MainUtil.sendMessage(plr, builder.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
noArgs(plr);
|
||||||
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
|
return false;
|
||||||
if (plr != null) {
|
|
||||||
builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "forsale" }));
|
|
||||||
} else {
|
|
||||||
builder.append(getArgumentList(new String[] { "all" }));
|
|
||||||
}
|
|
||||||
MainUtil.sendMessage(plr, builder.toString());
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("forsale") && (plr != null)) {
|
int page = 0;
|
||||||
if (PlotSquared.economy == null) {
|
if (args.length > 1) {
|
||||||
return sendMessage(plr, C.ECON_DISABLED);
|
try {
|
||||||
}
|
page = Integer.parseInt(args[1]);
|
||||||
final StringBuilder string = new StringBuilder();
|
--page;
|
||||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "buyable")).append("\n");
|
if (page < 0) {
|
||||||
int idx = 0;
|
|
||||||
for (final Plot p : PlotSquared.getPlots(plr.getLocation().getWorld()).values()) {
|
|
||||||
final Flag price = FlagManager.getPlotFlag(p, "price");
|
|
||||||
if (price != null) {
|
|
||||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", idx + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", price.getValueString()).replaceAll("%owner", getName(p.owner))).append("\n");
|
|
||||||
idx++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (idx == 0) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "Includes").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
|
||||||
MainUtil.sendMessage(plr, string.toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("mine") && (plr != null)) {
|
|
||||||
final StringBuilder string = new StringBuilder();
|
|
||||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "your")).append("\n");
|
|
||||||
int idx = 0;
|
|
||||||
for (final Plot p : PlotSquared.getPlots(plr)) {
|
|
||||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", idx + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
|
||||||
idx++;
|
|
||||||
}
|
|
||||||
if (idx == 0) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
|
|
||||||
MainUtil.sendMessage(plr, string.toString());
|
|
||||||
return true;
|
|
||||||
} else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
|
|
||||||
final StringBuilder string = new StringBuilder();
|
|
||||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all")).append("\n");
|
|
||||||
for (final Plot p : PlotSquared.getPlotsSorted()) {
|
|
||||||
if (p.helpers.contains(UUIDHandler.getUUID(plr))) {
|
|
||||||
string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
|
|
||||||
MainUtil.sendMessage(plr, string.toString());
|
|
||||||
return true;
|
|
||||||
} else if (args[0].equalsIgnoreCase("all")) {
|
|
||||||
// Current page
|
|
||||||
int page = 0;
|
|
||||||
// is a page specified? else use 0
|
|
||||||
if (args.length > 1) {
|
|
||||||
try {
|
|
||||||
page = Integer.parseInt(args[1]);
|
|
||||||
--page;
|
|
||||||
if (page < 0) {
|
|
||||||
page = 0;
|
|
||||||
}
|
|
||||||
} catch (final Exception e) {
|
|
||||||
page = 0;
|
page = 0;
|
||||||
}
|
}
|
||||||
|
} catch (final Exception e) {
|
||||||
|
page = 0;
|
||||||
}
|
}
|
||||||
// Get the total pages
|
}
|
||||||
// int totalPages = ((int) Math.ceil(12 *
|
|
||||||
// (PlotSquared.getPlotsSorted().size()) / 100));
|
Collection<Plot> plots = null;
|
||||||
final int totalPages = (int) Math.ceil(PlotSquared.getPlotsSorted().size() / 12);
|
|
||||||
if (page > totalPages) {
|
String world;
|
||||||
page = totalPages;
|
if (plr != null) {
|
||||||
|
world = plr.getLocation().getWorld();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Set<String> worlds = PlotSquared.getPlotWorlds();
|
||||||
|
if (worlds.size() == 0) {
|
||||||
|
world = "world";
|
||||||
}
|
}
|
||||||
// Only display 12!
|
else {
|
||||||
int max = (page * 12) + 12;
|
world = worlds.iterator().next();
|
||||||
if (max > PlotSquared.getPlotsSorted().size()) {
|
|
||||||
max = PlotSquared.getPlotsSorted().size();
|
|
||||||
}
|
}
|
||||||
final StringBuilder string = new StringBuilder();
|
}
|
||||||
string.append(C.PLOT_LIST_HEADER_PAGED.s().replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "").replaceAll("%word%", "all")).append("\n");
|
|
||||||
Plot p;
|
String arg = args[0].toLowerCase();
|
||||||
// This might work xD
|
switch (arg) {
|
||||||
for (int x = (page * 12); x < max; x++) {
|
case "mine": {
|
||||||
p = (Plot) PlotSquared.getPlotsSorted().toArray()[x];
|
if (plr == null) {
|
||||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
break;
|
||||||
|
}
|
||||||
|
plots = PlotSquared.getPlots(plr);
|
||||||
}
|
}
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotSquared.getPlotsSorted().size() + "").replaceAll("%plot%", PlotSquared.getPlotsSorted().size() == 1 ? "plot" : "plots"));
|
case "shared": {
|
||||||
MainUtil.sendMessage(plr, string.toString());
|
if (plr == null) {
|
||||||
return true;
|
break;
|
||||||
} else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
|
}
|
||||||
final StringBuilder string = new StringBuilder();
|
for (Plot plot : PlotSquared.getPlots()) {
|
||||||
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all")).append("\n");
|
if (plot.helpers.contains(plr.getUUID()) || plot.trusted.contains(plr.getUUID())) {
|
||||||
final HashMap<PlotId, Plot> plots = PlotSquared.getPlots(plr.getLocation().getWorld());
|
plots.add(plot);
|
||||||
for (final Plot p : plots.values()) {
|
}
|
||||||
string.append(C.PLOT_LIST_ITEM.s().replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
}
|
||||||
}
|
}
|
||||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.values().size() + "").replaceAll("%plot%", plots.values().size() == 1 ? "plot" : "plots"));
|
case "world": {
|
||||||
MainUtil.sendMessage(plr, string.toString());
|
plots = PlotSquared.getPlots(world).values();
|
||||||
return true;
|
break;
|
||||||
} else {
|
}
|
||||||
// execute(plr);
|
case "all": {
|
||||||
|
plots = PlotSquared.getPlots();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "forsale": {
|
||||||
|
if (PlotSquared.economy == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
plots = new HashSet<>();
|
||||||
|
for (Plot plot : PlotSquared.getPlots()) {
|
||||||
|
final Flag price = FlagManager.getPlotFlag(plot, "price");
|
||||||
|
if (price != null) {
|
||||||
|
plots.add(plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unowned": {
|
||||||
|
plots = new HashSet<>();
|
||||||
|
for (Plot plot : PlotSquared.getPlots()) {
|
||||||
|
if (plot.owner == null) {
|
||||||
|
plots.add(plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unknown": {
|
||||||
|
plots = new HashSet<>();
|
||||||
|
for (Plot plot : PlotSquared.getPlots()) {
|
||||||
|
if (plot.owner == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (UUIDHandler.getName(plot.owner) == null) {
|
||||||
|
plots.add(plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
if (PlotSquared.isPlotWorld(args[0])) {
|
||||||
|
plots = PlotSquared.getPlots(args[0]).values();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
UUID uuid = UUIDHandler.getUUID(args[0]);
|
||||||
|
if (uuid != null) {
|
||||||
|
plots = PlotSquared.getPlots(uuid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plots == null) {
|
||||||
sendMessage(plr, C.DID_YOU_MEAN, new StringComparison(args[0], new String[] { "mine", "shared", "world", "all" }).getBestMatch());
|
sendMessage(plr, C.DID_YOU_MEAN, new StringComparison(args[0], new String[] { "mine", "shared", "world", "all" }).getBestMatch());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (plots.size() == 0) {
|
||||||
|
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayPlots(plr, plots, page);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void displayPlots(PlotPlayer player, Collection<Plot> oldPlots, int page) {
|
||||||
|
ArrayList<Plot> plots = PlotSquared.sortPlots(oldPlots);
|
||||||
|
if (page < 0) {
|
||||||
|
page = 0;
|
||||||
|
}
|
||||||
|
// Get the total pages
|
||||||
|
// int totalPages = ((int) Math.ceil(12 *
|
||||||
|
// (PlotSquared.getPlotsSorted().size()) / 100));
|
||||||
|
final int totalPages = (int) Math.ceil(plots.size() / 12);
|
||||||
|
if (page > totalPages) {
|
||||||
|
page = totalPages;
|
||||||
|
}
|
||||||
|
// Only display 12!
|
||||||
|
int max = (page * 12) + 12;
|
||||||
|
if (max > plots.size()) {
|
||||||
|
max = plots.size();
|
||||||
|
}
|
||||||
|
final StringBuilder string = new StringBuilder();
|
||||||
|
string.append(C.PLOT_LIST_HEADER_PAGED.s().replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "").replaceAll("%word%", "all")).append("\n");
|
||||||
|
Plot p;
|
||||||
|
// This might work xD
|
||||||
|
for (int x = (page * 12); x < max; x++) {
|
||||||
|
p = (Plot) plots.toArray()[x];
|
||||||
|
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
||||||
|
}
|
||||||
|
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.size() + "").replaceAll("%plot%", plots.size() == 1 ? "plot" : "plots"));
|
||||||
|
MainUtil.sendMessage(player, string.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getArgumentList(final String[] strings) {
|
private String getArgumentList(final String[] strings) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
String prefix = "";
|
||||||
for (final String s : strings) {
|
for (final String s : strings) {
|
||||||
builder.append(MainUtil.colorise('&', s));
|
builder.append(prefix + MainUtil.colorise('&', s));
|
||||||
|
prefix = " | ";
|
||||||
}
|
}
|
||||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
return builder.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
@ -177,6 +176,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
if (passed) {
|
if (passed) {
|
||||||
|
player.teleport(event.getTo());
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
MainUtil.sendMessage(pp, C.BORDER);
|
||||||
return;
|
return;
|
||||||
|
@ -2,7 +2,6 @@ package com.intellectualcrafters.plot.util;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.SubCommand;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.CmdInstance;
|
import com.intellectualcrafters.plot.object.CmdInstance;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user