This commit is contained in:
Jesse Boyd 2018-04-28 21:51:26 +10:00
parent 5f9bd853ec
commit 613d79fb39
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 16 additions and 1 deletions

View File

@ -1077,6 +1077,13 @@ public class PS{
return new HashSet<>(myPlots);
}
public boolean hasPlot(final UUID uuid) {
for (PlotArea area : manager.getAllPlotAreas()) {
if (area.hasPlot(uuid)) return true;
}
return false;
}
public Set<Plot> getBasePlots(final UUID uuid) {
final ArrayList<Plot> myplots = new ArrayList<>();
foreachBasePlot(new RunnableVal<Plot>() {

View File

@ -76,7 +76,8 @@ public class Visit extends Command {
}
page = Integer.parseInt(args[1]);
case 1:
UUID user = (args.length == 2 || (page != Integer.MIN_VALUE || !MathMan.isInteger(args[0]))) ? UUIDHandler.getUUIDFromString(args[0]) : null;
UUID user = UUIDHandler.getUUIDFromString(args[0]);
if (user != null && !PS.get().hasPlot(user)) user = null;
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
page = Integer.parseInt(args[0]);
unsorted = PS.get().getBasePlots(player);

View File

@ -536,6 +536,13 @@ public abstract class PlotArea {
return getPlotsAbs(uuid).size();
}
public boolean hasPlot(UUID uuid) {
for (Entry<PlotId, Plot> entry : this.plots.entrySet()) {
if (entry.getValue().isOwner(uuid)) return true;
}
return false;
}
public int getPlotCount(PlotPlayer player) {
return player != null ? getPlotCount(player.getUUID()) : 0;
}