Cleaned up GUI's.

This commit is contained in:
Brianna 2020-09-08 10:41:03 -05:00
parent d49e6a6815
commit 1d3e699555
7 changed files with 24 additions and 25 deletions

View File

@ -33,8 +33,6 @@ public class AnimatedKitGui extends Gui {
private boolean done = false;
private int tick = 0, updateTick = 0;
private int ticksPerUpdate = 3;
private final int updatesPerSlow = 6;
private final int ticksPerUpdateSlow = 10;
private int task;
public AnimatedKitGui(UltimateKits plugin, Player player, Kit kit, ItemStack give) {
@ -66,13 +64,15 @@ public class AnimatedKitGui extends Gui {
});
}
void tick() {
private void tick() {
if (++tick < ticksPerUpdate) {
return;
}
tick = 0;
int updatesPerSlow = 6;
if (++updateTick >= updatesPerSlow) {
updateTick = 0;
int ticksPerUpdateSlow = 10;
if (++ticksPerUpdate >= ticksPerUpdateSlow) {
finish = true;
}

View File

@ -74,7 +74,7 @@ public class BlockEditorGui extends Gui {
}
List<String> kitTypeLore(UltimateKits plugin) {
private List<String> kitTypeLore(UltimateKits plugin) {
String[] type = plugin.getLocale().getMessage("interface.kitblock.switchtypelore").getMessage().split("\\|");
return Arrays.asList(
type[0],

View File

@ -82,7 +82,7 @@ public class CategorySelectorGui extends Gui {
}
}
static final Random rand = new Random();
private static final Random rand = new Random();
private void animateGlass() {
for (int col = 1; col < 8; ++col) {

View File

@ -15,8 +15,6 @@ import java.util.Random;
public class KitDecorOptionsGui extends Gui {
static final Random rand = new Random();
public KitDecorOptionsGui(UltimateKits plugin, KitBlockData kitBlockData, Gui parent) {
super(parent);
setRows(3);

View File

@ -29,9 +29,9 @@ import java.util.List;
public class KitEditorGui extends DoubleGui {
private UltimateKits plugin;
private Kit kit;
private Player player;
private final UltimateKits plugin;
private final Kit kit;
private final Player player;
private boolean isInFunction = false;
private boolean isInInventory = false;
@ -408,6 +408,9 @@ public class KitEditorGui extends DoubleGui {
guiManager.showGUI(player, gui);
}
break;
default:
paint();
break;
}
}

View File

@ -25,16 +25,16 @@ import java.util.stream.Collectors;
public class KitSelectorGui extends Gui {
private Player player;
private UltimateKits plugin;
private final Player player;
private final UltimateKits plugin;
private int timer;
private Category category;
private final Category category;
private List<String> kitList;
private boolean kitsmode = false;
private boolean glassless;
private int showPerRow, showPerPage;
private final boolean glassless;
private final int showPerPage;
public KitSelectorGui(UltimateKits plugin, Player player, Category category) {
this.player = player;
@ -44,7 +44,7 @@ public class KitSelectorGui extends Gui {
setTitle(plugin.getLocale().getMessage("interface.selector.title").getMessage());
loadKits();
showPerRow = glassless ? 9 : 7;
int showPerRow = glassless ? 9 : 7;
int nrows = (int) Math.ceil(kitList.size() / (double) showPerRow);
setRows(glassless ? nrows : nrows + 2);
showPerPage = showPerRow * (glassless ? (nrows == 6 ? 6 : 5) : 4);
@ -110,7 +110,7 @@ public class KitSelectorGui extends Gui {
.collect(Collectors.toList());
}
static final Random rand = new Random();
private static final Random rand = new Random();
private void animateGlass() {
for (int col = 1; col < 8; ++col) {

View File

@ -24,17 +24,14 @@ public class PreviewKitGui extends Gui {
private final Kit kit;
private final Player player;
private final UltimateKits plugin;
private final boolean buyable;
private final List<ItemStack> list;
private final boolean useGlassBorder = !Settings.DO_NOT_USE_GLASS_BORDERS.getBoolean();
public PreviewKitGui(UltimateKits plugin, Player player, Kit kit, Gui back) {
super(back);
this.kit = kit;
this.player = player;
this.plugin = plugin;
this.list = kit.getReadableContents(player, true, true, false);
this.buyable = (kit.getLink() != null || kit.getPrice() != 0);
List<ItemStack> list = kit.getReadableContents(player, true, true, false);
boolean buyable = (kit.getLink() != null || kit.getPrice() != 0);
setTitle(plugin.getLocale().getMessage("interface.preview.title")
.processPlaceholder("kit", kit.getTitle() != null ? TextUtils.formatText(kit.getTitle(), true) : kit.getName()).getMessage());
@ -58,6 +55,7 @@ public class PreviewKitGui extends Gui {
}
int min = 0;
boolean useGlassBorder = !Settings.DO_NOT_USE_GLASS_BORDERS.getBoolean();
if (!useGlassBorder) {
min = 1;
if (!buyable) {
@ -139,7 +137,7 @@ public class PreviewKitGui extends Gui {
}
}
ItemStack getKitItem(ItemStack is) {
private ItemStack getKitItem(ItemStack is) {
ItemMeta meta = is.getItemMeta();
List<String> newLore = new ArrayList<>();
if (meta != null && meta.hasLore()) {
@ -152,7 +150,7 @@ public class PreviewKitGui extends Gui {
return is;
}
ItemStack getKitItem(ItemStack is, int amount) {
private ItemStack getKitItem(ItemStack is, int amount) {
ItemStack is2 = is.clone();
ItemMeta meta = is2.getItemMeta();
List<String> newLore = new ArrayList<>();
@ -167,7 +165,7 @@ public class PreviewKitGui extends Gui {
return is;
}
List<String> getBuyLore() {
private List<String> getBuyLore() {
ArrayList<String> lore = new ArrayList<>();
if (kit.hasPermissionToClaim(player)) {
lore.add(plugin.getLocale().getMessage("interface.button.clickeco")