Fix permissionprofile initialisation order

This commit is contained in:
Alexander Söderberg 2020-07-24 14:02:49 +02:00
parent 707559e023
commit f53a8d3b06
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
3 changed files with 9 additions and 3 deletions

View File

@ -95,6 +95,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
super(plotAreaManager, eventDispatcher, econHandler, permissionHandler);
this.player = player;
this.econHandler = econHandler;
this.setupPermissionProfile();
if (realPlayer) {
super.populatePersistentMetaMap();
}

View File

@ -44,8 +44,6 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -67,6 +65,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
@Nonnull final PermissionHandler permissionHandler) {
super(plotAreaManager, eventDispatcher, econHandler, permissionHandler);
this.actor = actor;
this.setupPermissionProfile();
final PlotArea[] areas = plotAreaManager.getAllPlotAreas();
final PlotArea area;
if (areas.length > 0) {

View File

@ -100,13 +100,19 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
private final PlotAreaManager plotAreaManager;
private final EventDispatcher eventDispatcher;
private final EconHandler econHandler;
private final PermissionProfile permissionProfile;
private final PermissionHandler permissionHandler;
// Delayed initialisation
private PermissionProfile permissionProfile;
public PlotPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler,
@Nonnull final PermissionHandler permissionHandler) {
this.plotAreaManager = plotAreaManager;
this.eventDispatcher = eventDispatcher;
this.econHandler = econHandler;
this.permissionHandler = permissionHandler;
}
protected void setupPermissionProfile() {
this.permissionProfile = permissionHandler.getPermissionProfile(this).orElse(
NullPermissionProfile.INSTANCE);
}