diff --git a/src/main/java/me/goodandevil/skyblock/island/Island.java b/src/main/java/me/goodandevil/skyblock/island/Island.java index 2edcb066..f722928f 100644 --- a/src/main/java/me/goodandevil/skyblock/island/Island.java +++ b/src/main/java/me/goodandevil/skyblock/island/Island.java @@ -182,7 +182,13 @@ public class Island { save(); - PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(Bukkit.getServer().getPlayer(ownerUUID)); + Player onlinePlayer = Bukkit.getServer().getPlayer(ownerUUID); + + if (!skyblock.getPlayerDataManager().hasPlayerData(onlinePlayer)) { + skyblock.getPlayerDataManager().createPlayerData(onlinePlayer); + } + + PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(onlinePlayer); playerData.setPlaytime(0); playerData.setOwner(ownerUUID); playerData.setMemberSince(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date())); diff --git a/src/main/java/me/goodandevil/skyblock/island/IslandManager.java b/src/main/java/me/goodandevil/skyblock/island/IslandManager.java index 18cebc04..61cf28cb 100644 --- a/src/main/java/me/goodandevil/skyblock/island/IslandManager.java +++ b/src/main/java/me/goodandevil/skyblock/island/IslandManager.java @@ -1402,10 +1402,6 @@ public class IslandManager { if (islandLocation == null) return false; - double size = island.getRadius(); - if (size % 2 == 1) - size++; - - return LocationUtil.isLocationAtLocationRadius(location.clone().add(0.5, 0, 0.5), islandLocation, size); + return LocationUtil.isLocationAtLocationRadius(location.clone().add(0.5, 0, 0.5), islandLocation, island.getRadius() + 1); } } diff --git a/src/main/java/me/goodandevil/skyblock/listeners/Interact.java b/src/main/java/me/goodandevil/skyblock/listeners/Interact.java index 7b35af35..2275d5b1 100644 --- a/src/main/java/me/goodandevil/skyblock/listeners/Interact.java +++ b/src/main/java/me/goodandevil/skyblock/listeners/Interact.java @@ -46,6 +46,7 @@ import me.goodandevil.skyblock.utils.structure.StructureUtil; import me.goodandevil.skyblock.utils.version.Materials; import me.goodandevil.skyblock.utils.version.NMSUtil; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.material.Cauldron; public class Interact implements Listener { @@ -109,6 +110,17 @@ public class Interact implements Listener { .getFileConfiguration().getString("Island.Settings.Permission.Message")); soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + return; + } + } else if (block.getState() instanceof Cauldron) { // WildStacker stackables + if (!islandManager.hasPermission(player, block.getLocation(), "Place") || !islandManager.hasPermission(player, block.getLocation(), "Destroy")) { + event.setCancelled(true); + + messageManager.sendMessage(player, + skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")) + .getFileConfiguration().getString("Island.Settings.Permission.Message")); + soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + return; } } @@ -163,7 +175,8 @@ public class Interact implements Listener { Location location = event.getClickedBlock().getLocation(); if (stackableManager.isStacked(location)) { Stackable stackable = stackableManager.getStack(location, event.getMaterial()); - stackable.addOne(); + if (stackable != null) + stackable.addOne(); } else { stackableManager.addStack(new Stackable(location, event.getMaterial())); } @@ -186,7 +199,19 @@ public class Interact implements Listener { level.setMaterialAmount(materials.name(), materialAmount + 1); } - if (block.getType() == Material.ANVIL) { + + if (block.getType() == Materials.SWEET_BERRY_BUSH.parseMaterial()) { + if (!islandManager.hasPermission(player, block.getLocation(), "Destroy")) { + event.setCancelled(true); + + messageManager.sendMessage(player, + skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")) + .getFileConfiguration().getString("Island.Settings.Permission.Message")); + soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + + return; + } + } else if (block.getType() == Material.ANVIL) { if (!islandManager.hasPermission(player, block.getLocation(), "Anvil")) { event.setCancelled(true); diff --git a/src/main/java/me/goodandevil/skyblock/stackable/StackableManager.java b/src/main/java/me/goodandevil/skyblock/stackable/StackableManager.java index 5439a53b..f58728c5 100644 --- a/src/main/java/me/goodandevil/skyblock/stackable/StackableManager.java +++ b/src/main/java/me/goodandevil/skyblock/stackable/StackableManager.java @@ -84,7 +84,7 @@ public class StackableManager { public Stackable getStack(Location location, Material material) { Stackable stackable = stacks.get(location); - if (stackable.getMaterial() == material) + if (stackable != null && stackable.getMaterial() == material) return stacks.get(location); else return null;