diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index 9d9d7e4cb..71ea28a68 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -95,6 +95,7 @@ public class BukkitPlayer extends PlotPlayer { super(plotAreaManager, eventDispatcher, econHandler, permissionHandler); this.player = player; this.econHandler = econHandler; + this.setupPermissionProfile(); if (realPlayer) { super.populatePersistentMetaMap(); } diff --git a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java index c47f54881..6a0a5c715 100644 --- a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java @@ -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 { @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) { diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index a40c1b70f..e03b3c726 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -100,13 +100,19 @@ public abstract class PlotPlayer

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); }