Restore Mentat and organisation briefing routes
This commit is contained in:
parent
68cf12ab4d
commit
716e6f7006
7 changed files with 48 additions and 2 deletions
|
|
@ -47,6 +47,7 @@ public interface Backend {
|
|||
|
||||
// ---- wallet / travel ----
|
||||
default CompletableFuture<Long> balance(Player p) { return na(); }
|
||||
default CompletableFuture<String> mentat(Player p) { return na(); }
|
||||
default CompletableFuture<ItemStack> savedItem(Player p, UUID id, int revision) { return na(); }
|
||||
default boolean inGuildLobby(Player p) { return false; }
|
||||
default Result returnToGuild(Player p) { return Result.no("Guild return is temporarily unavailable."); }
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ final class ClanMenu extends Menu {
|
|||
spoke(11, Material.LEAD, "<aqua>Allies", "Friendly clans", "allies");
|
||||
spoke(15, Material.DIAMOND_SWORD, "<red>Wars", "Active conflicts", "wars");
|
||||
put(29, Ui.item(Material.IRON_SWORD, "<red>War muster", "<gray>Set your team"), t -> go(new WarMenu(plugin, player, this)));
|
||||
spoke(37, Material.BOOK, "<green>Message of the day", "Read your clan message", "motd");
|
||||
spoke(33, Material.WRITABLE_BOOK, "<green>Invite", "Bring someone in", "invite");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ final class CompanyMenu extends Menu {
|
|||
tool(12, Material.BOOK, "<gold>Transactions", "Recent activity", "transactions");
|
||||
put(19, Ui.item(Material.PLAYER_HEAD, "<aqua>Members", "<gray>Your team"), t -> go(new MembersMenu(plugin, player, this, "company")));
|
||||
tool(20, Material.NAME_TAG, "<aqua>Roles", "Who can do what", "roles");
|
||||
tool(22, Material.BOOK, "<aqua>Message of the day", "Read your company message", "motd");
|
||||
tool(21, Material.WRITABLE_BOOK, "<aqua>Invite", "Bring someone in", "invite");
|
||||
put(28, Ui.item(Material.EMERALD, "<green>Exchange", "<gray>Buy and sell"), t -> go(new ExchangeMenu(plugin, player, this)));
|
||||
put(29, Ui.item(Material.BLAZE_POWDER, "<gold>Spice buyers", "<gray>Sell and collect"), t -> go(new SpiceMenu(plugin, player, this)));
|
||||
|
|
|
|||
|
|
@ -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", "politics", "house", "equipment", "bank", "atm", "withdraw");
|
||||
"spice", "war", "mentat", "politics", "house", "equipment", "bank", "atm", "withdraw");
|
||||
private Backend backend;
|
||||
private final Map<UUID, Menu> openMenus = new HashMap<>();
|
||||
|
||||
|
|
@ -75,6 +75,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 "mentat" -> new MentatMenu(this, p, parent);
|
||||
case "house" -> new HouseMenu(this, p, parent);
|
||||
case "equipment" -> new EquipmentMenu(this, p, parent);
|
||||
case "bank" -> new BankMenu(this, p, parent);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ final class HubMenu extends Menu {
|
|||
door(21, Material.COPPER_BLOCK, "<#5cc8d6><b>Company", "Your business", "company");
|
||||
door(23, Material.LECTERN, "<#b07ce8><b>Politics", "Decisions of your office", "politics");
|
||||
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(33, Material.LIGHTNING_ROD, "<#7fd6e8><b>ATM", "Quick deposit and withdrawal", "atm");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,6 +294,16 @@ final class JarvisBackend implements Backend, Listener {
|
|||
return Long.parseLong(text(data,key));
|
||||
}
|
||||
|
||||
@Override public CompletableFuture<String> mentat(Player player) {
|
||||
UUID owner=player.getUniqueId();
|
||||
return remote(player,()->{
|
||||
var briefing=accepted(jarvis.requestHouse(owner,null,0,null));
|
||||
if(text(briefing,"selection").isBlank())return "";
|
||||
var adviser=briefing.getAsJsonObject("mentat");
|
||||
return adviser==null?"":display(adviser,"name");
|
||||
});
|
||||
}
|
||||
|
||||
@Override public CompletableFuture<ItemStack> savedItem(Player player, UUID id, int revision) {
|
||||
UUID owner=player.getUniqueId();
|
||||
return remote(player,()->accepted(jarvis.requestItemPreview(owner,id,revision)))
|
||||
|
|
@ -798,7 +808,7 @@ final class JarvisBackend implements Backend, Listener {
|
|||
}
|
||||
|
||||
@Override public CompletableFuture<Result> orgAction(Player player, String kind, String action, Org shown) {
|
||||
if (!Set.of("home","claims","wars","war-transport").contains(action))
|
||||
if (!Set.of("home","claims","wars","war-transport","motd").contains(action))
|
||||
return CompletableFuture.failedFuture(new Unavailable());
|
||||
UUID owner = player.getUniqueId();
|
||||
return once(player, () -> remote(player, () -> singleOrganisation(owner,kind)).thenCompose(row -> {
|
||||
|
|
@ -806,6 +816,10 @@ final class JarvisBackend implements Backend, Listener {
|
|||
(action.equals("war-transport") && !shown.warKey().equals(warKey(row)))) {
|
||||
return CompletableFuture.completedFuture(Result.no("Organisation details changed. Reopen this menu."));
|
||||
}
|
||||
if (action.equals("motd")) {
|
||||
String message=text(row,"motd");
|
||||
return CompletableFuture.completedFuture(Result.yes(message.isBlank()?"No organisation message has been set.":message));
|
||||
}
|
||||
if (action.equals("claims")) {
|
||||
return CompletableFuture.completedFuture(Result.yes("Estate capacity: "+
|
||||
(text(row,"claimCapacity").isBlank()?"unavailable":text(row,"claimCapacity")+" chunks")+"."));
|
||||
|
|
|
|||
27
DuneMenus/src/main/java/com/dunerealms/menus/MentatMenu.java
Normal file
27
DuneMenus/src/main/java/com/dunerealms/menus/MentatMenu.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package com.dunerealms.menus;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
final class MentatMenu extends Menu {
|
||||
MentatMenu(DuneMenusPlugin plugin, Player player, Menu parent) { super(plugin, player, parent); }
|
||||
|
||||
String id() { return "mentat"; }
|
||||
Skin skin() { return Skin.HOUSE; }
|
||||
String title() { return "Your Mentat"; }
|
||||
int rows() { return 3; }
|
||||
|
||||
void draw() {
|
||||
backdrop(Material.BLACK_STAINED_GLASS_PANE);
|
||||
back(18);
|
||||
load(backend().mentat(player), name -> {
|
||||
if (name.isBlank()) {
|
||||
put(13, Ui.item(Material.WHITE_BANNER, "<gold>Choose your House"), click -> go(new HouseMenu(plugin, player, this)));
|
||||
return;
|
||||
}
|
||||
put(13, Ui.item(Material.PLAYER_HEAD, "<gold>"+name));
|
||||
put(11, Ui.item(Material.WRITABLE_BOOK, "<gold>Mission journal"), click -> go(new MissionsMenu(plugin, player, this)));
|
||||
put(15, Ui.item(Material.COMPASS, "<gold>Spacing Guild"), click -> go(new TravelMenu(plugin, player, this)));
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff