ui: display banner instructions in UI
This commit is contained in:
parent
244bb32d70
commit
6d8b291b2f
@ -92,13 +92,19 @@ public class PlayerInventoryTeleporter implements Listener {
|
||||
if (event.getClickedInventory() == neighborInv) {
|
||||
ItemMeta meta = event.getCurrentItem().getItemMeta();
|
||||
Material mat = event.getCurrentItem().getType();
|
||||
if (mat == Material.BEDROCK || mat == Material.COMPASS || mat == Material.LANTERN) {
|
||||
final String selectedName = meta.getDisplayName();
|
||||
if (mat == Material.BEDROCK || mat == Material.COMPASS || mat == Material.LANTERN || mat == Material.SOUL_LANTERN) {
|
||||
return;
|
||||
}
|
||||
m_plugin.getServer().getScheduler().runTask(m_plugin, () -> event.getView().close());
|
||||
|
||||
Region nearest = m_manager.nearestRegion(player.getLocation());
|
||||
|
||||
final String selectedName = meta.getDisplayName();
|
||||
if (selectedName == nearest.name()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_plugin.getServer().getScheduler().runTask(m_plugin, () -> event.getView().close());
|
||||
|
||||
final Optional<Region> destination = m_plugin.regionManager().regionsForWorld(player.getLocation().getWorld())
|
||||
.stream()
|
||||
.filter((r) -> r.name().equals(selectedName))
|
||||
@ -213,7 +219,7 @@ public class PlayerInventoryTeleporter implements Listener {
|
||||
}
|
||||
ItemStack chargesItem = new ItemStack(event.region.charges() == 0 ? Material.SOUL_LANTERN : Material.LANTERN);
|
||||
ItemMeta meta = chargesItem.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.BOLD + "Region Post Configuration");
|
||||
meta.setDisplayName(ChatColor.BOLD + "Region Post Charges");
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.WHITE + "Name: "+event.region.coloredName());
|
||||
lore.add(ChatColor.WHITE + "Visits: " + ChatColor.YELLOW + event.region.visits());
|
||||
@ -223,7 +229,18 @@ public class PlayerInventoryTeleporter implements Listener {
|
||||
meta.addEnchant(Enchantment.SOUL_SPEED, 1, true);
|
||||
chargesItem.setItemMeta(meta);
|
||||
// 22 Is the middle of the bottom row
|
||||
neighborInventory.setItem(22, chargesItem);
|
||||
neighborInventory.setItem(23, chargesItem);
|
||||
|
||||
ItemStack iconItem = event.region.icon();
|
||||
meta = iconItem.getItemMeta();
|
||||
meta.setDisplayName(event.region.name());
|
||||
lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.BOLD + "This is the region's current banner icon.");
|
||||
lore.add(ChatColor.ITALIC + "Right-click the region post with a banner to change it");
|
||||
meta.setLore(lore);
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
iconItem.setItemMeta(meta);
|
||||
neighborInventory.setItem(21, iconItem);
|
||||
|
||||
event.player.openInventory(neighborInventory);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user