Berries, Cauldrons, Border edge fixes, island nullpointer fix

This commit is contained in:
Esophose 2019-07-20 01:10:40 -06:00
parent 1d4abe367a
commit 5b06e6577d
4 changed files with 36 additions and 9 deletions

View File

@ -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()));

View File

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

View File

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

View File

@ -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;