Someway somehow these events are no longer registered?

This commit is contained in:
Len 2022-09-29 19:34:17 +02:00
parent f34f0161ae
commit 46d6c9eaf3

View File

@ -7,6 +7,7 @@ import me.ryanhamshire.GriefPrevention.CreateClaimResult;
import me.ryanhamshire.GriefPrevention.DataStore; import me.ryanhamshire.GriefPrevention.DataStore;
import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.GriefPrevention;
import me.ryanhamshire.GriefPrevention.Messages; import me.ryanhamshire.GriefPrevention.Messages;
import me.ryanhamshire.GriefPrevention.PlayerData;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -27,6 +28,7 @@ public class AltitudeListener implements Listener {
public AltitudeListener(DataStore dataStore, GriefPrevention plugin) { public AltitudeListener(DataStore dataStore, GriefPrevention plugin) {
this.plugin = plugin; this.plugin = plugin;
this.worldInit(); this.worldInit();
Bukkit.getPluginManager().registerEvents(this, plugin);
} }
private void info(String s) { private void info(String s) {
@ -100,7 +102,8 @@ public class AltitudeListener implements Listener {
{ {
if (event.getEntered() instanceof Player player) if (event.getEntered() instanceof Player player)
{ {
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(player.getLocation(), true, null); PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(player.getLocation(), true, playerData.lastClaim);
if (claim != null) if (claim != null)
{ {
if (claim.allowAccess(player) != null) if (claim.allowAccess(player) != null)