mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-12-03 15:43:31 +01:00
selector gui
This commit is contained in:
parent
00d42a96cc
commit
faafe5fdbd
@ -3,7 +3,7 @@ package com.songoda.ultimatekits.commands;
|
||||
import com.songoda.core.commands.AbstractCommand;
|
||||
import com.songoda.core.gui.GuiManager;
|
||||
import com.songoda.ultimatekits.UltimateKits;
|
||||
import com.songoda.ultimatekits.gui.GUIKitSelector;
|
||||
import com.songoda.ultimatekits.gui.KitSelectorGui;
|
||||
import com.songoda.ultimatekits.kit.Kit;
|
||||
import com.songoda.ultimatekits.utils.Methods;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -33,7 +33,7 @@ public class CommandKit extends AbstractCommand {
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
new GUIKitSelector(instance, (Player) sender);
|
||||
new KitSelectorGui(instance, (Player) sender);
|
||||
} else if (args.length == 1) {
|
||||
Player player = (Player) sender;
|
||||
String kitName = args[0].toLowerCase();
|
||||
|
@ -1,315 +0,0 @@
|
||||
package com.songoda.ultimatekits.gui;
|
||||
|
||||
import com.songoda.core.gui.Gui;
|
||||
import com.songoda.core.utils.ItemUtils;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.ultimatekits.UltimateKits;
|
||||
import com.songoda.ultimatekits.kit.Kit;
|
||||
import com.songoda.ultimatekits.settings.Settings;
|
||||
import com.songoda.ultimatekits.utils.Methods;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GUIKitSelector extends Gui {
|
||||
|
||||
private Player player;
|
||||
private UltimateKits plugin;
|
||||
|
||||
private int timer;
|
||||
private int page = 1;
|
||||
private int max;
|
||||
private List<String> kitList;
|
||||
private boolean kitsmode = false;
|
||||
|
||||
private boolean glassless;
|
||||
|
||||
public GUIKitSelector(UltimateKits plugin, Player player) {
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
glassless = Settings.DO_NOT_USE_GLASS_BORDERS.getBoolean();
|
||||
|
||||
setTitle(plugin.getLocale().getMessage("interface.selector.title").getMessage());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
kitList = new ArrayList<>();
|
||||
|
||||
setUpPage();
|
||||
|
||||
|
||||
int n = 7;
|
||||
if (glassless)
|
||||
n = 9;
|
||||
max = 27;
|
||||
if (kitList.size() > n) {
|
||||
max = 36;
|
||||
}
|
||||
if (glassless) {
|
||||
if (kitList.size() > n + 36)
|
||||
max = max + 36;
|
||||
else if (kitList.size() > n + 27)
|
||||
max = max + 27;
|
||||
else if (kitList.size() > n + 18)
|
||||
max = max + 18;
|
||||
else if (kitList.size() > n + 9)
|
||||
max = max + 9;
|
||||
}
|
||||
if (glassless) max -= 18;
|
||||
|
||||
timer = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
|
||||
if (inventory.getViewers().isEmpty()) return;
|
||||
constructGUI();
|
||||
}, 20L, 20L);
|
||||
}
|
||||
|
||||
private void setUpPage() {
|
||||
int ino = 14;
|
||||
if (plugin.getConfig().getBoolean("Interfaces.Do Not Use Glass Borders")) ino = 54;
|
||||
int num = 0;
|
||||
int start = (page - 1) * ino;
|
||||
int show = 1;
|
||||
kitList.clear();
|
||||
for (Kit kit : plugin.getKitManager().getKits()) {
|
||||
if (!kit.isHidden()
|
||||
&& (!plugin.getConfig().getBoolean("Main.Only Show Players Kits They Have Permission To Use") || kit.hasPermission(player))
|
||||
&& num >= start
|
||||
&& show <= ino) {
|
||||
kitList.add(kit.getName());
|
||||
show++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void constructGUI() {
|
||||
resetClickables();
|
||||
registerClickables();
|
||||
|
||||
ItemStack exit = new ItemStack(Material.valueOf(plugin.getConfig().getString("Interfaces.Exit Icon")), 1);
|
||||
ItemMeta exitmeta = exit.getItemMeta();
|
||||
exitmeta.setDisplayName(UltimateKits.getInstance().getLocale().getMessage("interface.button.exit")
|
||||
.getMessage());
|
||||
exit.setItemMeta(exitmeta);
|
||||
|
||||
int num = 0;
|
||||
if (!glassless) {
|
||||
while (num != max) {
|
||||
ItemStack glass = Methods.getGlass();
|
||||
inventory.setItem(num, glass);
|
||||
num++;
|
||||
}
|
||||
|
||||
inventory.setItem(0, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(1, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(9, Methods.getBackgroundGlass(true));
|
||||
|
||||
inventory.setItem(7, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(8, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(17, Methods.getBackgroundGlass(true));
|
||||
|
||||
inventory.setItem(max - 18, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(max - 9, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(max - 8, Methods.getBackgroundGlass(true));
|
||||
|
||||
inventory.setItem(max - 10, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(max - 2, Methods.getBackgroundGlass(true));
|
||||
inventory.setItem(max - 1, Methods.getBackgroundGlass(true));
|
||||
|
||||
inventory.setItem(2, Methods.getBackgroundGlass(false));
|
||||
inventory.setItem(6, Methods.getBackgroundGlass(false));
|
||||
inventory.setItem(max - 7, Methods.getBackgroundGlass(false));
|
||||
inventory.setItem(max - 3, Methods.getBackgroundGlass(false));
|
||||
}
|
||||
|
||||
num = glassless ? 0 : 10;
|
||||
int id = 0;
|
||||
int tmax = max;
|
||||
if (!glassless)
|
||||
tmax = tmax - 10;
|
||||
for (int index = num; index != tmax; index++) {
|
||||
if (!glassless) {
|
||||
if (index == 17 || index == (max - 18)) index++;
|
||||
if (index == 18 && max == 36) index++;
|
||||
}
|
||||
if (id > kitList.size() - 1) {
|
||||
inventory.setItem(index, new ItemStack(Material.AIR));
|
||||
continue;
|
||||
}
|
||||
String kitItem = kitList.get(id);
|
||||
|
||||
Kit kit = plugin.getKitManager().getKit(kitItem);
|
||||
|
||||
String title = plugin.getLocale().getMessage("interface.selector.kit")
|
||||
.processPlaceholder("kit", Methods.formatText(kitItem, true)).getMessage();
|
||||
|
||||
if (kit.getTitle() != null)
|
||||
title = Methods.formatText(kit.getTitle());
|
||||
|
||||
ItemStack item = new ItemStack(Material.ENCHANTED_BOOK);
|
||||
if (kit.getDisplayItem() != null)
|
||||
item.setType(kit.getDisplayItem());
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(TextUtils.convertToInvisibleString(kitItem + ":") + Methods.formatText(title));
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
if (kit.getPrice() != 0)
|
||||
lore.add(Methods.formatText("&7This kit costs &a$" + kit.getPrice() + "&7."));
|
||||
else if (kit.getLink() != null)
|
||||
lore.add(plugin.getLocale().getMessage("general.type.link").getMessage());
|
||||
|
||||
|
||||
if (!kitsmode) {
|
||||
if (!plugin.getLocale().getMessage("interface.selector.aboutkit").getMessage().trim().equals("")) {
|
||||
String[] parts = plugin.getLocale().getMessage("interface.selector.aboutkit").getMessage().split("\\|");
|
||||
lore.add("");
|
||||
for (String line : parts)
|
||||
lore.add(Methods.formatText(line));
|
||||
}
|
||||
if (kit.hasPermission(player)) {
|
||||
if (kit.getNextUse(player) == -1) {
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.once").getMessage());
|
||||
} else if (kit.getNextUse(player) > 0) {
|
||||
if (!plugin.getLocale().getMessage("event.claim.wait").getMessage().trim().equals("")) {
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.wait")
|
||||
.processPlaceholder("time", Methods.makeReadable(kit.getNextUse(player)))
|
||||
.getMessage());
|
||||
}
|
||||
} else if (!plugin.getLocale().getMessage("event.claim.ready").getMessage().trim().equals("")) {
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.ready").getMessage());
|
||||
}
|
||||
} else
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.noaccess").getMessage());
|
||||
lore.add("");
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.leftpreview").getMessage());
|
||||
if (kit.hasPermission(player)) {
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.rightclaim").getMessage());
|
||||
} else if (kit.getPrice() != 0 || kit.getLink() != null) {
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.rightbuy").getMessage());
|
||||
}
|
||||
|
||||
if (player.hasPermission("ultimatekits.admin")) {
|
||||
lore.add("");
|
||||
lore.add(Methods.formatText("&6Middle Click &7to edit positioning."));
|
||||
}
|
||||
} else {
|
||||
lore.add(Methods.formatText("&6&lEdit Mode"));
|
||||
|
||||
lore.add("");
|
||||
lore.add(Methods.formatText("&6Left Click &7to move kit left"));
|
||||
lore.add(Methods.formatText("&6Right Click &7to move kit right"));
|
||||
lore.add("");
|
||||
|
||||
lore.add(Methods.formatText("&6Middle Click &7to go back."));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
|
||||
inventory.setItem(index, item);
|
||||
registerClickable(index, ((player1, inventory1, cursor, slot, type) -> {
|
||||
if (type == ClickType.MIDDLE && player.hasPermission("ultimatekits.admin")) {
|
||||
kitsmode = !kitsmode;
|
||||
constructGUI();
|
||||
return;
|
||||
}
|
||||
|
||||
if (kitsmode) {
|
||||
if (type == ClickType.RIGHT) {
|
||||
plugin.getKitManager().moveKit(kit, true);
|
||||
} else if (type == ClickType.LEFT) {
|
||||
plugin.getKitManager().moveKit(kit, false);
|
||||
}
|
||||
setUpPage();
|
||||
constructGUI();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (type == ClickType.LEFT) {
|
||||
kit.display(player, guiManager, this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == ClickType.RIGHT) {
|
||||
kit.buy(player);
|
||||
constructGUI();
|
||||
}
|
||||
}));
|
||||
|
||||
id++;
|
||||
}
|
||||
|
||||
ItemStack info = new ItemStack(Material.BOOK, 1);
|
||||
ItemMeta infometa = info.getItemMeta();
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
String[] parts = plugin.getLocale().getMessage("interface.selector.details")
|
||||
.processPlaceholder("player", player.getName()).getMessage().split("\\|");
|
||||
boolean hit = false;
|
||||
for (String line : parts) {
|
||||
if (!hit)
|
||||
infometa.setDisplayName(Methods.formatText(line));
|
||||
else
|
||||
lore.add(Methods.formatText(line));
|
||||
hit = true;
|
||||
}
|
||||
infometa.setLore(lore);
|
||||
info.setItemMeta(infometa);
|
||||
|
||||
ItemStack skull = ItemUtils.getCustomHead("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
|
||||
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
|
||||
skull.setDurability((short) 3);
|
||||
skullMeta.setDisplayName(plugin.getLocale().getMessage("interface.button.next").getMessage());
|
||||
skull.setItemMeta(skullMeta);
|
||||
|
||||
ItemStack skull2 = ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
|
||||
SkullMeta skull2Meta = (SkullMeta) skull2.getItemMeta();
|
||||
skull2.setDurability((short) 3);
|
||||
skull2Meta.setDisplayName(plugin.getLocale().getMessage("interface.button.next").getMessage());
|
||||
skull2.setItemMeta(skull2Meta);
|
||||
|
||||
if (!plugin.getConfig().getBoolean("Interfaces.Do Not Use Glass Borders"))
|
||||
inventory.setItem(max - 5, exit);
|
||||
if (kitList.size() == 14)
|
||||
inventory.setItem(max - 4, skull);
|
||||
if (page != 1)
|
||||
inventory.setItem(max - 6, skull2);
|
||||
if (!plugin.getConfig().getBoolean("Interfaces.Do Not Use Glass Borders"))
|
||||
inventory.setItem(4, info);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerClickables() {
|
||||
|
||||
registerClickable(max - 5, (player, inventory, cursor, slot, type) -> player.closeInventory());
|
||||
|
||||
registerClickable(max - 6, ((player1, inventory1, cursor, slot, type) -> {
|
||||
if (page == 1) return;
|
||||
page --;
|
||||
setUpPage();
|
||||
constructGUI();
|
||||
}));
|
||||
|
||||
registerClickable(max - 4, ((player1, inventory1, cursor, slot, type) -> {
|
||||
if (kitList.size() == 14) {
|
||||
page++;
|
||||
setUpPage();
|
||||
constructGUI();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerOnCloses() {
|
||||
registerOnClose(((player1, inventory1) -> Bukkit.getScheduler().cancelTask(timer)));
|
||||
}
|
||||
|
||||
}
|
201
src/main/java/com/songoda/ultimatekits/gui/KitSelectorGui.java
Normal file
201
src/main/java/com/songoda/ultimatekits/gui/KitSelectorGui.java
Normal file
@ -0,0 +1,201 @@
|
||||
package com.songoda.ultimatekits.gui;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.gui.Gui;
|
||||
import com.songoda.core.gui.GuiUtils;
|
||||
import com.songoda.core.utils.ItemUtils;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.ultimatekits.UltimateKits;
|
||||
import com.songoda.ultimatekits.kit.Kit;
|
||||
import com.songoda.ultimatekits.settings.Settings;
|
||||
import com.songoda.ultimatekits.utils.Methods;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitSelectorGui extends Gui {
|
||||
|
||||
private Player player;
|
||||
private UltimateKits plugin;
|
||||
|
||||
private int timer;
|
||||
private List<String> kitList;
|
||||
private boolean kitsmode = false;
|
||||
|
||||
private boolean glassless;
|
||||
private int showPerRow, showPerPage;
|
||||
|
||||
public KitSelectorGui(UltimateKits plugin, Player player) {
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
glassless = Settings.DO_NOT_USE_GLASS_BORDERS.getBoolean();
|
||||
|
||||
setTitle(plugin.getLocale().getMessage("interface.selector.title").getMessage());
|
||||
loadKits();
|
||||
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);
|
||||
pages = kitList.size() / showPerPage;
|
||||
page = 1;
|
||||
|
||||
setItem(0, 4, GuiUtils.createButtonItem(CompatibleMaterial.BOOK,
|
||||
plugin.getLocale().getMessage("interface.selector.details")
|
||||
.processPlaceholder("player", player.getName()).getMessage().split("\\|")));
|
||||
|
||||
this.setNextPage(rows - 1, 5, GuiUtils.createButtonItem(ItemUtils.getCustomHead("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"),
|
||||
plugin.getLocale().getMessage("interface.button.next").getMessage()));
|
||||
|
||||
this.setPrevPage(rows - 1, 3, GuiUtils.createButtonItem(ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"),
|
||||
plugin.getLocale().getMessage("interface.button.last").getMessage()));
|
||||
|
||||
this.setOnPage(pager -> showPage());
|
||||
showPage();
|
||||
|
||||
if (!glassless) {
|
||||
setButton(rows - 1, 4, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR),
|
||||
UltimateKits.getInstance().getLocale().getMessage("interface.button.exit").getMessage()),
|
||||
event -> exit());
|
||||
}
|
||||
|
||||
ItemStack glass2 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_2.getMaterial());
|
||||
setDefaultItem(AIR);
|
||||
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
|
||||
|
||||
if(!glassless) {
|
||||
if(Settings.RAINBOW.getBoolean()) {
|
||||
animateGlass();
|
||||
timer = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
|
||||
if (inventory.getViewers().isEmpty()) return;
|
||||
animateGlass();
|
||||
}, 20L, 20L);
|
||||
setOnClose(event -> Bukkit.getScheduler().cancelTask(timer));
|
||||
} else {
|
||||
ItemStack glass1 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_1.getMaterial());
|
||||
ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial());
|
||||
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 1, 0, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 1, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 2, true, true, glass3);
|
||||
GuiUtils.mirrorFill(this, 0, 3, false, true, glass1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadKits() {
|
||||
boolean showAll = !Settings.ONLY_SHOW_KITS_WITH_PERMS.getBoolean();
|
||||
kitList = plugin.getKitManager().getKits().stream()
|
||||
.filter(kit -> !kit.isHidden() && (showAll || kit.hasPermission(player)))
|
||||
.map(kit -> kit.getName())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
static final Random rand = new Random();
|
||||
private void animateGlass() {
|
||||
for(int col = 1; col < 7; ++col) {
|
||||
ItemStack it;
|
||||
if((it = getItem(0, col)) == null || it.getType().name().contains("PANE"))
|
||||
setItem(0, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16))));
|
||||
if((it = getItem(rows - 1, col)) == null || it.getType().name().contains("PANE"))
|
||||
setItem(rows - 1, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16))));
|
||||
}
|
||||
for(int row = 1; row + 1 < rows; ++row) {
|
||||
setItem(row, 0, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16))));
|
||||
setItem(row, 8, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16))));
|
||||
}
|
||||
}
|
||||
|
||||
private void showPage() {
|
||||
int index = (page - 1) * showPerPage;
|
||||
for (int row = glassless ? 0 : 1; row < (!glassless || pages != 1 ? rows - 2 : rows - 1) && index < kitList.size(); ++row) {
|
||||
for (int col = glassless ? 0 : 1; col < (glassless ? 9 : 8) && index < kitList.size(); ++col) {
|
||||
final String kitItem = kitList.get(index++);
|
||||
final Kit kit = plugin.getKitManager().getKit(kitItem);
|
||||
|
||||
String kitTitle = kit.getTitle() != null
|
||||
? ChatColor.translateAlternateColorCodes('&', kit.getTitle())
|
||||
: plugin.getLocale().getMessage("interface.selector.kit")
|
||||
.processPlaceholder("kit", TextUtils.formatText(kitItem, true)).getMessage();
|
||||
|
||||
setButton(row, col, GuiUtils.createButtonItem(
|
||||
kit.getDisplayItem() != null ? kit.getDisplayItem() : CompatibleMaterial.ENCHANTED_BOOK,
|
||||
TextUtils.convertToInvisibleString(kitItem + ":") + kitTitle,
|
||||
getKitLore(kit)),
|
||||
event -> {
|
||||
if (event.clickType == ClickType.MIDDLE && player.hasPermission("ultimatekits.admin")) {
|
||||
kitsmode = !kitsmode;
|
||||
showPage();
|
||||
} else if (kitsmode) {
|
||||
if (event.clickType == ClickType.RIGHT) {
|
||||
plugin.getKitManager().moveKit(kit, true);
|
||||
} else if (event.clickType == ClickType.LEFT) {
|
||||
plugin.getKitManager().moveKit(kit, false);
|
||||
}
|
||||
loadKits();
|
||||
showPage();
|
||||
} else if (event.clickType == ClickType.LEFT) {
|
||||
kit.display(player, guiManager, this);
|
||||
} else if (event.clickType == ClickType.RIGHT) {
|
||||
kit.buy(event.player, event.manager);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getKitLore(Kit kit) {
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
if (kit.getPrice() != 0)
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.aboutkitprice")
|
||||
.processPlaceholder("price", String.valueOf(kit.getPrice()))
|
||||
.getMessage());
|
||||
else if (kit.getLink() != null)
|
||||
lore.add(plugin.getLocale().getMessage("general.type.link").getMessage());
|
||||
|
||||
if (!kitsmode) {
|
||||
if (!plugin.getLocale().getMessage("interface.selector.aboutkit").getMessage().trim().equals("")) {
|
||||
String[] parts = plugin.getLocale().getMessage("interface.selector.aboutkit").getMessage().split("\\|");
|
||||
lore.add("");
|
||||
for (String line : parts)
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
||||
}
|
||||
if (kit.hasPermission(player)) {
|
||||
if (kit.getNextUse(player) == -1) {
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.once").getMessage());
|
||||
} else if (kit.getNextUse(player) > 0) {
|
||||
if (!plugin.getLocale().getMessage("event.claim.wait").getMessage().trim().equals("")) {
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.wait")
|
||||
.processPlaceholder("time", Methods.makeReadable(kit.getNextUse(player)))
|
||||
.getMessage());
|
||||
}
|
||||
} else if (!plugin.getLocale().getMessage("event.claim.ready").getMessage().trim().equals("")) {
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.ready").getMessage());
|
||||
}
|
||||
} else
|
||||
lore.add(plugin.getLocale().getMessage("event.claim.noaccess").getMessage());
|
||||
lore.add("");
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.leftpreview").getMessage());
|
||||
if (kit.hasPermission(player)) {
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.rightclaim").getMessage());
|
||||
} else if (kit.getPrice() != 0 || kit.getLink() != null) {
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.rightbuy").getMessage());
|
||||
}
|
||||
|
||||
if (player.hasPermission("ultimatekits.admin")) {
|
||||
lore.add("");
|
||||
lore.add(plugin.getLocale().getMessage("interface.selector.adminlore").getMessage());
|
||||
}
|
||||
} else {
|
||||
lore.addAll(Arrays.asList(plugin.getLocale().getMessage("interface.selector.editlore").getMessage().split("\\|")));
|
||||
}
|
||||
return lore;
|
||||
}
|
||||
|
||||
}
|
@ -12,10 +12,13 @@ general.type.free = "Free"
|
||||
interface.selector.kit = "&c%kit%"
|
||||
interface.selector.title = "&8Server kits"
|
||||
interface.selector.details = "&7Hello &e%player%&7!|&7Listed below are our servers kit.||&7Click on the &eicon &7representing the &ekit |&7inorder to &epreview, claim or buy &7it."
|
||||
interface.selector.aboutkitprice = "&7This kit costs &a$%price%&7."
|
||||
interface.selector.aboutkit = "&7Can't open a kit?|&7Rank up to gain access!"
|
||||
interface.selector.leftpreview = "&6&lLEFT CLICK &7to preview kit."
|
||||
interface.selector.rightclaim = "&6&lRIGHT CLICK &7to claim kit."
|
||||
interface.selector.rightbuy = "&6&lRIGHT CLICK &7to buy kit."
|
||||
interface.selector.adminlore = "&6Middle Click &7to edit positioning."
|
||||
interface.selector.editlore = "&6&lEdit Mode||&6Left Click &7to move kit left|&6Right Click &7to move kit right||&6Middle Click &7to go back."
|
||||
interface.hologram.previewonly = "Click to Preview!"
|
||||
interface.hologram.preview = "Right-Click to Preview!"
|
||||
interface.hologram.buylink = "Left-Click for Buy Link!"
|
||||
|
Loading…
Reference in New Issue
Block a user