WE unregistration + home/visit sorting + format

- WorldEdit listener unregistration for external masking/extent/async
worldedit management. (wink)
- Use the same listing for home and visit as previous behavior was
confusing.
This commit is contained in:
boy0001 2015-09-13 01:19:39 +10:00
parent c386f33df8
commit 1c28a72f9c
28 changed files with 490 additions and 465 deletions

View File

@ -21,6 +21,8 @@
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@ -51,7 +53,16 @@ public class Home extends SubCommand
@Override
public boolean onCommand(final PlotPlayer plr, String[] args)
{
final ArrayList<Plot> plots = PS.get().sortPlotsByTemp(PS.get().getPlots(plr));//PS.get().sortPlots(PS.get().getPlots(plr), SortType.CREATION_DATE, null);
final Set<Plot> all = PS.get().getPlots(plr);
final Iterator<Plot> iter = all.iterator();
while (iter.hasNext())
{
if (!iter.next().isBasePlot())
{
iter.remove();
}
}
final ArrayList<Plot> plots = PS.get().sortPlotsByTemp(all);
if (plots.size() == 1)
{
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));

View File

@ -21,6 +21,7 @@
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
@ -114,6 +115,14 @@ public class Visit extends SubCommand
}
final Plot plot = plots.get(index);
final Iterator<Plot> iter = plots.iterator();
while (iter.hasNext())
{
if (!iter.next().isBasePlot())
{
iter.remove();
}
}
if (!plot.hasOwner())
{
if (!Permissions.hasPermission(plr, "plots.visit.unowned"))

View File

@ -154,7 +154,8 @@ public class Plot
* @param id
* @return
*/
public static Plot getPlot(String world, PlotId id) {
public static Plot getPlot(final String world, final PlotId id)
{
return MainUtil.getPlot(world, id);
}
@ -166,7 +167,8 @@ public class Plot
* @param loc
* @return
*/
public static Plot getPlot(Location loc) {
public static Plot getPlot(final Location loc)
{
return MainUtil.getPlot(loc);
}

View File

@ -66,6 +66,9 @@ public class MainUtil
public static short[][] y_loc;
public static short[][] z_loc;
/**
* This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
*/
public static void initCache()
{
if (x_loc == null)

View File

@ -36,7 +36,7 @@ public class WESubscriber
final WorldEdit worldedit = PS.get().worldedit;
if (worldedit == null)
{
worldedit.getEventBus().unregister(this);
WorldEdit.getInstance().getEventBus().unregister(this);
return;
}
final World worldObj = event.getWorld();

Binary file not shown.

Binary file not shown.