perf: Get rid of Guice overhead when accessing the plot area manager (#3315)

Fixes #3311
Co-authored-by: Jordan <dordsor21@gmail.com>
This commit is contained in:
Hannes Greule 2021-11-02 14:38:48 +01:00 committed by GitHub
parent 48c7a3e94e
commit b97e843849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -1180,6 +1180,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
return this.injector; return this.injector;
} }
@Override
public @NonNull PlotAreaManager plotAreaManager() {
return this.plotAreaManager;
}
@NonNull @NonNull
@Override @Override
public Locale getLocale() { public Locale getLocale() {

View File

@ -38,6 +38,7 @@ import com.plotsquared.core.inject.annotations.DefaultGenerator;
import com.plotsquared.core.location.World; import com.plotsquared.core.location.World;
import com.plotsquared.core.permissions.PermissionHandler; import com.plotsquared.core.permissions.PermissionHandler;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
@ -268,6 +269,13 @@ public interface PlotPlatform<P> extends LocaleHolder {
return injector().getInstance(ChunkManager.class); return injector().getInstance(ChunkManager.class);
} }
/**
* Get the {@link PlotAreaManager} implementation.
*
* @return the PlotAreaManager
*/
@NonNull PlotAreaManager plotAreaManager();
/** /**
* Get the platform specific console {@link Audience} * Get the platform specific console {@link Audience}
* *

View File

@ -283,7 +283,7 @@ public class PlotSquared {
* @return Plot area manager * @return Plot area manager
*/ */
public @NonNull PlotAreaManager getPlotAreaManager() { public @NonNull PlotAreaManager getPlotAreaManager() {
return this.platform.injector().getInstance(PlotAreaManager.class); return this.platform.plotAreaManager();
} }
public void startExpiryTasks() { public void startExpiryTasks() {