mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
parent
9cd0ffb709
commit
a85cab7261
@ -35,9 +35,6 @@ import com.plotsquared.core.util.query.PlotQuery;
|
|||||||
import com.plotsquared.core.util.query.SortingStrategy;
|
import com.plotsquared.core.util.query.SortingStrategy;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
import jdk.jfr.Category;
|
|
||||||
import jdk.jfr.Event;
|
|
||||||
import jdk.jfr.Label;
|
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
@ -62,24 +59,13 @@ public class HomeCommand extends Command {
|
|||||||
this.plotAreaManager = plotAreaManager;
|
this.plotAreaManager = plotAreaManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Label("Home Query")
|
|
||||||
@Category("PlotSquared")
|
|
||||||
static class HomeQueryEvent extends Event {
|
|
||||||
@Label("Result Size")
|
|
||||||
public int size;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void home(
|
private void home(
|
||||||
final @NonNull PlotPlayer<?> player,
|
final @NonNull PlotPlayer<?> player,
|
||||||
final @NonNull PlotQuery query, final int page,
|
final @NonNull PlotQuery query, final int page,
|
||||||
final RunnableVal3<Command, Runnable, Runnable> confirm,
|
final RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
final RunnableVal2<Command, CommandResult> whenDone
|
final RunnableVal2<Command, CommandResult> whenDone
|
||||||
) {
|
) {
|
||||||
final HomeQueryEvent event = new HomeQueryEvent();
|
|
||||||
event.begin();
|
|
||||||
List<Plot> plots = query.asList();
|
List<Plot> plots = query.asList();
|
||||||
event.size = plots.size();
|
|
||||||
event.commit();
|
|
||||||
if (plots.isEmpty()) {
|
if (plots.isEmpty()) {
|
||||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||||
return;
|
return;
|
||||||
|
@ -68,9 +68,6 @@ import com.plotsquared.core.util.task.TaskTime;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import jdk.jfr.Category;
|
|
||||||
import jdk.jfr.Event;
|
|
||||||
import jdk.jfr.Label;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
@ -2297,25 +2294,6 @@ public class Plot {
|
|||||||
return this.area.getPlotAbs(this.id.getRelative(direction));
|
return this.area.getPlotAbs(this.id.getRelative(direction));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Label("Connected Plots Search")
|
|
||||||
@Category("PlotSquared")
|
|
||||||
static class ConnectedPlotsEvent extends Event {
|
|
||||||
|
|
||||||
public ConnectedPlotsEvent(final int x, final int y) {
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Label("Plot Id X")
|
|
||||||
public int x;
|
|
||||||
@Label("Plot Id Y")
|
|
||||||
public int y;
|
|
||||||
@Label("Merged Plots Count")
|
|
||||||
public int mergedSize;
|
|
||||||
@Label("Connected Plots Cache Miss")
|
|
||||||
public boolean cacheMiss;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a set of plots connected (and including) this plot<br>
|
* Gets a set of plots connected (and including) this plot<br>
|
||||||
* - This result is cached globally
|
* - This result is cached globally
|
||||||
@ -2323,19 +2301,13 @@ public class Plot {
|
|||||||
* @return a Set of Plots connected to this Plot
|
* @return a Set of Plots connected to this Plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getConnectedPlots() {
|
public Set<Plot> getConnectedPlots() {
|
||||||
ConnectedPlotsEvent event = new ConnectedPlotsEvent(this.id.getX(), this.id.getY());
|
|
||||||
event.begin();
|
|
||||||
if (this.settings == null) {
|
if (this.settings == null) {
|
||||||
event.commit();
|
|
||||||
return Collections.singleton(this);
|
return Collections.singleton(this);
|
||||||
}
|
}
|
||||||
if (!this.isMerged()) {
|
if (!this.isMerged()) {
|
||||||
event.commit();
|
|
||||||
return Collections.singleton(this);
|
return Collections.singleton(this);
|
||||||
}
|
}
|
||||||
if (this.connectedCache != null && this.connectedCache.contains(this)) {
|
if (this.connectedCache != null && this.connectedCache.contains(this)) {
|
||||||
event.mergedSize = this.connectedCache.size();
|
|
||||||
event.commit();
|
|
||||||
return this.connectedCache;
|
return this.connectedCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2443,9 +2415,6 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.connectedCache = tmpSet;
|
this.connectedCache = tmpSet;
|
||||||
event.mergedSize = tmpSet.size();
|
|
||||||
event.cacheMiss = true;
|
|
||||||
event.commit();
|
|
||||||
return tmpSet;
|
return tmpSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user