diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java index 3db811c69..0738c1cb7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -31,6 +31,7 @@ import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.UUIDHandler; + import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -228,7 +229,11 @@ import java.util.UUID; * OfflinePlayer plr = Bukkit.getOfflinePlayer(uuid); if (plr.getName() * == null) { return "unknown"; } return plr.getName(); */ - return UUIDHandler.getName(uuid); + String name = UUIDHandler.getName(uuid); + if (name == null) { + return "unknown"; + } + return name; } private Biome getBiomeAt(final Plot plot) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java index 7e0e4dd06..26aab7b6b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -47,10 +47,6 @@ public class list extends SubCommand { if (id == null) { return "none"; } - /* - * String name = Bukkit.getOfflinePlayer(id).getName(); if (name == - * null) { return "none"; } return name; - */ String name = UUIDHandler.getName(id); if (name == null) { return "unknown"; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java index cfd558cfd..69047e590 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java @@ -30,6 +30,7 @@ import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.UUIDHandler; + import org.bukkit.*; import org.bukkit.block.Biome; import org.bukkit.block.Block; @@ -68,8 +69,15 @@ import java.util.UUID; return PlotMain.getWorldSettings(world); } - public static String getName(final UUID uuid) { - return UUIDHandler.getName(uuid); + private static String getName(final UUID id) { + if (id == null) { + return "none"; + } + String name = UUIDHandler.getName(id); + if (name == null) { + return "unknown"; + } + return name; } public static UUID getUUID(final String name) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java index 868347a02..3a589eeeb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java @@ -1,6 +1,7 @@ package com.intellectualcrafters.plot.object; import com.intellectualcrafters.plot.util.UUIDHandler; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -12,6 +13,7 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.ArrayList; import java.util.List; +import java.util.UUID; /** * Created 2014-11-18 for PlotSquared @@ -39,9 +41,17 @@ public class InfoInventory implements InventoryHolder { public Inventory getInventory() { return this.inventory; } + + public String getName(UUID uuid) { + String name = UUIDHandler.getName(this.plot.getOwner()); + if (name == null) { + return "unknown"; + } + return name; + } public InfoInventory build() { - final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + UUIDHandler.getName(this.plot.getOwner()), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.hasRights(this.player), "&cIs Denied: &6" + this.plot.deny_entry(this.player)); + final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + getName(this.plot.getOwner()), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.hasRights(this.player), "&cIs Denied: &6" + this.plot.deny_entry(this.player)); final ItemStack helpers = getItem(Material.EMERALD, "&cHelpers", "&cAmount: &6" + this.plot.helpers.size(), "&8Click to view a list of the plot helpers"); final ItemStack trusted = getItem(Material.EMERALD, "&cTrusted", "&cAmount: &6" + this.plot.trusted.size(), "&8Click to view a list of trusted players"); final ItemStack denied = getItem(Material.EMERALD, "&cDenied", "&cAmount: &6" + this.plot.denied.size(), "&8Click to view a list of denied players"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java index cd723ce27..331b6f496 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java @@ -251,7 +251,10 @@ import java.util.UUID; } @SuppressWarnings("deprecation") - public static void setSign(final World world, final String name, final Plot p) { + public static void setSign(final World world, String name, final Plot p) { + if (name == null) { + name = "unknown"; + } final PlotManager manager = PlotMain.getPlotManager(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world); final Location loc = manager.getSignLoc(world, plotworld, p);