mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 20:56:45 +01:00
perf: get rid of guice overhead when accessing the player & world manager (#4409)
Return already injected fields to skip slow Injector access
This commit is contained in:
parent
c57d784df7
commit
6ef1163325
@ -24,7 +24,6 @@ import com.google.inject.Injector;
|
|||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import com.google.inject.Stage;
|
import com.google.inject.Stage;
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||||
import com.plotsquared.bukkit.inject.BackupModule;
|
import com.plotsquared.bukkit.inject.BackupModule;
|
||||||
import com.plotsquared.bukkit.inject.BukkitModule;
|
import com.plotsquared.bukkit.inject.BukkitModule;
|
||||||
@ -45,7 +44,6 @@ import com.plotsquared.bukkit.listener.SpigotListener;
|
|||||||
import com.plotsquared.bukkit.listener.WorldEvents;
|
import com.plotsquared.bukkit.listener.WorldEvents;
|
||||||
import com.plotsquared.bukkit.placeholder.PAPIPlaceholders;
|
import com.plotsquared.bukkit.placeholder.PAPIPlaceholders;
|
||||||
import com.plotsquared.bukkit.placeholder.PlaceholderFormatter;
|
import com.plotsquared.bukkit.placeholder.PlaceholderFormatter;
|
||||||
import com.plotsquared.bukkit.player.BukkitPlayer;
|
|
||||||
import com.plotsquared.bukkit.player.BukkitPlayerManager;
|
import com.plotsquared.bukkit.player.BukkitPlayerManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.BukkitWorld;
|
import com.plotsquared.bukkit.util.BukkitWorld;
|
||||||
@ -1271,15 +1269,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull PlatformWorldManager<?> worldManager() {
|
public @NonNull PlatformWorldManager<?> worldManager() {
|
||||||
return injector().getInstance(Key.get(new TypeLiteral<PlatformWorldManager<World>>() {
|
return this.worldManager;
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
|
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
|
||||||
return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
|
return this.playerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user