mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-29 13:45:13 +01:00
Cleaned up GUI's.
This commit is contained in:
parent
d49e6a6815
commit
1d3e699555
@ -33,8 +33,6 @@ public class AnimatedKitGui extends Gui {
|
|||||||
private boolean done = false;
|
private boolean done = false;
|
||||||
private int tick = 0, updateTick = 0;
|
private int tick = 0, updateTick = 0;
|
||||||
private int ticksPerUpdate = 3;
|
private int ticksPerUpdate = 3;
|
||||||
private final int updatesPerSlow = 6;
|
|
||||||
private final int ticksPerUpdateSlow = 10;
|
|
||||||
private int task;
|
private int task;
|
||||||
|
|
||||||
public AnimatedKitGui(UltimateKits plugin, Player player, Kit kit, ItemStack give) {
|
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) {
|
if (++tick < ticksPerUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tick = 0;
|
tick = 0;
|
||||||
|
int updatesPerSlow = 6;
|
||||||
if (++updateTick >= updatesPerSlow) {
|
if (++updateTick >= updatesPerSlow) {
|
||||||
updateTick = 0;
|
updateTick = 0;
|
||||||
|
int ticksPerUpdateSlow = 10;
|
||||||
if (++ticksPerUpdate >= ticksPerUpdateSlow) {
|
if (++ticksPerUpdate >= ticksPerUpdateSlow) {
|
||||||
finish = true;
|
finish = true;
|
||||||
}
|
}
|
||||||
|
@ -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("\\|");
|
String[] type = plugin.getLocale().getMessage("interface.kitblock.switchtypelore").getMessage().split("\\|");
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
type[0],
|
type[0],
|
||||||
|
@ -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() {
|
private void animateGlass() {
|
||||||
for (int col = 1; col < 8; ++col) {
|
for (int col = 1; col < 8; ++col) {
|
||||||
|
@ -15,8 +15,6 @@ import java.util.Random;
|
|||||||
|
|
||||||
public class KitDecorOptionsGui extends Gui {
|
public class KitDecorOptionsGui extends Gui {
|
||||||
|
|
||||||
static final Random rand = new Random();
|
|
||||||
|
|
||||||
public KitDecorOptionsGui(UltimateKits plugin, KitBlockData kitBlockData, Gui parent) {
|
public KitDecorOptionsGui(UltimateKits plugin, KitBlockData kitBlockData, Gui parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
setRows(3);
|
setRows(3);
|
||||||
|
@ -29,9 +29,9 @@ import java.util.List;
|
|||||||
|
|
||||||
public class KitEditorGui extends DoubleGui {
|
public class KitEditorGui extends DoubleGui {
|
||||||
|
|
||||||
private UltimateKits plugin;
|
private final UltimateKits plugin;
|
||||||
private Kit kit;
|
private final Kit kit;
|
||||||
private Player player;
|
private final Player player;
|
||||||
|
|
||||||
private boolean isInFunction = false;
|
private boolean isInFunction = false;
|
||||||
private boolean isInInventory = false;
|
private boolean isInInventory = false;
|
||||||
@ -408,6 +408,9 @@ public class KitEditorGui extends DoubleGui {
|
|||||||
guiManager.showGUI(player, gui);
|
guiManager.showGUI(player, gui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
paint();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,16 +25,16 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class KitSelectorGui extends Gui {
|
public class KitSelectorGui extends Gui {
|
||||||
|
|
||||||
private Player player;
|
private final Player player;
|
||||||
private UltimateKits plugin;
|
private final UltimateKits plugin;
|
||||||
|
|
||||||
private int timer;
|
private int timer;
|
||||||
private Category category;
|
private final Category category;
|
||||||
private List<String> kitList;
|
private List<String> kitList;
|
||||||
private boolean kitsmode = false;
|
private boolean kitsmode = false;
|
||||||
|
|
||||||
private boolean glassless;
|
private final boolean glassless;
|
||||||
private int showPerRow, showPerPage;
|
private final int showPerPage;
|
||||||
|
|
||||||
public KitSelectorGui(UltimateKits plugin, Player player, Category category) {
|
public KitSelectorGui(UltimateKits plugin, Player player, Category category) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
@ -44,7 +44,7 @@ public class KitSelectorGui extends Gui {
|
|||||||
|
|
||||||
setTitle(plugin.getLocale().getMessage("interface.selector.title").getMessage());
|
setTitle(plugin.getLocale().getMessage("interface.selector.title").getMessage());
|
||||||
loadKits();
|
loadKits();
|
||||||
showPerRow = glassless ? 9 : 7;
|
int showPerRow = glassless ? 9 : 7;
|
||||||
int nrows = (int) Math.ceil(kitList.size() / (double) showPerRow);
|
int nrows = (int) Math.ceil(kitList.size() / (double) showPerRow);
|
||||||
setRows(glassless ? nrows : nrows + 2);
|
setRows(glassless ? nrows : nrows + 2);
|
||||||
showPerPage = showPerRow * (glassless ? (nrows == 6 ? 6 : 5) : 4);
|
showPerPage = showPerRow * (glassless ? (nrows == 6 ? 6 : 5) : 4);
|
||||||
@ -110,7 +110,7 @@ public class KitSelectorGui extends Gui {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static final Random rand = new Random();
|
private static final Random rand = new Random();
|
||||||
|
|
||||||
private void animateGlass() {
|
private void animateGlass() {
|
||||||
for (int col = 1; col < 8; ++col) {
|
for (int col = 1; col < 8; ++col) {
|
||||||
|
@ -24,17 +24,14 @@ public class PreviewKitGui extends Gui {
|
|||||||
private final Kit kit;
|
private final Kit kit;
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final UltimateKits plugin;
|
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) {
|
public PreviewKitGui(UltimateKits plugin, Player player, Kit kit, Gui back) {
|
||||||
super(back);
|
super(back);
|
||||||
this.kit = kit;
|
this.kit = kit;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.list = kit.getReadableContents(player, true, true, false);
|
List<ItemStack> list = kit.getReadableContents(player, true, true, false);
|
||||||
this.buyable = (kit.getLink() != null || kit.getPrice() != 0);
|
boolean buyable = (kit.getLink() != null || kit.getPrice() != 0);
|
||||||
|
|
||||||
setTitle(plugin.getLocale().getMessage("interface.preview.title")
|
setTitle(plugin.getLocale().getMessage("interface.preview.title")
|
||||||
.processPlaceholder("kit", kit.getTitle() != null ? TextUtils.formatText(kit.getTitle(), true) : kit.getName()).getMessage());
|
.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;
|
int min = 0;
|
||||||
|
boolean useGlassBorder = !Settings.DO_NOT_USE_GLASS_BORDERS.getBoolean();
|
||||||
if (!useGlassBorder) {
|
if (!useGlassBorder) {
|
||||||
min = 1;
|
min = 1;
|
||||||
if (!buyable) {
|
if (!buyable) {
|
||||||
@ -139,7 +137,7 @@ public class PreviewKitGui extends Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack getKitItem(ItemStack is) {
|
private ItemStack getKitItem(ItemStack is) {
|
||||||
ItemMeta meta = is.getItemMeta();
|
ItemMeta meta = is.getItemMeta();
|
||||||
List<String> newLore = new ArrayList<>();
|
List<String> newLore = new ArrayList<>();
|
||||||
if (meta != null && meta.hasLore()) {
|
if (meta != null && meta.hasLore()) {
|
||||||
@ -152,7 +150,7 @@ public class PreviewKitGui extends Gui {
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack getKitItem(ItemStack is, int amount) {
|
private ItemStack getKitItem(ItemStack is, int amount) {
|
||||||
ItemStack is2 = is.clone();
|
ItemStack is2 = is.clone();
|
||||||
ItemMeta meta = is2.getItemMeta();
|
ItemMeta meta = is2.getItemMeta();
|
||||||
List<String> newLore = new ArrayList<>();
|
List<String> newLore = new ArrayList<>();
|
||||||
@ -167,7 +165,7 @@ public class PreviewKitGui extends Gui {
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> getBuyLore() {
|
private List<String> getBuyLore() {
|
||||||
ArrayList<String> lore = new ArrayList<>();
|
ArrayList<String> lore = new ArrayList<>();
|
||||||
if (kit.hasPermissionToClaim(player)) {
|
if (kit.hasPermissionToClaim(player)) {
|
||||||
lore.add(plugin.getLocale().getMessage("interface.button.clickeco")
|
lore.add(plugin.getLocale().getMessage("interface.button.clickeco")
|
||||||
|
Loading…
Reference in New Issue
Block a user