Fixed npe in restricted blocks

This commit is contained in:
Fabrizio La Rosa 2020-07-21 21:14:45 +02:00
parent a67808188f
commit 5b4601198f

View File

@ -246,7 +246,8 @@ public class Block implements Listener {
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
if(!player.hasPermission("fabledskyblock.bypass.netherplace") && !islandManager.isIslandWorldUnlocked(island, IslandWorld.Nether)){
for(String s : Objects.requireNonNull(configLoad.getConfigurationSection("Island.Restrict.NetherBlocks")).getKeys(false)){
if(configLoad.getConfigurationSection("Island.Restrict.NetherBlocks") != null) {
for(String s : configLoad.getConfigurationSection("Island.Restrict.NetherBlocks").getKeys(false)){
if(s.equalsIgnoreCase(block.getType().toString())){
if(configLoad.getBoolean("Island.Restrict.NetherBlocks." + s, false)){
plugin.getMessageManager().sendMessage(player, Objects.requireNonNull(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
@ -256,9 +257,11 @@ public class Block implements Listener {
}
}
}
}
if(!player.hasPermission("fabledskyblock.bypass.endplace") && !islandManager.isIslandWorldUnlocked(island, IslandWorld.End)){
for(String s : Objects.requireNonNull(configLoad.getConfigurationSection("Island.Restrict.EndBlocks")).getKeys(false)){
if(configLoad.getConfigurationSection("Island.Restrict.EndBlocks") != null) {
for(String s : configLoad.getConfigurationSection("Island.Restrict.EndBlocks").getKeys(false)){
if(s.equalsIgnoreCase(block.getType().toString())){
if(configLoad.getBoolean("Island.Restrict.EndBlocks." + s)){
plugin.getMessageManager().sendMessage(player, Objects.requireNonNull(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
@ -268,6 +271,7 @@ public class Block implements Listener {
}
}
}
}
if (configLoad.getBoolean("Island.WorldBorder.Block") && block.getType() == Material.DISPENSER) {
if (!islandManager.isLocationAtIsland(island, blockLoc, world)) {