[Fixed] Island Setting saving was still bugged.

[Fixed] LagSpike due to old method used in BlockListener.
This commit is contained in:
TeamHRLive 2024-08-30 18:59:01 +05:30
parent 09e5291478
commit ebfaea252c
2 changed files with 13 additions and 3 deletions

View File

@ -934,7 +934,7 @@ public class Island {
for (Entry<IslandRole, List<IslandPermission>> entry : this.islandPermissions.entrySet()) {
for (IslandPermission permission : entry.getValue()) {
configLoad.set("Settings." + entry.getKey().getFriendlyName() + "." + permission.getPermission().getName(), permission.getStatus());
configLoad.set("Settings." + entry.getKey().getFriendlyName().toUpperCase(Locale.US) + "." + permission.getPermission().getName(), permission.getStatus());
}
}

View File

@ -335,13 +335,23 @@ public class BlockListeners implements Listener {
isObstructing = true;
}
// Specific check for beds
if (!isObstructing && event.getBlock().getState().getData() instanceof org.bukkit.material.Bed) {
// Specific check for beds using getBlockData() for versions 1.13 and above
if (!isObstructing && event.getBlock().getBlockData() instanceof org.bukkit.block.data.type.Bed && MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
org.bukkit.block.data.type.Bed bedData = (org.bukkit.block.data.type.Bed) event.getBlock().getBlockData();
BlockFace bedDirection = bedData.getFacing();
org.bukkit.block.Block bedBlock = block.getRelative(bedDirection);
if (LocationUtil.isLocationAffectingIslandSpawn(bedBlock.getLocation(), island, world)) {
isObstructing = true;
}
} // Specific check for beds using getBlockData() for versions 1.12 and below
else if (MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) {
if (!isObstructing && event.getBlock().getState().getData() instanceof org.bukkit.material.Bed){
BlockFace bedDirection = ((org.bukkit.material.Bed) event.getBlock().getState().getData()).getFacing();
org.bukkit.block.Block bedBlock = block.getRelative(bedDirection);
if (LocationUtil.isLocationAffectingIslandSpawn(bedBlock.getLocation(), island, world)) {
isObstructing = true;
}
}
}
if (isObstructing) {