Added nicer plot listing, info and visit

This commit is contained in:
boy0001 2015-06-24 13:31:13 +10:00
parent f31b33bbde
commit 699906476c
14 changed files with 407 additions and 95 deletions

View File

@ -142,22 +142,25 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
public static BukkitMain THIS = null;
public static PlotSquared MAIN = null;
public static boolean checkVersion(final int major, final int minor, final int minor2) {
try {
final String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
final int a = Integer.parseInt(version[0]);
final int b = Integer.parseInt(version[1]);
int c = 0;
if (version.length == 3) {
c = Integer.parseInt(version[2]);
private int[] version;
@Override
public boolean checkVersion(final int major, final int minor, final int minor2) {
if (version == null) {
try {
version = new int[3];
final String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
version[0] = Integer.parseInt(split[0]);
version[1] = Integer.parseInt(split[1]);
if (version.length == 3) {
version[2] = Integer.parseInt(split[2]);
}
}
if ((a > major) || ((a == major) && (b > minor)) || ((a == major) && (b == minor) && (c >= minor2))) {
return true;
catch (Exception e) {
return false;
}
return false;
} catch (final Exception e) {
return false;
}
return (version[0] > major) || ((version[0] == major) && (version[1] > minor)) || ((version[0] == major) && (version[1] == minor) && (version[2] >= minor2));
}
@Override

View File

@ -74,4 +74,6 @@ public interface IPlotMain {
public void registerWorldEvents();
public PlayerManager initPlayerManager();
public boolean checkVersion(int major, int minor, int minor2);
}

View File

@ -870,6 +870,7 @@ public class PlotSquared {
// Misc
options.put("console.color", Settings.CONSOLE_COLOR);
options.put("chat.fancy", Settings.FANCY_CHAT);
options.put("metrics", true);
options.put("debug", true);
options.put("auto_update", false);
@ -961,6 +962,14 @@ public class PlotSquared {
log(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
}
Settings.CONSOLE_COLOR = config.getBoolean("console.color");
if (!config.getBoolean("chat.fancy") || !IMP.checkVersion(1, 7, 0)) {
System.out.print("FANCY CHAT =======================================");
System.out.print("FANCY CHAT =======================================");
System.out.print("FANCY CHAT =======================================");
System.out.print(!config.getBoolean("chat.fancy"));
System.out.print(!IMP.checkVersion(1, 7, 0));
Settings.FANCY_CHAT = false;
}
Settings.METRICS = config.getBoolean("metrics");
}

View File

@ -70,11 +70,11 @@ public class Home extends SubCommand {
MainUtil.sendMessage(plr, C.NOT_YOUR_PLOT);
return false;
}
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(1, " + plots.size() + ")");
return true;
}
if ((id > (plots.size())) || (id < 1)) {
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(1, " + plots.size() + ")");
return false;
}
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(id - 1));

View File

@ -21,6 +21,7 @@
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.UUID;
import java.util.regex.Matcher;
@ -53,46 +54,35 @@ public class Info extends SubCommand {
@Override
public boolean execute(final PlotPlayer player, String... args) {
Plot plot;
String world;
if (player != null) {
final Location loc = player.getLocation();
world = loc.getWorld();
if (!PlotSquared.isPlotWorld(world)) {
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
String arg = null;
if (args.length > 0) arg = args[0] + "";
switch (arg) {
case "trusted":
case "alias":
case "biome":
case "denied":
case "flags":
case "id":
case "size":
case "members":
case "owner":
case "rating":
arg = null;
}
Plot plot = MainUtil.getPlotFromString(player, arg, true);
if (plot == null) {
if (player == null) {
return false;
}
plot = MainUtil.getPlot(loc);
if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT);
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
return false;
}
if (arg != null) {
if (args.length == 1) {
args = new String[0];
}
} else {
if (args.length < 2) {
MainUtil.sendMessage(null, C.INFO_SYNTAX_CONSOLE);
return false;
}
final PlotWorld plotworld = PlotSquared.getPlotWorld(args[0]);
if (plotworld == null) {
MainUtil.sendMessage(player, C.NOT_VALID_WORLD);
return false;
}
try {
final String[] split = args[1].split(";");
final PlotId id = new PlotId(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
plot = MainUtil.getPlot(plotworld.worldname, id);
if (plot == null) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
return false;
}
world = args[0];
if (args.length == 3) {
args = new String[] { args[2] };
} else {
args = new String[0];
}
} catch (final Exception e) {
MainUtil.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
return false;
else {
args = new String[] { args[1] };
}
}
if ((args.length == 1) && args[0].equalsIgnoreCase("inv")) {
@ -127,7 +117,7 @@ public class Info extends SubCommand {
return false;
}
}
formatAndSend(info, world, plot, player);
formatAndSend(info, plot.world, plot, player);
return true;
}
@ -209,10 +199,10 @@ public class Info extends SubCommand {
MainUtil.sendMessage(player, info, false);
}
private String getPlayerList(final Collection<UUID> uuids) {
public static String getPlayerList(final Collection<UUID> uuids) {
ArrayList<UUID> l = new ArrayList<>(uuids);
if ((l == null) || (l.size() < 1)) {
return " none";
return C.NONE.s();
}
final String c = C.PLOT_USER_LIST.s();
final StringBuilder list = new StringBuilder();
@ -226,7 +216,7 @@ public class Info extends SubCommand {
return list.toString();
}
private String getPlayerName(final UUID uuid) {
public static String getPlayerName(final UUID uuid) {
if (uuid == null) {
return "unknown";
}

View File

@ -52,7 +52,7 @@ public class RegenAllRoads extends SubCommand {
height = Integer.parseInt(args[1]);
}
catch (NumberFormatException e) {
sendMessage(player, C.NOT_VALID_NUMBER);
sendMessage(player, C.NOT_VALID_NUMBER, "(0, 256)");
sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
return false;
}

View File

@ -27,8 +27,10 @@ import java.util.UUID;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class Visit extends SubCommand {
@ -49,31 +51,105 @@ public class Visit extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 1) {
return sendMessage(plr, C.NEED_USER);
return sendMessage(plr, C.COMMAND_SYNTAX, "/plot visit <player|alias|world|id> [#]");
}
final String username = args[0];
final UUID uuid = UUIDHandler.getUUID(username);
List<Plot> plots = null;
if (uuid != null) {
plots = PlotSquared.sortPlotsByWorld(getPlots(uuid));
ArrayList<Plot> plots = new ArrayList<>();
UUID user = UUIDHandler.getUUID(args[0]);
if (user != null ) {
// do plots by username
plots.addAll(PlotSquared.getPlots(user));
}
if ((uuid == null) || plots.isEmpty()) {
return sendMessage(plr, C.FOUND_NO_PLOTS);
else if (PlotSquared.isPlotWorld(args[0])) {
// do plots by world
plots.addAll(PlotSquared.getPlots(args[0]).values());
}
if (args.length < 2) {
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
return true;
else {
Plot plot = MainUtil.getPlotFromString(plr, args[0], false);
if (plot == null) {
return false;
}
plots.add(plot);
}
int i;
try {
i = Integer.parseInt(args[1]);
} catch (final Exception e) {
return sendMessage(plr, C.NOT_VALID_NUMBER);
if (plots.size() == 0) {
sendMessage(plr, C.FOUND_NO_PLOTS);
return false;
}
if ((i < 1) || (i > plots.size())) {
return sendMessage(plr, C.NOT_VALID_NUMBER);
int index = 0;
if (args.length == 2) {
try {
index = Integer.parseInt(args[1]) - 1;
if (index < 0 || index >= plots.size()) {
sendMessage(plr, C.NOT_VALID_NUMBER, "(1, " + plots.size() + ")");
sendMessage(plr, C.COMMAND_SYNTAX, "/plot visit " + args[0] + " [#]");
return false;
}
}
catch (Exception e) {
sendMessage(plr, C.NOT_VALID_NUMBER, "(1, " + plots.size() + ")");
sendMessage(plr, C.COMMAND_SYNTAX, "/plot visit " + args[0] + " [#]");
return false;
}
}
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(i - 1));
Plot plot = plots.get(index);
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(plr, "plots.visit.unowned")) {
sendMessage(plr, C.NO_PERMISSION, "plots.visit.unowned");
return false;
}
}
else if (plot.isOwner(plr.getUUID())) {
if (!Permissions.hasPermission(plr, "plots.visit.owned") && !Permissions.hasPermission(plr, "plots.home")) {
sendMessage(plr, C.NO_PERMISSION, "plots.visit.unowned, plots.home");
return false;
}
}
else if (plot.isAdded(plr.getUUID())) {
if (!Permissions.hasPermission(plr, "plots.visit.shared")) {
sendMessage(plr, C.NO_PERMISSION, "plots.visit.shared");
return false;
}
}
else {
if (!Permissions.hasPermission(plr, "plots.visit.other")) {
sendMessage(plr, C.NO_PERMISSION, "plots.visit.other");
return false;
}
}
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(index));
return true;
//
// // from alias
//
//
// id = PlotId.fromString(args[0]);
//
//
//
// final String username = args[0];
// final UUID uuid = UUIDHandler.getUUID(username);
// List<Plot> plots = null;
// if (uuid != null) {
// plots = PlotSquared.sortPlotsByWorld(getPlots(uuid));
// }
// if ((uuid == null) || plots.isEmpty()) {
// return sendMessage(plr, C.FOUND_NO_PLOTS);
// }
// if (args.length < 2) {
// MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
// return true;
// }
// int i;
// try {
// i = Integer.parseInt(args[1]);
// } catch (final Exception e) {
// return sendMessage(plr, C.NOT_VALID_NUMBER);
// }
// if ((i < 1) || (i > plots.size())) {
// return sendMessage(plr, C.NOT_VALID_NUMBER);
// }
// MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(i - 1));
// return true;
}
}

View File

@ -27,10 +27,15 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.BukkitPlayer;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler;
@ -38,6 +43,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.StringComparison;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
import com.intellectualcrafters.plot.util.bukkit.chat.FancyMessage;
/**
* @author Citymonstret
@ -239,11 +245,11 @@ public class list extends SubCommand {
return false;
}
displayPlots(plr, plots, 12, page, world);
displayPlots(plr, plots, 12, page, world, args);
return true;
}
public void displayPlots(PlotPlayer player, Collection<Plot> oldPlots, int pageSize, int page, String world) {
public void displayPlots(PlotPlayer player, Collection<Plot> oldPlots, int pageSize, int page, String world, String[] args) {
List<Plot> plots;
if (world != null) {
plots = PlotSquared.sortPlots(oldPlots, world);
@ -264,20 +270,179 @@ public class list extends SubCommand {
max = plots.size();
}
plots = plots.subList(page * pageSize, max);
List<Plot> subList = plots.subList(page * pageSize, max);
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");
// Header
String header = C.PLOT_LIST_HEADER_PAGED.s()
.replaceAll("%cur", page + 1 + "")
.replaceAll("%max", totalPages + 1 + "")
.replaceAll("%amount%", plots.size() + "")
.replaceAll("%word%", "all");
MainUtil.sendMessage(player, header);
int i = page * pageSize;
for (Plot plot : subList) {
if (plot.settings.isMerged()) {
if (!MainUtil.getBottomPlot(plot).equals(plot)) {
continue;
}
}
i++;
if (Settings.FANCY_CHAT) {
ChatColor color;
if (player == null) {
color = ChatColor.GOLD;
}
else if (plot.isOwner(player.getUUID())) {
color = ChatColor.BLUE;
}
else if (plot.isAdded(player.getUUID())) {
color = ChatColor.DARK_GREEN;
}
else if (plot.isDenied(player.getUUID())) {
color = ChatColor.RED;
}
else {
color = ChatColor.GOLD;
}
FancyMessage trusted =
new FancyMessage(
ChatColor.stripColor(
ChatColor.translateAlternateColorCodes('&',
C.PLOT_INFO_TRUSTED.s().replaceAll("%trusted%", Info.getPlayerList(plot.trusted)))))
.color(ChatColor.GOLD);
FancyMessage members =
new FancyMessage(
ChatColor.stripColor(
ChatColor.translateAlternateColorCodes('&',
C.PLOT_INFO_MEMBERS.s().replaceAll("%members%", Info.getPlayerList(plot.members)))))
.color(ChatColor.GOLD);
String strFlags = StringUtils.join(plot.settings.flags.values(), ",");
if (strFlags.length() == 0) {
strFlags = C.NONE.s();
}
FancyMessage flags =
new FancyMessage(
ChatColor.stripColor(
ChatColor.translateAlternateColorCodes('&',
C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))))
.color(ChatColor.GOLD);
FancyMessage message = new FancyMessage("")
.then("[")
.color(ChatColor.DARK_GRAY)
.then(i + "")
.command("/plot visit " + plot.toString())
.tooltip("/plot visit " + plot.toString())
.color(ChatColor.GOLD)
.then("]")
// teleport tooltip
.color(ChatColor.DARK_GRAY)
.then(" " + plot.toString())
.formattedTooltip(trusted, members, flags)
.command("/plot info " + plot.toString())
.color(color)
.then(" - ")
.color(ChatColor.GRAY);
String prefix = "";
for (UUID uuid : plot.getOwners()) {
String name = UUIDHandler.getName(uuid);
if (name == null) {
message = message
.then(prefix)
.color(ChatColor.DARK_GRAY)
.then("unknown")
.color(ChatColor.GRAY)
.tooltip(uuid.toString())
.suggest(uuid.toString());
}
else {
PlotPlayer pp = UUIDHandler.getPlayer(uuid);
if (pp != null) {
message = message
.then(prefix)
.color(ChatColor.DARK_GRAY)
.then(name).color(ChatColor.GOLD)
.formattedTooltip(new FancyMessage("Online").color(ChatColor.DARK_GREEN));
}
else {
message = message
.then(prefix)
.color(ChatColor.DARK_GRAY)
.then(name).color(ChatColor.GOLD)
.formattedTooltip(new FancyMessage("Offline").color(ChatColor.RED));
}
}
prefix = ", ";
}
message.send(((BukkitPlayer) player).player);
}
else {
String message = C.PLOT_LIST_ITEM.s()
.replaceAll("%in", i + 1 + "")
.replaceAll("%id", plot.id.toString())
.replaceAll("%world", plot.world)
.replaceAll("%owner", getName(plot.owner))
// Unused
.replaceAll("%trusted%", "")
.replaceAll("%members%", "")
.replaceAll("%tp%", "");
MainUtil.sendMessage(player, message);
}
}
if (Settings.FANCY_CHAT) {
if (page < totalPages && page > 0) {
// back | next
new FancyMessage("")
.then("<-")
.color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page))
.then(" | ")
.color(ChatColor.DARK_GRAY)
.then("->")
.color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page + 2))
.send(((BukkitPlayer) player).player);
return;
}
if (page == 0) {
// next
new FancyMessage("")
.then("<-")
.color(ChatColor.DARK_GRAY)
.then(" | ")
.color(ChatColor.DARK_GRAY)
.then("->")
.color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page + 2))
.send(((BukkitPlayer) player).player);
return;
}
if (page == totalPages) {
// back
new FancyMessage("")
.then("<-")
.color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page))
.then(" | ")
.color(ChatColor.DARK_GRAY)
.then("->")
.color(ChatColor.DARK_GRAY)
.send(((BukkitPlayer) player).player);
return;
}
}
else {
String footer = C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.size() + "").replaceAll("%plot%", plots.size() == 1 ? "plot" : "plots");
MainUtil.sendMessage(player, footer);
}
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) {

View File

@ -322,7 +322,7 @@ public enum C {
*/
NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"),
NOT_VALID_BLOCK("$2That's not a valid block.", "Invalid"),
NOT_VALID_NUMBER("$2That's not a valid number", "Invalid"),
NOT_VALID_NUMBER("$2That's not a valid number within the range: %s", "Invalid"),
NOT_VALID_PLOT_ID("$2That's not a valid plot id.", "Invalid"),
PLOT_ID_FORM("$2The plot id must be in the form: $1X;Y $2e.g. $1-5;7", "Invalid"),
NOT_YOUR_PLOT("$2That is not your plot.", "Invalid"),
@ -345,6 +345,7 @@ public enum C {
/*
* Info
*/
NONE("None", "Info"),
PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"),
PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
PLOT_INFO_HEADER("$3====== $1INFO $3======", false, "Info"),
@ -360,7 +361,7 @@ public enum C {
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"),
PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"),
PLOT_USER_LIST(" $1%user%$2,", "Info"),
INFO_SYNTAX_CONSOLE("$2/plot info <world> X;Y", "Info"),
INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"),
/*
* Generating
*/
@ -379,7 +380,7 @@ public enum C {
/*
* List
*/
PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %word% plots", "List"),
PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", "List"),
PLOT_LIST_HEADER("$1List of %word% plots", "List"),
PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"),
PLOT_LIST_ITEM_ORDERED("$2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner", "List"),

View File

@ -137,6 +137,10 @@ public class Settings {
* Have colored console messages?
*/
public static boolean CONSOLE_COLOR = true;
/**
* Fancy chat e.g. for /plot list
*/
public static boolean FANCY_CHAT = true;
/**
* The delay (in seconds) before teleportation commences
*/

View File

@ -262,7 +262,7 @@ public class Plot implements Cloneable {
public void removeTrusted(final UUID uuid) {
this.members.remove(uuid);
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {

View File

@ -232,7 +232,7 @@ public class ExpireManager {
final String worldname = Bukkit.getWorlds().get(0).getName();
String foldername;
String filename = null;
if (BukkitMain.checkVersion(1, 7, 5)) {
if (PlotSquared.IMP.checkVersion(1, 7, 5)) {
foldername = "playerdata";
try {
final OfflinePlotPlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);

View File

@ -73,6 +73,63 @@ public class MainUtil {
return new Location(plot.world, bot.getX() + (top.getX() - bot.getX()) / 2, 0, bot.getZ() + (top.getZ() - bot.getZ()) / 2);
}
public static Plot getPlotFromString(PlotPlayer player, String arg, boolean message) {
if (arg == null) {
if (player == null) {
if (message) MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
return null;
}
return getPlot(player.getLocation());
}
String worldname = null;
PlotId id = null;
if (player != null) {
worldname = player.getLocation().getWorld();
}
String[] split = arg.split(";|,");
if (split.length == 3) {
worldname = split[0];
id = PlotId.fromString(split[1] + ";" + split[2]);
}
else if (split.length == 2) {
id = PlotId.fromString(arg);
}
else {
if (worldname == null) {
if (PlotSquared.getPlotWorlds().size() == 0) {
if (message) MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
return null;
}
worldname = PlotSquared.getPlotWorlds().iterator().next();
}
for (Plot p : PlotSquared.getPlots(worldname).values()) {
String name = p.settings.getAlias();
if (name.length() != 0 && name.equalsIgnoreCase(arg)) {
return p;
}
}
for (String world : PlotSquared.getPlotWorlds()) {
if (!world.endsWith(worldname)) {
for (Plot p : PlotSquared.getPlots(world).values()) {
String name = p.settings.getAlias();
if (name.length() != 0 && name.equalsIgnoreCase(arg)) {
return p;
}
}
}
}
}
if (worldname == null || !PlotSquared.isPlotWorld(worldname)) {
if (message) MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
return null;
}
if (id == null) {
if (message) MainUtil.sendMessage(player, C.NOT_VALID_PLOT_ID);
return null;
}
return getPlot(worldname, id);
}
/**
* Merges all plots in the arraylist (with cost)
*

View File

@ -222,19 +222,24 @@ public class UUIDHandler {
}
public static String getName(final UUID uuid) {
System.out.print(uuid);
if (uuid == null) {
System.out.print(1);
return null;
}
// check online
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
if (player != null) {
System.out.print(2);
return player.getName();
}
// check cache
final StringWrapper name = UUIDHandler.uuidMap.inverse().get(uuid);
if (name != null) {
System.out.print(3);
return name.value;
}
System.out.print(4);
return null;
}