Fixed known bug where glass pane would always be white and made the GUI little nicer

This commit is contained in:
Bekston 2022-09-22 05:34:59 +02:00
parent 37540f3c4b
commit 05b1b0f8f6
2 changed files with 16 additions and 3 deletions

View File

@ -69,7 +69,6 @@ public class PSHubCore extends JavaPlugin {
// Create ServerCache refreshing task
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
executor.scheduleAtFixedRate(serverCache, 1, getConfig().getInt("cache-time"), TimeUnit.SECONDS);
System.out.println(getConfig().getInt("cache-time"));
}
private void createMultiNodeConfig() throws IOException {

View File

@ -178,6 +178,13 @@ public class GUIUtils {
stopConfirmationMenu.setButton(0, 15, new SGButton(itemStopQuestionNo).withListener(listener2 -> {
player.closeInventory();
}));
for (int i = 0; i < 9 * 4; i++) {
if (stopConfirmationMenu.getButton(i) == null) {
stopConfirmationMenu.setButton(i, new SGButton(new ItemBuilder(XMaterial.GRAY_STAINED_GLASS_PANE.parseItem()).name(" ").build()));
}
}
player.openInventory(stopConfirmationMenu.getInventory());
}));
}
@ -199,15 +206,22 @@ public class GUIUtils {
deleteConfirmationMenu.setButton(0, 15, new SGButton(itemDeleteQuestionNo).withListener(listener2 -> {
player.closeInventory();
}));
for (int i = 0; i < 9 * 4; i++) {
if (deleteConfirmationMenu.getButton(i) == null) {
deleteConfirmationMenu.setButton(i, new SGButton(new ItemBuilder(XMaterial.GRAY_STAINED_GLASS_PANE.parseItem()).name(" ").build()));
}
}
player.openInventory(deleteConfirmationMenu.getInventory());
}));
menu.setButton(0, 4, new SGButton(itemPlayer));
// Fill all empty slots with glass pane
for (int i = 0; i < 9; i++) {
for (int i = 0; i < 9 * 4; i++) {
if (menu.getButton(i) == null) {
menu.setButton(i, new SGButton(new ItemBuilder(XMaterial.LIME_STAINED_GLASS_PANE.parseMaterial()).build()));
menu.setButton(i, new SGButton(new ItemBuilder(XMaterial.GRAY_STAINED_GLASS_PANE.parseItem()).name(" ").build()));
}
}