forked from unimatrix/web
Port the read-only item lore archive to DuneMenus
This commit is contained in:
parent
e3da524e50
commit
5bd51d8c80
5 changed files with 43 additions and 1 deletions
|
|
@ -47,6 +47,7 @@ public interface Backend {
|
|||
|
||||
// ---- wallet / travel ----
|
||||
default CompletableFuture<Long> balance(Player p) { return na(); }
|
||||
default List<ItemStack> loreArchive() { return List.of(); }
|
||||
default Result claimCodex(Player p) { return Result.no("The Imperial Codex is temporarily unavailable."); }
|
||||
default CompletableFuture<String> mentat(Player p) { return na(); }
|
||||
default CompletableFuture<ItemStack> savedItem(Player p, UUID id, int revision) { return na(); }
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||
|
||||
public final class DuneMenusPlugin extends JavaPlugin implements TabExecutor {
|
||||
static final List<String> IDS = List.of("hub", "travel", "exchange", "clan", "company", "missions",
|
||||
"spice", "war", "mentat", "politics", "house", "equipment", "bank", "atm", "withdraw");
|
||||
"spice", "war", "mentat", "lore", "politics", "house", "equipment", "bank", "atm", "withdraw");
|
||||
private static final String PACK_CONTROL = "dunerealms:pack_control";
|
||||
private Backend backend;
|
||||
private final Map<Player, String> loadedPacks = new HashMap<>();
|
||||
|
|
@ -100,6 +100,7 @@ public final class DuneMenusPlugin extends JavaPlugin implements TabExecutor {
|
|||
case "spice" -> new SpiceMenu(this, p, parent);
|
||||
case "war" -> new WarMenu(this, p, parent);
|
||||
case "politics" -> new PoliticsMenu(this, p, parent);
|
||||
case "lore" -> new LoreArchiveMenu(this, p, parent);
|
||||
case "mentat" -> new MentatMenu(this, p, parent);
|
||||
case "house" -> new HouseMenu(this, p, parent);
|
||||
case "equipment" -> new EquipmentMenu(this, p, parent);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ final class HubMenu extends Menu {
|
|||
door(25, Material.BLAZE_POWDER, "<#e07b2e><b>Spice", "Sell and collect", "spice");
|
||||
door(28, Material.PLAYER_HEAD, "<#eed49a><b>Your Mentat", "House briefing and missions", "mentat");
|
||||
door(29, Material.GOLD_BLOCK, "<#f2c94c><b>Imperial Postbank", "Your account", "bank");
|
||||
door(31, Material.BOOK, "<#eed49a><b>Item lore archive", "Preview issued item cards", "lore");
|
||||
door(33, Material.LIGHTNING_ROD, "<#7fd6e8><b>ATM", "Quick deposit and withdrawal", "atm");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,6 +294,24 @@ final class JarvisBackend implements Backend, Listener {
|
|||
return Long.parseLong(text(data,key));
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> loreArchive() {
|
||||
return List.of(
|
||||
loreSample("MENU", Material.COMPASS, "Imperial Codex", Map.of("Service","DuneRealms")),
|
||||
loreSample("EQUIPMENT", Material.IRON_SWORD, "Equipment", Map.of("Grade","From the issued equipment key")),
|
||||
loreSample("KIT", Material.CHEST, "Equipment seal", Map.of("Contents","From the registered kit")),
|
||||
loreSample("COMPONENT", Material.AMETHYST_SHARD, "Crafting component", Map.of("Recipe","From the crafting definition")),
|
||||
loreSample("TICKET", Material.PAPER, "Guild passage", Map.of("Route","From the issued passage")),
|
||||
loreSample("CASH", Material.GOLD_NUGGET, "Dunemark", Map.of("Value","From the verified cash denomination")),
|
||||
loreSample("RIHLA", Material.WRITABLE_BOOK, "Rihla transfer", Map.of("Amount","From the private transfer record")),
|
||||
loreSample("DEED", Material.MAP, "Registered deed", Map.of("Holder","From current deed authority")),
|
||||
loreSample("QUEST", Material.BOOK, "Mission instrument", Map.of("Progress","From verified events"))
|
||||
);
|
||||
}
|
||||
|
||||
private ItemStack loreSample(String kind, Material material, String name, Map<String,String> facts) {
|
||||
return jarvis.formatItemLore(new ItemStack(material),kind,name,"Design preview. Not a redeemable instrument.",facts,null,null);
|
||||
}
|
||||
|
||||
@Override public Result claimCodex(Player player) {
|
||||
var inventory=player.getInventory();
|
||||
for(var item:inventory.getContents()){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.dunerealms.menus;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
final class LoreArchiveMenu extends Menu {
|
||||
LoreArchiveMenu(DuneMenusPlugin plugin, Player player, Menu parent) { super(plugin, player, parent); }
|
||||
|
||||
String id() { return "lore"; }
|
||||
Skin skin() { return Skin.GOLD; }
|
||||
String title() { return "Item lore archive"; }
|
||||
int rows() { return 3; }
|
||||
|
||||
void draw() {
|
||||
backdrop(Material.BLACK_STAINED_GLASS_PANE);
|
||||
back(22);
|
||||
var samples = backend().loreArchive();
|
||||
if (samples.isEmpty()) put(13, Ui.item(Material.BARRIER, "<red>Item previews are temporarily unavailable"));
|
||||
for (int i = 0; i < samples.size() && i < 9; i++) put(9 + i, samples.get(i));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff