Fix ChestUI issue #859

This commit is contained in:
Connor Monahan 2020-11-25 10:42:12 -06:00
parent b27c02ca5e
commit f71a55e1e7
3 changed files with 46 additions and 22 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tommytony</groupId>
<artifactId>war</artifactId>
<version>2.0.0-RC5-SNAPSHOT</version>
<version>2.0.0-RC6-SNAPSHOT</version>
<packaging>jar</packaging>
<name>War</name>
<url>http://war.tommytony.com</url>

View File

@ -0,0 +1,41 @@
package com.tommytony.war.ui;
import com.tommytony.war.War;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class DefaultZoneConfigUI extends ChestUI {
@Override
public void build(Player player, Inventory inv) {
ItemStack item;
ItemMeta meta;
int i = 0;
item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
meta = item.getItemMeta();
meta.setDisplayName(">>>> Warzone Default Config >>>>");
item.setItemMeta(meta);
this.addItem(inv, i++, item, () -> War.war.getUIManager().assignUI(player, new WarAdminUI()));
i = UIConfigHelper.addWarzoneConfigOptions(this, player, inv, War.war.getWarzoneDefaultConfig(), null, i);
item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
meta = item.getItemMeta();
meta.setDisplayName(">>>> Team Default Config >>>>");
item.setItemMeta(meta);
this.addItem(inv, i++, item, () -> War.war.getUIManager().assignUI(player, new WarAdminUI()));
UIConfigHelper.addTeamConfigOptions(this, player, inv, War.war.getTeamDefaultConfig(), null, null, i);
}
@Override
public String getTitle() {
return ChatColor.DARK_RED + "" + ChatColor.BOLD + "War Default Zone Config";
}
@Override
public int getSize() {
return 9*6;
}
}

View File

@ -19,28 +19,11 @@ public class WarAdminUI extends ChestUI {
int i = 0;
i = UIConfigHelper.addWarConfigOptions(this, player, inv, War.war.getWarConfig(), i);
item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
item = new ItemStack(Material.CHEST);
meta = item.getItemMeta();
meta.setDisplayName(">>>> Warzone Default Config >>>>");
meta.setDisplayName("Warzone Default Config");
item.setItemMeta(meta);
this.addItem(inv, i++, item, new Runnable() {
@Override
public void run() {
War.war.getUIManager().assignUI(player, new WarAdminUI());
}
});
i = UIConfigHelper.addWarzoneConfigOptions(this, player, inv, War.war.getWarzoneDefaultConfig(), null, i);
item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
meta = item.getItemMeta();
meta.setDisplayName(">>>> Team Default Config >>>>");
item.setItemMeta(meta);
this.addItem(inv, i++, item, new Runnable() {
@Override
public void run() {
War.war.getUIManager().assignUI(player, new WarAdminUI());
}
});
UIConfigHelper.addTeamConfigOptions(this, player, inv, War.war.getTeamDefaultConfig(), null, null, i);
this.addItem(inv, 9*(i / 9) + 8, item, () -> War.war.getUIManager().assignUI(player, new DefaultZoneConfigUI()));
}
@Override
@ -50,6 +33,6 @@ public class WarAdminUI extends ChestUI {
@Override
public int getSize() {
return 9 * 7;
return 9 * 2;
}
}