This commit is contained in:
boy0001 2015-02-20 17:52:48 +11:00
parent d381f0ff6a
commit 31159488c1
3 changed files with 13 additions and 5 deletions

View File

@ -813,7 +813,7 @@ public class PlotHelper {
* @param loc * @param loc
* @return * @return
*/ */
public static PlotId getPlot(final Location loc) { public static PlotId getPlotId(final Location loc) {
final String world = loc.getWorld(); final String world = loc.getWorld();
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);
if (manager == null) { if (manager == null) {
@ -828,4 +828,12 @@ public class PlotHelper {
} }
return id; return id;
} }
public static Plot getPlot(final Location loc) {
PlotId id = getPlotId(loc);
if (id == null) {
return null;
}
return getPlot(loc.getWorld(), id);
}
} }

View File

@ -110,12 +110,12 @@ public class ChunkManager extends AChunkManager {
final int z2 = z1 + 15; final int z2 = z1 + 15;
final Location bot = new Location(world, x1, 0, z1); final Location bot = new Location(world, x1, 0, z1);
Plot plot; Plot plot;
plot = PlotHelper.getCurrentPlot(bot); plot = PlotHelper.getPlot(bot);
if ((plot != null) && (plot.owner != null)) { if ((plot != null) && (plot.owner != null)) {
return plot; return plot;
} }
final Location top = new Location(world, x2, 0, z2); final Location top = new Location(world, x2, 0, z2);
plot = PlotHelper.getCurrentPlot(top); plot = PlotHelper.getPlot(top);
if ((plot != null) && (plot.owner != null)) { if ((plot != null) && (plot.owner != null)) {
return plot; return plot;
} }
@ -743,7 +743,7 @@ public class ChunkManager extends AChunkManager {
public void clearAllEntities(final Plot plot) { public void clearAllEntities(final Plot plot) {
final List<Entity> entities = BukkitUtil.getEntities(plot.world); final List<Entity> entities = BukkitUtil.getEntities(plot.world);
for (final Entity entity : entities) { for (final Entity entity : entities) {
final PlotId id = PlayerFunctions.getPlot(BukkitUtil.getLocation(entity)); final PlotId id = PlotHelper.getPlotId(BukkitUtil.getLocation(entity));
if (plot.id.equals(id)) { if (plot.id.equals(id)) {
if (entity instanceof Player) { if (entity instanceof Player) {
final Player player = (Player) entity; final Player player = (Player) entity;

View File

@ -142,7 +142,7 @@ public class PlayerFunctions {
if (!PlotSquared.isPlotWorld(player.getWorld().getName())) { if (!PlotSquared.isPlotWorld(player.getWorld().getName())) {
return null; return null;
} }
final PlotId id = PlotHelper.getPlot(BukkitUtil.getLocation(player)); final PlotId id = PlotHelper.getPlotId(BukkitUtil.getLocation(player));
final String world = player.getWorld().getName(); final String world = player.getWorld().getName();
if (id == null) { if (id == null) {
return null; return null;