Fix background glass method in 1.12-

This commit is contained in:
Esophose 2019-07-15 20:25:06 -06:00 committed by Brianna
parent 0977b4faae
commit 5c9a8c3e8f
2 changed files with 9 additions and 23 deletions

View File

@ -83,7 +83,7 @@ public class CrateAnimateTask extends BukkitRunnable {
num = slow ? 1 : 0; num = slow ? 1 : 0;
for (int i = 0; i < 27; i++) { for (int i = 0; i < 27; i++) {
inventory.setItem(i, Methods.toGlass(true, 0)); inventory.setItem(i, Methods.getGlass(true, 0));
} }
for (int i = 9; i < 18; i++) { for (int i = 9; i < 18; i++) {

View File

@ -37,7 +37,14 @@ public class Methods {
return getGlass(false, instance.getConfig().getInt("Interfaces.Glass Type 3")); return getGlass(false, instance.getConfig().getInt("Interfaces.Glass Type 3"));
} }
private static ItemStack getGlass(Boolean rainbow, int type) { /**
* Creates a glass itemstack
*
* @param rainbow Whether or not to assign a random color to the glass.
* @param type If rainbow is false, the glass color.
* @return A glass itemstack conforming to the params.
*/
public static ItemStack getGlass(boolean rainbow, int type) {
int randomNum = 1 + (int) (Math.random() * 6); int randomNum = 1 + (int) (Math.random() * 6);
ItemStack glass; ItemStack glass;
if (rainbow) { if (rainbow) {
@ -53,7 +60,6 @@ public class Methods {
return glass; return glass;
} }
public static boolean canGiveKit(Player player) { public static boolean canGiveKit(Player player) {
try { try {
if (player.hasPermission("ultimatekits.cangive")) return true; if (player.hasPermission("ultimatekits.cangive")) return true;
@ -303,25 +309,5 @@ public class Methods {
item.setItemMeta(meta); item.setItemMeta(meta);
return item; return item;
} }
/**
* Creates a glass itemstack
*
* @param rainbow Whether or not to assign a random color to the glass.
* @param type If rainbow is false, the glass color.
* @return A glass itemstack conforming to the params.
*/
public static ItemStack toGlass(Boolean rainbow, int type) {
int randomNum = 1 + (int) (Math.random() * 6);
ItemStack glass;
if (rainbow) {
glass = new ItemStack(Material.LEGACY_STAINED_GLASS_PANE, 1, (short) randomNum);
} else {
glass = new ItemStack(Material.LEGACY_STAINED_GLASS_PANE, 1, (short) type);
}
ItemMeta glassMeta = glass.getItemMeta();
glassMeta.setDisplayName("§l");
glass.setItemMeta(glassMeta);
return glass;
}
} }