mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-10-22 12:20:26 +02:00
fix: Fix NullpointerException when MarketplaceUrl is null in OverviewGUI
This commit is contained in:
parent
9b7e65992a
commit
27115b20e8
@ -23,34 +23,19 @@ final class SongodaCoreOverviewGUI extends Gui {
|
|||||||
for (int i = 0; i < plugins.size(); ++i) {
|
for (int i = 0; i < plugins.size(); ++i) {
|
||||||
final PluginInfo plugin = plugins.get(i);
|
final PluginInfo plugin = plugins.get(i);
|
||||||
|
|
||||||
if (plugin.hasUpdate()) {
|
boolean hasMarketplaceLink = plugin.getMarketplaceLink() != null && !plugin.getMarketplaceLink().isEmpty();
|
||||||
|
|
||||||
setButton(i, GuiUtils.createButtonItem(plugin.getIcon() != null ? plugin.getIcon() : XMaterial.STONE,
|
setButton(i, GuiUtils.createButtonItem(plugin.getIcon() != null ? plugin.getIcon() : XMaterial.STONE,
|
||||||
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
|
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
|
||||||
ChatColor.GRAY + "Latest Version: " + plugin.getLatestVersion(),
|
|
||||||
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
|
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
|
||||||
"",
|
"",
|
||||||
"Change log:",
|
hasMarketplaceLink ? (ChatColor.GOLD + "Click for the marketplace page link.") : "",
|
||||||
plugin.getChangeLog(),
|
|
||||||
"",
|
|
||||||
ChatColor.GOLD + "Click for the marketplace page link.",
|
|
||||||
ChatColor.GOLD + "Right Click to edit plugin settings."
|
ChatColor.GOLD + "Right Click to edit plugin settings."
|
||||||
),
|
),
|
||||||
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
|
ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
|
||||||
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
|
if (hasMarketplaceLink) {
|
||||||
highlightItem(i);
|
setAction(i, ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setButton(i, GuiUtils.createButtonItem(plugin.getIcon() != null ? plugin.getIcon() : XMaterial.STONE,
|
|
||||||
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
|
|
||||||
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
|
|
||||||
"",
|
|
||||||
ChatColor.GOLD + "Click for the marketplace page link.",
|
|
||||||
ChatColor.GOLD + "Right Click to edit plugin settings."
|
|
||||||
),
|
|
||||||
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
|
|
||||||
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user