mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-09 01:07:58 +01:00
Fixed NullPointer in admin level menu
This commit is contained in:
parent
08b3cbdb33
commit
2eb0864c0f
@ -178,6 +178,7 @@ public class Levelling implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inventoryName.equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Admin.Levelling.Title")))) {
|
if (inventoryName.equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Admin.Levelling.Title")))) {
|
||||||
|
event.setCancelled(true);
|
||||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||||
|
|
||||||
if (!(player.hasPermission("fabledskyblock.admin.level") || player.hasPermission("fabledskyblock.admin.*")
|
if (!(player.hasPermission("fabledskyblock.admin.level") || player.hasPermission("fabledskyblock.admin.*")
|
||||||
@ -185,7 +186,6 @@ public class Levelling implements Listener {
|
|||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Admin.Levelling.Permission.Message"));
|
configLoad.getString("Island.Admin.Levelling.Permission.Message"));
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,6 @@ public class Levelling implements Listener {
|
|||||||
&& (is.hasItemMeta())
|
&& (is.hasItemMeta())
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Admin.Levelling.Item.Barrier.Displayname"))))) {
|
configLoad.getString("Menu.Admin.Levelling.Item.Barrier.Displayname"))))) {
|
||||||
event.setCancelled(true);
|
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_GLASS_BREAK.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_GLASS_BREAK.getSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -201,7 +200,6 @@ public class Levelling implements Listener {
|
|||||||
&& (is.hasItemMeta())
|
&& (is.hasItemMeta())
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Admin.Levelling.Item.Exit.Displayname"))))) {
|
configLoad.getString("Menu.Admin.Levelling.Item.Exit.Displayname"))))) {
|
||||||
event.setCancelled(true);
|
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_CLOSE.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_CLOSE.getSound(), 1.0F, 1.0F);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
|
||||||
@ -209,7 +207,6 @@ public class Levelling implements Listener {
|
|||||||
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_SIGN.getMaterial()) && (is.hasItemMeta())
|
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_SIGN.getMaterial()) && (is.hasItemMeta())
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Admin.Levelling.Item.Information.Displayname"))))) {
|
configLoad.getString("Menu.Admin.Levelling.Item.Information.Displayname"))))) {
|
||||||
event.setCancelled(true);
|
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_BUTTON_CLICK_ON.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_BUTTON_CLICK_ON.getSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
AbstractAnvilGUI gui = new AbstractAnvilGUI(player, event1 -> {
|
AbstractAnvilGUI gui = new AbstractAnvilGUI(player, event1 -> {
|
||||||
@ -271,7 +268,6 @@ public class Levelling implements Listener {
|
|||||||
} else if ((event.getCurrentItem().getType() == Material.BARRIER) && (is.hasItemMeta())
|
} else if ((event.getCurrentItem().getType() == Material.BARRIER) && (is.hasItemMeta())
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Admin.Levelling.Item.Nothing.Displayname"))))) {
|
configLoad.getString("Menu.Admin.Levelling.Item.Nothing.Displayname"))))) {
|
||||||
event.setCancelled(true);
|
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -279,7 +275,6 @@ public class Levelling implements Listener {
|
|||||||
&& (is.hasItemMeta())) {
|
&& (is.hasItemMeta())) {
|
||||||
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Admin.Levelling.Item.Previous.Displayname")))) {
|
configLoad.getString("Menu.Admin.Levelling.Item.Previous.Displayname")))) {
|
||||||
event.setCancelled(true);
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
|
||||||
playerData.setPage(playerData.getPage() - 1);
|
playerData.setPage(playerData.getPage() - 1);
|
||||||
@ -290,7 +285,6 @@ public class Levelling implements Listener {
|
|||||||
return;
|
return;
|
||||||
} else if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
} else if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Admin.Levelling.Item.Next.Displayname")))) {
|
configLoad.getString("Menu.Admin.Levelling.Item.Next.Displayname")))) {
|
||||||
event.setCancelled(true);
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
|
||||||
playerData.setPage(playerData.getPage() + 1);
|
playerData.setPage(playerData.getPage() + 1);
|
||||||
@ -306,9 +300,9 @@ public class Levelling implements Listener {
|
|||||||
for (LevellingMaterial materialList : levellingManager.getWorthsAsLevelingMaterials()) {
|
for (LevellingMaterial materialList : levellingManager.getWorthsAsLevelingMaterials()) {
|
||||||
CompatibleMaterial materials = materialList.getMaterials();
|
CompatibleMaterial materials = materialList.getMaterials();
|
||||||
|
|
||||||
if (event.getCurrentItem().getType() == CompatibleMaterial.getMaterial(materials.getMaterial()).getMaterial()
|
if (CompatibleMaterial.getMaterial(materials.getMaterial()) != null
|
||||||
|
&& event.getCurrentItem().getType().equals(CompatibleMaterial.getMaterial(materials.getMaterial()).getMaterial())
|
||||||
&& ChatColor.stripColor(is.getItemMeta().getDisplayName()).equals(materials.name())) {
|
&& ChatColor.stripColor(is.getItemMeta().getDisplayName()).equals(materials.name())) {
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
if (event.getClick() == ClickType.LEFT) {
|
if (event.getClick() == ClickType.LEFT) {
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_BUTTON_CLICK_ON.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_BUTTON_CLICK_ON.getSound(), 1.0F, 1.0F);
|
||||||
@ -411,8 +405,6 @@ public class Levelling implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
CompatibleMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType());
|
CompatibleMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType());
|
||||||
|
|
||||||
if (NMSUtil.getVersionNumber() < 13) {
|
if (NMSUtil.getVersionNumber() < 13) {
|
||||||
|
Loading…
Reference in New Issue
Block a user