mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-10 17:58:03 +01:00
Berries, Cauldrons, Border edge fixes, island nullpointer fix
This commit is contained in:
parent
1d4abe367a
commit
5b06e6577d
@ -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()));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user