Release the native Jarvis connector, Exchange and quest/claim GUI without older web changes

This commit is contained in:
unimatrixgit 2026-11-22 21:48:38 +01:00
commit 5ae89e05aa
73 changed files with 4396 additions and 104 deletions

View file

@ -1,6 +1,6 @@
plugins { java }
group = "com.dunerealms"
version = "1.0.2"
version = "1.1.7"
repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://repo.opencollab.dev/main/") }
dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")

View file

@ -0,0 +1,25 @@
# Native item definitions
Install these exact files in `plugins/ExecutableItems/items/` and use `ei reload`.
Existing player-created items, including `Spice.yml`, are not replaced.
- `dr_imperial_codex`: native SCore-built menu item. Its right-click activator
uses `SUDO drgui`, the ordinary player command, without granting OP or permissions.
- `refined_spice`: Rare, enchanted-glow consumable using the existing spice pouch
sprite in a lavender shade. The native eating animation is three seconds and
consumes one item. Successful consumption gives 60 seconds of Night Vision I,
Speed II and Glowing. SCore follows the player UUID with sand particles for
1,200 ticks. No separate timer or scripted effect plugin is needed.
The supplied sound label `sniffer_sniffing_found` is mapped to the actual server
sound `ENTITY_SNIFFER_SNIFFING`; that label itself is not a Paper sound constant.
Native give example: `ei give unimatrix999 refined_spice 1`.
Gameplay consumption is a manual live test; loading the configuration alone does
not prove that a player has consumed an item.
The `spice_refined.png` asset was edited with the built-in image generator from
the actual live pack's `spice_common.png`. Prompt: preserve the pouch silhouette,
tan leather, gold clasp, cords, pixel style and transparency; change only orange
spice granules to pale violet/lavender with blue-violet shadows; no text, extra
objects, border, backdrop or external glow.

View file

@ -0,0 +1,53 @@
name: '&a&lImperial Codex'
material: COMPASS
itemModel: dunerealms:imperial_codex
lore:
- '&8────────────────────────────'
- '&aUNCOMMON &8| &x&A&6&F&F&A&6&oMK I'
- '&8S1 | Imperial Atelier'
- ''
- '&7&oOne register. Every journey.'
- ''
- '&6Service &8› &fDuneRealms'
- '&6Access &8› &fYour current JARVIS keys'
- ''
- '&eRight-click to open your console'
- '&8────────────────────────────'
glow: false
itemRarity:
enableRarity: false
rarity: UNCOMMON
disableStack: false
keepItemOnDeath: true
storeItemInfo: false
canBeUsedOnlyByTheOwner: false
cancelEventIfNoPermission: false
keepDefaultAttributes: false
ignoreKeepDefaultAttributesFeature: true
config_5: true
config_update: false
usageFeatures:
usage: -1
isRefreshableClean: false
usageLimit: -1
hiders:
hideAttributes: true
hideUsage: true
giveFirstJoinFeatures:
giveFirstJoin: false
restrictions:
locked-in-inventory: false
activators:
open_console:
name: Open Imperial Codex
option: PLAYER_RIGHT_CLICK
typeTarget: NO_TYPE_TARGET
usageModification: 0
cancelEvent: true
autoUpdateItem: false
cooldownFeatures:
cooldown: 1
detailedSlots: [-1]
playerCommands:
- SUDO drgui
variables: {}

View file

@ -0,0 +1,64 @@
name: '&6&lImperial Boots'
material: NETHERITE_BOOTS
itemModel: dunerealms:equipment/legendary_mk14_boots
lore:
- '&6LEGENDARY &8· &fMK XIV'
- '&8S1 · Imperial Atelier'
- ''
- '&7&oForged for the long desert.'
- ''
- '&6▌ ENCHANTMENTS'
- '&7Protection &fVI'
- '&7Unbreaking &fIV'
- '&7Mending &fI'
- '&7Thorns &fIV'
- '&7Feather Falling &fVI'
- '&7Depth Strider &fIV'
- '&7Soul Speed &fIV'
glow: true
disableStack: true
keepItemOnDeath: false
storeItemInfo: false
canBeUsedOnlyByTheOwner: false
cancelEventIfNoPermission: false
keepDefaultAttributes: true
ignoreKeepDefaultAttributesFeature: false
config_5: true
config_update: false
usageFeatures:
usage: -1
isRefreshableClean: false
usageLimit: -1
hiders:
hideAttributes: false
hideEnchantments: true
hideUsage: true
giveFirstJoinFeatures:
giveFirstJoin: false
itemRarity:
enableRarity: false
rarity: EPIC
enchantments:
enchantment1:
enchantment: protection
level: 6
enchantment2:
enchantment: unbreaking
level: 4
enchantment3:
enchantment: mending
level: 1
enchantment4:
enchantment: thorns
level: 4
enchantment5:
enchantment: feather_falling
level: 6
enchantment6:
enchantment: depth_strider
level: 4
enchantment7:
enchantment: soul_speed
level: 4
activators: {}
variables: {}

View file

@ -0,0 +1,52 @@
name: '&6&lImperial Chestplate'
material: NETHERITE_CHESTPLATE
itemModel: dunerealms:equipment/legendary_mk14_chestplate
lore:
- '&6LEGENDARY &8· &fMK XIV'
- '&8S1 · Imperial Atelier'
- ''
- '&7&oForged for the long desert.'
- ''
- '&6▌ ENCHANTMENTS'
- '&7Protection &fVI'
- '&7Unbreaking &fIV'
- '&7Mending &fI'
- '&7Thorns &fIV'
glow: true
disableStack: true
keepItemOnDeath: false
storeItemInfo: false
canBeUsedOnlyByTheOwner: false
cancelEventIfNoPermission: false
keepDefaultAttributes: true
ignoreKeepDefaultAttributesFeature: false
config_5: true
config_update: false
usageFeatures:
usage: -1
isRefreshableClean: false
usageLimit: -1
hiders:
hideAttributes: false
hideEnchantments: true
hideUsage: true
giveFirstJoinFeatures:
giveFirstJoin: false
itemRarity:
enableRarity: false
rarity: EPIC
enchantments:
enchantment1:
enchantment: protection
level: 6
enchantment2:
enchantment: unbreaking
level: 4
enchantment3:
enchantment: mending
level: 1
enchantment4:
enchantment: thorns
level: 4
activators: {}
variables: {}

View file

@ -0,0 +1,60 @@
name: '&6&lImperial Helmet'
material: NETHERITE_HELMET
itemModel: dunerealms:equipment/legendary_mk14_helmet
lore:
- '&6LEGENDARY &8· &fMK XIV'
- '&8S1 · Imperial Atelier'
- ''
- '&7&oForged for the long desert.'
- ''
- '&6▌ ENCHANTMENTS'
- '&7Protection &fVI'
- '&7Unbreaking &fIV'
- '&7Mending &fI'
- '&7Thorns &fIV'
- '&7Respiration &fIV'
- '&7Aqua Affinity &fI'
glow: true
disableStack: true
keepItemOnDeath: false
storeItemInfo: false
canBeUsedOnlyByTheOwner: false
cancelEventIfNoPermission: false
keepDefaultAttributes: true
ignoreKeepDefaultAttributesFeature: false
config_5: true
config_update: false
usageFeatures:
usage: -1
isRefreshableClean: false
usageLimit: -1
hiders:
hideAttributes: false
hideEnchantments: true
hideUsage: true
giveFirstJoinFeatures:
giveFirstJoin: false
itemRarity:
enableRarity: false
rarity: EPIC
enchantments:
enchantment1:
enchantment: protection
level: 6
enchantment2:
enchantment: unbreaking
level: 4
enchantment3:
enchantment: mending
level: 1
enchantment4:
enchantment: thorns
level: 4
enchantment5:
enchantment: respiration
level: 4
enchantment6:
enchantment: aqua_affinity
level: 1
activators: {}
variables: {}

View file

@ -0,0 +1,56 @@
name: '&6&lImperial Leggings'
material: NETHERITE_LEGGINGS
itemModel: dunerealms:equipment/legendary_mk14_leggings
lore:
- '&6LEGENDARY &8· &fMK XIV'
- '&8S1 · Imperial Atelier'
- ''
- '&7&oForged for the long desert.'
- ''
- '&6▌ ENCHANTMENTS'
- '&7Protection &fVI'
- '&7Unbreaking &fIV'
- '&7Mending &fI'
- '&7Thorns &fIV'
- '&7Swift Sneak &fIV'
glow: true
disableStack: true
keepItemOnDeath: false
storeItemInfo: false
canBeUsedOnlyByTheOwner: false
cancelEventIfNoPermission: false
keepDefaultAttributes: true
ignoreKeepDefaultAttributesFeature: false
config_5: true
config_update: false
usageFeatures:
usage: -1
isRefreshableClean: false
usageLimit: -1
hiders:
hideAttributes: false
hideEnchantments: true
hideUsage: true
giveFirstJoinFeatures:
giveFirstJoin: false
itemRarity:
enableRarity: false
rarity: EPIC
enchantments:
enchantment1:
enchantment: protection
level: 6
enchantment2:
enchantment: unbreaking
level: 4
enchantment3:
enchantment: mending
level: 1
enchantment4:
enchantment: thorns
level: 4
enchantment5:
enchantment: swift_sneak
level: 4
activators: {}
variables: {}

View file

@ -0,0 +1,16 @@
common 0 #FFFFFF
common 1 #FFFFFF
common 2 #FFFFFF
uncommon 3 #55FF55
uncommon 4 #55FF55
uncommon 5 #55FF55
rare 6 #5555FF
rare 7 #5555FF
rare 8 #5555FF
very_rare 9 #AA00AA
very_rare 10 #AA00AA
very_rare 11 #AA00AA
legendary 12 #FFAA00
legendary 13 #FFAA00
legendary 14 #FFAA00
mythic 14 #FF55FF
1 common 0 #FFFFFF
2 common 1 #FFFFFF
3 common 2 #FFFFFF
4 uncommon 3 #55FF55
5 uncommon 4 #55FF55
6 uncommon 5 #55FF55
7 rare 6 #5555FF
8 rare 7 #5555FF
9 rare 8 #5555FF
10 very_rare 9 #AA00AA
11 very_rare 10 #AA00AA
12 very_rare 11 #AA00AA
13 legendary 12 #FFAA00
14 legendary 13 #FFAA00
15 legendary 14 #FFAA00
16 mythic 14 #FF55FF

View file

@ -0,0 +1,214 @@
{
"policy": "s1-equipment-ladder-v2",
"season": "S1",
"quality": "legendary",
"mark": 14,
"enchantments": {
"helmet": {
"protection": {
"min": 4,
"max": 6
},
"unbreaking": {
"min": 3,
"max": 4
},
"mending": {
"min": 1,
"max": 1
},
"thorns": {
"min": 3,
"max": 4
},
"respiration": {
"min": 3,
"max": 4
},
"aqua_affinity": {
"min": 1,
"max": 1
}
},
"chestplate": {
"protection": {
"min": 4,
"max": 6
},
"unbreaking": {
"min": 3,
"max": 4
},
"mending": {
"min": 1,
"max": 1
},
"thorns": {
"min": 3,
"max": 4
}
},
"leggings": {
"protection": {
"min": 4,
"max": 6
},
"unbreaking": {
"min": 3,
"max": 4
},
"mending": {
"min": 1,
"max": 1
},
"thorns": {
"min": 3,
"max": 4
},
"swift_sneak": {
"min": 3,
"max": 4
}
},
"boots": {
"protection": {
"min": 4,
"max": 6
},
"unbreaking": {
"min": 3,
"max": 4
},
"mending": {
"min": 1,
"max": 1
},
"thorns": {
"min": 3,
"max": 4
},
"feather_falling": {
"min": 4,
"max": 6
},
"depth_strider": {
"min": 3,
"max": 4
},
"soul_speed": {
"min": 3,
"max": 4
}
}
},
"pieces": [
{
"id": "dr_s1_legendary_mk14_helmet",
"slot": "helmet",
"model": "dunerealms:equipment/legendary_mk14_helmet",
"enchantments": {
"protection": 6,
"unbreaking": 4,
"mending": 1,
"thorns": 4,
"respiration": 4,
"aqua_affinity": 1
},
"lore": [
"&6LEGENDARY &8· &fMK XIV",
"&8S1 · Imperial Atelier",
"",
"&7&oForged for the long desert.",
"",
"&6▌ ENCHANTMENTS",
"&7Protection &fVI",
"&7Unbreaking &fIV",
"&7Mending &fI",
"&7Thorns &fIV",
"&7Respiration &fIV",
"&7Aqua Affinity &fI"
],
"yaml": "name: '&6&lImperial Helmet'\nmaterial: NETHERITE_HELMET\nitemModel: dunerealms:equipment/legendary_mk14_helmet\nlore:\n- '&6LEGENDARY &8· &fMK XIV'\n- '&8S1 · Imperial Atelier'\n- ''\n- '&7&oForged for the long desert.'\n- ''\n- '&6▌ ENCHANTMENTS'\n- '&7Protection &fVI'\n- '&7Unbreaking &fIV'\n- '&7Mending &fI'\n- '&7Thorns &fIV'\n- '&7Respiration &fIV'\n- '&7Aqua Affinity &fI'\nglow: true\ndisableStack: true\nkeepItemOnDeath: false\nstoreItemInfo: false\ncanBeUsedOnlyByTheOwner: false\ncancelEventIfNoPermission: false\nkeepDefaultAttributes: true\nignoreKeepDefaultAttributesFeature: false\nconfig_5: true\nconfig_update: false\nusageFeatures:\n usage: -1\n isRefreshableClean: false\n usageLimit: -1\nhiders:\n hideAttributes: false\n hideEnchantments: true\n hideUsage: true\ngiveFirstJoinFeatures:\n giveFirstJoin: false\nitemRarity:\n enableRarity: false\n rarity: EPIC\nenchantments:\n enchantment1:\n enchantment: protection\n level: 6\n enchantment2:\n enchantment: unbreaking\n level: 4\n enchantment3:\n enchantment: mending\n level: 1\n enchantment4:\n enchantment: thorns\n level: 4\n enchantment5:\n enchantment: respiration\n level: 4\n enchantment6:\n enchantment: aqua_affinity\n level: 1\nactivators: {}\nvariables: {}\n"
},
{
"id": "dr_s1_legendary_mk14_chestplate",
"slot": "chestplate",
"model": "dunerealms:equipment/legendary_mk14_chestplate",
"enchantments": {
"protection": 6,
"unbreaking": 4,
"mending": 1,
"thorns": 4
},
"lore": [
"&6LEGENDARY &8· &fMK XIV",
"&8S1 · Imperial Atelier",
"",
"&7&oForged for the long desert.",
"",
"&6▌ ENCHANTMENTS",
"&7Protection &fVI",
"&7Unbreaking &fIV",
"&7Mending &fI",
"&7Thorns &fIV"
],
"yaml": "name: '&6&lImperial Chestplate'\nmaterial: NETHERITE_CHESTPLATE\nitemModel: dunerealms:equipment/legendary_mk14_chestplate\nlore:\n- '&6LEGENDARY &8· &fMK XIV'\n- '&8S1 · Imperial Atelier'\n- ''\n- '&7&oForged for the long desert.'\n- ''\n- '&6▌ ENCHANTMENTS'\n- '&7Protection &fVI'\n- '&7Unbreaking &fIV'\n- '&7Mending &fI'\n- '&7Thorns &fIV'\nglow: true\ndisableStack: true\nkeepItemOnDeath: false\nstoreItemInfo: false\ncanBeUsedOnlyByTheOwner: false\ncancelEventIfNoPermission: false\nkeepDefaultAttributes: true\nignoreKeepDefaultAttributesFeature: false\nconfig_5: true\nconfig_update: false\nusageFeatures:\n usage: -1\n isRefreshableClean: false\n usageLimit: -1\nhiders:\n hideAttributes: false\n hideEnchantments: true\n hideUsage: true\ngiveFirstJoinFeatures:\n giveFirstJoin: false\nitemRarity:\n enableRarity: false\n rarity: EPIC\nenchantments:\n enchantment1:\n enchantment: protection\n level: 6\n enchantment2:\n enchantment: unbreaking\n level: 4\n enchantment3:\n enchantment: mending\n level: 1\n enchantment4:\n enchantment: thorns\n level: 4\nactivators: {}\nvariables: {}\n"
},
{
"id": "dr_s1_legendary_mk14_leggings",
"slot": "leggings",
"model": "dunerealms:equipment/legendary_mk14_leggings",
"enchantments": {
"protection": 6,
"unbreaking": 4,
"mending": 1,
"thorns": 4,
"swift_sneak": 4
},
"lore": [
"&6LEGENDARY &8· &fMK XIV",
"&8S1 · Imperial Atelier",
"",
"&7&oForged for the long desert.",
"",
"&6▌ ENCHANTMENTS",
"&7Protection &fVI",
"&7Unbreaking &fIV",
"&7Mending &fI",
"&7Thorns &fIV",
"&7Swift Sneak &fIV"
],
"yaml": "name: '&6&lImperial Leggings'\nmaterial: NETHERITE_LEGGINGS\nitemModel: dunerealms:equipment/legendary_mk14_leggings\nlore:\n- '&6LEGENDARY &8· &fMK XIV'\n- '&8S1 · Imperial Atelier'\n- ''\n- '&7&oForged for the long desert.'\n- ''\n- '&6▌ ENCHANTMENTS'\n- '&7Protection &fVI'\n- '&7Unbreaking &fIV'\n- '&7Mending &fI'\n- '&7Thorns &fIV'\n- '&7Swift Sneak &fIV'\nglow: true\ndisableStack: true\nkeepItemOnDeath: false\nstoreItemInfo: false\ncanBeUsedOnlyByTheOwner: false\ncancelEventIfNoPermission: false\nkeepDefaultAttributes: true\nignoreKeepDefaultAttributesFeature: false\nconfig_5: true\nconfig_update: false\nusageFeatures:\n usage: -1\n isRefreshableClean: false\n usageLimit: -1\nhiders:\n hideAttributes: false\n hideEnchantments: true\n hideUsage: true\ngiveFirstJoinFeatures:\n giveFirstJoin: false\nitemRarity:\n enableRarity: false\n rarity: EPIC\nenchantments:\n enchantment1:\n enchantment: protection\n level: 6\n enchantment2:\n enchantment: unbreaking\n level: 4\n enchantment3:\n enchantment: mending\n level: 1\n enchantment4:\n enchantment: thorns\n level: 4\n enchantment5:\n enchantment: swift_sneak\n level: 4\nactivators: {}\nvariables: {}\n"
},
{
"id": "dr_s1_legendary_mk14_boots",
"slot": "boots",
"model": "dunerealms:equipment/legendary_mk14_boots",
"enchantments": {
"protection": 6,
"unbreaking": 4,
"mending": 1,
"thorns": 4,
"feather_falling": 6,
"depth_strider": 4,
"soul_speed": 4
},
"lore": [
"&6LEGENDARY &8· &fMK XIV",
"&8S1 · Imperial Atelier",
"",
"&7&oForged for the long desert.",
"",
"&6▌ ENCHANTMENTS",
"&7Protection &fVI",
"&7Unbreaking &fIV",
"&7Mending &fI",
"&7Thorns &fIV",
"&7Feather Falling &fVI",
"&7Depth Strider &fIV",
"&7Soul Speed &fIV"
],
"yaml": "name: '&6&lImperial Boots'\nmaterial: NETHERITE_BOOTS\nitemModel: dunerealms:equipment/legendary_mk14_boots\nlore:\n- '&6LEGENDARY &8· &fMK XIV'\n- '&8S1 · Imperial Atelier'\n- ''\n- '&7&oForged for the long desert.'\n- ''\n- '&6▌ ENCHANTMENTS'\n- '&7Protection &fVI'\n- '&7Unbreaking &fIV'\n- '&7Mending &fI'\n- '&7Thorns &fIV'\n- '&7Feather Falling &fVI'\n- '&7Depth Strider &fIV'\n- '&7Soul Speed &fIV'\nglow: true\ndisableStack: true\nkeepItemOnDeath: false\nstoreItemInfo: false\ncanBeUsedOnlyByTheOwner: false\ncancelEventIfNoPermission: false\nkeepDefaultAttributes: true\nignoreKeepDefaultAttributesFeature: false\nconfig_5: true\nconfig_update: false\nusageFeatures:\n usage: -1\n isRefreshableClean: false\n usageLimit: -1\nhiders:\n hideAttributes: false\n hideEnchantments: true\n hideUsage: true\ngiveFirstJoinFeatures:\n giveFirstJoin: false\nitemRarity:\n enableRarity: false\n rarity: EPIC\nenchantments:\n enchantment1:\n enchantment: protection\n level: 6\n enchantment2:\n enchantment: unbreaking\n level: 4\n enchantment3:\n enchantment: mending\n level: 1\n enchantment4:\n enchantment: thorns\n level: 4\n enchantment5:\n enchantment: feather_falling\n level: 6\n enchantment6:\n enchantment: depth_strider\n level: 4\n enchantment7:\n enchantment: soul_speed\n level: 4\nactivators: {}\nvariables: {}\n"
}
]
}

View file

@ -0,0 +1,72 @@
name: '&9Refined spice'
material: ORANGE_DYE
itemModel: dunerealms:spice_refined
lore:
- '&8────────────────────────────'
- '&9RARE &8| &x&A&A&A&A&F&F&oMK II'
- '&8S1 | CONSUMABLE'
- ''
- '&7&osnif snif snif'
- ''
- '&6Consume &8› &f3 seconds'
- '&6Effects &8› &fNight Vision'
- '&f Speed II · Glowing'
- '&6Duration &8› &f1 minute'
- ''
- '&eHold right-click to consume'
- '&8────────────────────────────'
glow: true
disableEnchantGlide: false
disableStack: false
keepItemOnDeath: false
storeItemInfo: false
canBeUsedOnlyByTheOwner: false
cancelEventIfNoPermission: false
keepDefaultAttributes: false
ignoreKeepDefaultAttributesFeature: true
config_5: true
config_update: false
usageFeatures:
usage: -1
isRefreshableClean: false
usageLimit: -1
hiders:
hideAttributes: true
hideEnchantments: true
hideUsage: true
giveFirstJoinFeatures:
giveFirstJoin: false
itemRarity:
enableRarity: false
rarity: RARE
foodFeatures:
isMeat: false
nutrition: 0
saturation: 0
canAlwaysEat: true
consumableFeatures:
enable: true
animation: EAT
sound: ENTITY_GENERIC_EAT
hasConsumeParticles: true
consumeSeconds: 3
teleportRandomly: 0.0
onConsumeSound: ENTITY_SNIFFER_SNIFFING
clearAllEffects: false
listPotionEffectTypeToRemove: []
activators:
consume_refined_spice:
name: Refined spice effects
option: PLAYER_CONSUME_THE_EI
typeTarget: NO_TYPE_TARGET
usageModification: 0
cancelEvent: false
autoUpdateItem: false
silenceOutput: true
detailedSlots: [-1]
playerCommands:
- minecraft:effect give %player% minecraft:night_vision 60 0 true
- minecraft:effect give %player% minecraft:speed 60 1 true
- minecraft:effect give %player% minecraft:glowing 60 0 true
- score particles shape:atomic target:%player_uuid% blockdata:SAND orbits:2 radius:0.65 rate:6 offsetY:1 time:1200
variables: {}

View file

@ -8,14 +8,17 @@ final class BedrockForms {
record Choice(String label,String description,Runnable action,String imageUrl){Choice(String label,String description,Runnable action){this(label,description,action,null);}}
static boolean isBedrock(Player player){return Bukkit.getPluginManager().isPluginEnabled("floodgate")&&Floodgate.isPlayer(player);}
static void show(JavaPlugin plugin,Player player,String title,String content,List<Choice> choices){Floodgate.show(plugin,player,title,content,choices);}
static void input(JavaPlugin plugin,Player player,String title,String label,String initial,java.util.function.Consumer<String> done){Floodgate.input(plugin,player,title,label,initial,done);}
private static final class Floodgate {
static boolean isPlayer(Player p){return org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgatePlayer(p.getUniqueId());}
static void input(JavaPlugin plugin,Player p,String title,String label,String initial,java.util.function.Consumer<String> done){var world=p.getWorld().getUID();var gate=new GuiSession(p.getUniqueId());Bukkit.getScheduler().runTaskLater(plugin,gate::expire,2400L);var form=org.geysermc.cumulus.form.CustomForm.builder().title(title).input(label,"1.00",initial).closedOrInvalidResultHandler(gate::expire).validResultHandler(result->{String value=result.asInput(0);if(plugin.isEnabled())Bukkit.getScheduler().runTask(plugin,()->{if(p.isOnline()&&world.equals(p.getWorld().getUID())&&gate.claim(p.getUniqueId()))done.accept(value);});});org.geysermc.floodgate.api.FloodgateApi.getInstance().sendForm(p.getUniqueId(),form.build());}
static void show(JavaPlugin plugin,Player p,String title,String content,List<Choice> choices){
var worldId=p.getWorld().getUID();
GuiSession gate=new GuiSession(p.getUniqueId());Bukkit.getScheduler().runTaskLater(plugin,gate::expire,2400L);
var form=org.geysermc.cumulus.form.SimpleForm.builder().title(title).content(content);
for(Choice choice:choices){String url=choice.imageUrl();if(url!=null&&url.matches("https://www\\.dunerealms\\.com/assets/(seals|gui)/[a-z0-9-]+\\.png"))form.button(choice.label(),org.geysermc.cumulus.util.FormImage.Type.URL,url);else form.button(choice.label());}
form.closedOrInvalidResultHandler(gate::expire);
form.validResultHandler(result->{int index=result.clickedButtonId();if(!plugin.isEnabled())return;Bukkit.getScheduler().runTask(plugin,()->{if(p.isOnline()&&p.getWorld().getName().equals("guild_lobby")&&index>=0&&index<choices.size()&&gate.claim(p.getUniqueId()))choices.get(index).action().run();});});
form.validResultHandler(result->{int index=result.clickedButtonId();if(!plugin.isEnabled())return;Bukkit.getScheduler().runTask(plugin,()->{if(p.isOnline()&&p.getWorld().getUID().equals(worldId)&&index>=0&&index<choices.size()&&gate.claim(p.getUniqueId()))choices.get(index).action().run();});});
org.geysermc.floodgate.api.FloodgateApi.getInstance().sendForm(p.getUniqueId(),form.build());
}
}

View file

@ -1,5 +1,11 @@
package com.dunerealms.gui;
final class DepartureWindow {
private DepartureWindow(){}
static long remaining(long epochSeconds){return 900-Math.floorMod(epochSeconds,900);}
static final long CYCLE=1200,BOARDING=300,LAUNCH_END=420;
enum Phase { BOARDING, LAUNCHING, WAITING }
static Phase phase(long now){long at=Math.floorMod(now,CYCLE);return at<BOARDING?Phase.BOARDING:at<LAUNCH_END?Phase.LAUNCHING:Phase.WAITING;}
static boolean open(long now){return phase(now)==Phase.BOARDING;}
static long remaining(long now){long at=Math.floorMod(now,CYCLE);return (at<BOARDING?BOARDING:at<LAUNCH_END?LAUNCH_END:CYCLE)-at;}
static long nextBoarding(long now){return open(now)?now:now+CYCLE-Math.floorMod(now,CYCLE);}
static double progress(long now){return remaining(now)/(phase(now)==Phase.BOARDING?(double)BOARDING:phase(now)==Phase.LAUNCHING?120.0:780.0);}
}

View file

@ -16,7 +16,6 @@ import org.bukkit.event.player.*;
import org.bukkit.inventory.*;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.time.*;
import java.util.*;
import java.util.function.Consumer;
@ -24,6 +23,10 @@ import java.util.function.Consumer;
/** Lobby presentation only. Character authority and committed keys remain central. */
public final class DuneGUI extends JavaPlugin implements Listener,CommandExecutor {
private HouseBridge bridge;
private OrganisationMenus organisations;
private QuestMenus quests;
private ExchangeMenus exchange;
private ItemPreviewMenu itemPreviews;
private final Map<UUID,UUID> requests=new HashMap<>();
private final Map<UUID,JsonObject> records=new HashMap<>();
private BossBar departure;
@ -34,42 +37,75 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
private ExistingGuildService guild;
private final GuildBookings bookings=new GuildBookings();
private final Set<UUID> boarding=new HashSet<>();
private final Set<UUID> guiPackLoaded=new HashSet<>();
private record Pack(UUID id,String url,String hash){}
private static final Pack DEFAULT_PACK=new Pack(UUID.fromString("a7b5ab7d-d8d8-5b51-b016-71a5f4c00008"),"https://www.dunerealms.com/downloads/DuneRealms-GUI-Houses-1.21.8-v8.zip","e4612a6ba0a95d1f031298a0d0a666e7fa2f109f");
private Pack guiPack(){
var file=new java.io.File(getDataFolder(),"gui-pack.yml");if(!file.isFile())return DEFAULT_PACK;
var data=org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(file);
try{String url=data.getString("url",""),hash=data.getString("sha1","");if(!url.matches("https://www\\.dunerealms\\.com/downloads/DuneRealms-GUI-Houses-1\\.21\\.8-v[0-9]+\\.zip")||!hash.matches("[0-9a-f]{40}"))throw new IllegalArgumentException();return new Pack(UUID.fromString(data.getString("id","")),url,hash);}
catch(IllegalArgumentException invalid){getLogger().warning("Invalid gui-pack.yml; using the bundled pack definition.");return DEFAULT_PACK;}
}
private long lastDepartureNotice=-1;
static final int[] CENTRES={10,13,16,29,33};
static final String[] IDS={"atreides","harkonnen","corrino","ordos","fremen"};
private static final Set<String> HOUSE_IDS=Set.of(IDS);
private static final class Screen implements InventoryHolder {
final UUID owner;final GuiSession gate;final Map<Integer,Runnable> actions=new HashMap<>();Inventory inventory;
Screen(Player player){owner=player.getUniqueId();gate=new GuiSession(owner);}
final UUID owner,worldId;final GuiSession gate;final Map<Integer,Runnable> actions=new HashMap<>();Inventory inventory;
Screen(Player player){owner=player.getUniqueId();worldId=player.getWorld().getUID();gate=new GuiSession(owner);}
public Inventory getInventory(){return inventory;}
}
@Override public void onEnable(){
bridge=new HouseBridge(new File(getDataFolder().getParentFile(),"DuneEss/website-bridge.yml"));
bridge=new HouseBridge();
exchange=new ExchangeMenus(this,bridge,p->organisations.console(p),p->guiPackLoaded.contains(p.getUniqueId()));
quests=new QuestMenus(this,bridge,p->organisations.console(p));
itemPreviews=new ItemPreviewMenu(this,bridge,p->guiPackLoaded.contains(p.getUniqueId()));
organisations=new OrganisationMenus(this,bridge,p->fetch(p,null,0,null,data->mentat(p,data)),p->openGuild(p,null),p->fetch(p,null,0,null,data->select(p,data,null)),p->quests.open(p),p->exchange.open(p),p->guiPackLoaded.contains(p.getUniqueId()));
registrar=new NamespacedKey(this,"house_registrar");
sidebar=new PersonalSidebar(this);
for(String command:List.of("house","mentat","drgui","drscoreboard","guildtravel"))Objects.requireNonNull(getCommand(command)).setExecutor(this);
try{guild=new ExistingGuildService((p,world)->openGuild(p,world));getLogger().info("Spacing Guild lobby entry connected to current House keys and quarter-hour boarding.");}catch(ReflectiveOperationException|RuntimeException unavailable){getLogger().warning("Spacing Guild travel consumer unavailable; no journeys can be booked.");}
for(String command:List.of("exchange","house","mentat","drgui","drscoreboard","guildtravel","clan","company","polgui"))Objects.requireNonNull(getCommand(command)).setExecutor(this);
try{guild=new ExistingGuildService((p,world)->openGuild(p,world),p->exchange.open(p),p->quests.open(p),p->organisations.console(p),p->{if(!sidebar.enabled(p))sidebar.toggle(p);refreshSidebar(p);p.sendMessage("Your central bank balance appears in your personal scoreboard.");});getLogger().info("Spacing Guild lobby entry connected to current House keys and twenty-minute boarding windows.");}catch(RuntimeException unavailable){getLogger().warning("Spacing Guild travel consumer unavailable; no journeys can be booked.");}
getServer().getPluginManager().registerEvents(this,this);
departure=Bukkit.createBossBar("Spacing Guild · next Imperial departure",BarColor.YELLOW,BarStyle.SOLID);
Bukkit.getScheduler().runTaskTimer(this,this::tick,20L,20L);
Bukkit.getScheduler().runTaskLater(this,this::ensureRegistrar,40L);
Bukkit.getScheduler().runTaskTimer(this,()->{for(Player p:Bukkit.getOnlinePlayers())if(lobby(p)&&sidebar.enabled(p))refreshSidebar(p);},80L,600L);
Bukkit.getScheduler().runTaskTimer(this,()->{for(Player p:Bukkit.getOnlinePlayers())if(sidebar.enabled(p))refreshSidebar(p);},80L,600L);
getLogger().info("House selector and Mentat screens enabled; central J.A.R.V.I.S. bridge; no Core/Lobby replacement.");
}
@Override public void onDisable(){requests.clear();records.clear();bookings.clear();boarding.clear();if(guild!=null)guild.close();GuiSession.clear();if(sidebar!=null)sidebar.clear();for(var controller:detached.values())try{controller.restore();}catch(ReflectiveOperationException ignored){}detached.clear();if(departure!=null)departure.removeAll();for(Player p:Bukkit.getOnlinePlayers())if(p.getOpenInventory().getTopInventory().getHolder() instanceof Screen)p.closeInventory();}
@Override public void onDisable(){if(exchange!=null)exchange.close();if(itemPreviews!=null)itemPreviews.close();if(quests!=null)quests.close();requests.clear();records.clear();bookings.clear();boarding.clear();if(guild!=null)guild.close();GuiSession.clear();if(sidebar!=null)sidebar.clear();for(var controller:detached.values())try{controller.restore();}catch(ReflectiveOperationException ignored){}detached.clear();if(departure!=null)departure.removeAll();for(Player p:Bukkit.getOnlinePlayers())if(p.getOpenInventory().getTopInventory().getHolder() instanceof Screen)p.closeInventory();}
private boolean lobby(Player p){return p.getWorld().getName().equals("guild_lobby");}
@Override public boolean onCommand(CommandSender sender,Command command,String label,String[] args){
if(!(sender instanceof Player p))return true;if(!lobby(p)){p.sendMessage("This service is available in the Spacing Guild lobby.");return true;}
if(sender instanceof Player player&&(command.getName().equals("exchange")||command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("exchange"))){exchange.open(player);return true;}
if(sender instanceof Player player&&command.getName().equals("drgui")&&args.length>0&&args[0].equalsIgnoreCase("previewitem")){try{if(args.length!=3)throw new IllegalArgumentException();int revision=Integer.parseInt(args[2]);if(revision<1||revision>999999)throw new IllegalArgumentException();itemPreviews.open(player,UUID.fromString(args[1]),revision);}catch(IllegalArgumentException invalid){player.sendMessage("Use /drgui previewitem <saved-design-id> <revision>");}return true;}
if(sender instanceof Player player&&command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("quests")){quests.open(player);return true;}
if(sender instanceof Player player&&command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("lore")){organisations.lore(player);return true;}
if(sender instanceof Player player&&command.getName().equals("drgui")&&args.length==0){organisations.console(player);return true;}
if(sender instanceof Player player&&command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("item")){giveCodex(player,true);return true;}
if(sender instanceof Player member&&List.of("clan","company","polgui").contains(command.getName())){organisations.open(member,command.getName().equals("clan")?"clans":command.getName().equals("company")?"companies":"offices");return true;}
if(!(sender instanceof Player p))return true;
if(command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("organisations")){organisations.open(p,null);return true;}
if(command.getName().equals("drgui")&&args.length==1&&args[0].equalsIgnoreCase("pack")){
p.closeInventory();offerGuiPack(p);
p.sendMessage("Loading the DuneRealms GUI pack. Reopen your menu after loading.");return true;
}
if(command.getName().equals("drscoreboard")||args.length==1&&args[0].equalsIgnoreCase("scoreboard")){toggleSidebar(p);return true;}
if(command.getName().equals("guildtravel")||args.length==1&&args[0].equalsIgnoreCase("travel")){if(args.length==1&&args[0].equalsIgnoreCase("cancel")){cancelBooking(p);return true;}openGuild(p,null);return true;}
fetch(p,null,0,null,data->{if(command.getName().equals("mentat")&&selection(data)!=null)mentat(p,data);else select(p,data,null);});return true;
}
private void openGuild(Player p,String requested){fetch(p,null,0,null,data->{String house=selection(data);if(house==null){p.sendMessage("Choose and confirm your House before Guild passage.");select(p,data,null);return;}if(requested!=null&&!GuildRoutes.allowed(house,requested))p.sendMessage("Other House worlds are unavailable through this Guild passage.");travelMenu(p,data);});}
private void giveCodex(Player p,boolean explain){
NamespacedKey itemId=new NamespacedKey("executableitems","ei-id");
for(ItemStack item:p.getInventory().getContents())if(item!=null&&item.hasItemMeta()&&"dr_imperial_codex".equals(item.getItemMeta().getPersistentDataContainer().get(itemId,PersistentDataType.STRING))){if(explain)p.sendMessage("Your Imperial Codex is already in your inventory.");return;}
if(p.getInventory().firstEmpty()<0){if(explain)p.sendMessage("Make one inventory slot available, then use /drgui item.");return;}
try{var item=bridge.menuItem(p);int slot=p.getInventory().firstEmpty();p.getInventory().addItem(item);try{bridge.addedItem(p,item,slot);}catch(Exception eventFailure){getLogger().warning("ExecutableItems inventory hook unavailable: "+eventFailure.getClass().getSimpleName());}if(explain)p.sendMessage("Imperial Codex received. Right-click to open DuneRealms.");}catch(Exception unavailable){if(explain)p.sendMessage("The Imperial Codex item is temporarily unavailable. /drgui still opens your console.");getLogger().warning("Imperial Codex item could not be built: "+unavailable.getClass().getSimpleName());}
}
private void openGuild(Player p,String requested){if(!lobby(p)){p.sendMessage("Imperial House passage departs from the Spacing Guild lobby.");return;}fetch(p,null,0,null,data->{String house=selection(data);if(house==null){p.sendMessage("Choose and confirm your House before Guild passage.");select(p,data,null);return;}if(requested!=null&&!GuildRoutes.allowed(house,requested))p.sendMessage("Other House worlds are unavailable through this Guild passage.");travelMenu(p,data);});}
private static GuildBookings.Permit permit(JsonObject data){String house=selection(data);if(house==null||!data.has("keyId")||data.get("keyId").isJsonNull())return null;try{return new GuildBookings.Permit(house,UUID.fromString(data.get("keyId").getAsString()),data.get("version").getAsInt());}catch(RuntimeException invalid){return null;}}
private void travelMenu(Player p,JsonObject data){
private void travelMenu(Player p,JsonObject data){var q=new JsonObject();q.addProperty("action","quote");guildRequest(p,q,quote->{data.add("guildQuote",quote);renderTravelMenu(p,data);});}
private void guildRequest(Player p,JsonObject input,Consumer<JsonObject> done){UUID id=p.getUniqueId(),world=p.getWorld().getUID();if(!boarding.add(id)){p.sendMessage("J.A.R.V.I.S. is processing your passage.");return;}Bukkit.getScheduler().runTaskAsynchronously(this,()->{JsonObject result=null;String failure=null;try{result=bridge.guild(id,input);}catch(Exception e){failure=e.getMessage();}var response=result;String message=failure;if(!isEnabled())return;Bukkit.getScheduler().runTask(this,()->{if(!boarding.remove(id)||!p.isOnline()||!p.getWorld().getUID().equals(world))return;if(response==null){p.sendMessage(message==null?"The central Guild service is unavailable.":message);return;}done.accept(response);});});}
private void renderTravelMenu(Player p,JsonObject data){
String house=selection(data);var home=GuildRoutes.home(house);if(home==null){select(p,data,null);return;}
String quote;try{quote=guild==null?"Guild service unavailable":"Guild fare: "+guild.quote(p,home.world())+" DM from your game wallet. Paid at departure.";}catch(RuntimeException unavailable){quote="Guild fare unavailable.";}
var booked=bookings.get(p.getUniqueId());String detail=quote+"\nImperial departures every 15 minutes."+(booked==null?"":"\nYour passage is already booked.");
String quote="Guild fare: "+String.format(java.util.Locale.ROOT,"%.2f",data.getAsJsonObject("guildQuote").get("fareMinor").getAsInt()/100.0)+" DM from your central personal bank account. Collected after arrival.";
var booked=bookings.get(p.getUniqueId());String detail=quote+"\nTravel opens at :00, :20 and :40 for five minutes."+(booked==null?"":"\nYour passage is already booked.");
if(BedrockForms.isBedrock(p)){List<BedrockForms.Choice> choices=new ArrayList<>();for(var route:GuildRoutes.ALL){boolean allowed=route.house().equals(house);choices.add(new BedrockForms.Choice((allowed?"§6":"§8")+route.name()+(allowed?" · Your House":" · Unavailable"),allowed?detail:"Another House world",allowed?()->bookPassage(p,data):()->travelMenu(p,data),"https://www.dunerealms.com/assets/gui/guild-world-"+route.world().replace('_','-')+(allowed?"":"-locked")+"-v1.png"));}choices.add(new BedrockForms.Choice("Cancel booking","No fare has been charged",()->{cancelBooking(p);travelMenu(p,data);}));choices.add(new BedrockForms.Choice("Your Mentat","Return to your House adviser",()->mentat(p,data)));BedrockForms.show(this,p,"Spacing Guild · Imperial passage",detail,choices);return;}
int own=Arrays.asList(IDS).indexOf(house);Screen screen=screen(p,"Spacing Guild · Imperial passage",0xE330+own);
for(int i=0;i<GuildRoutes.ALL.size();i++){var route=GuildRoutes.ALL.get(i);boolean allowed=route.house().equals(house);var item=icon(p,route.name(),allowed?detail:"Unavailable · another House world","drgui_transparent",allowed?Material.ENDER_PEARL:Material.GRAY_DYE);int centre=CENTRES[i];for(int row=i<3?-1:0;row<=1;row++)for(int col=-1;col<=1;col++){int slot=centre+row*9+col;screen.inventory.setItem(slot,item.clone());if(allowed)screen.actions.put(slot,()->bookPassage(p,data));}}
@ -83,29 +119,21 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
if(boarding.contains(p.getUniqueId())){p.sendMessage("Guild boarding is already being confirmed.");return;}
var expected=permit(shown);if(expected==null){p.sendMessage("Confirm your current House key before booking passage.");select(p,shown,selection(shown));return;}
fetch(p,null,0,null,fresh->{var current=permit(fresh);if(current==null||!current.equals(expected)){p.sendMessage("Your House key changed. Review the current passage.");travelMenu(p,fresh);return;}
var home=GuildRoutes.home(current.house());try{if(guild==null)throw new IllegalStateException("Guild travel service unavailable.");int fare=guild.quote(p,home.world());if(!guild.affordable(p,fare))throw new IllegalStateException("Not enough Dunemarks in your game wallet for the Guild fare ("+fare+" DM).");
var booked=bookings.book(p.getUniqueId(),current,home.world(),fare,Instant.now().getEpochSecond());p.closeInventory();p.sendMessage(Component.text("Passage booked to "+home.name()+" for the next Imperial departure. Fare "+booked.fare()+" DM is checked and collected at boarding. No fare has been charged yet.",NamedTextColor.GOLD));
}catch(RuntimeException unavailable){p.sendMessage(Component.text(unavailable.getMessage(),NamedTextColor.RED));}
var q=new JsonObject();q.addProperty("action","quote");guildRequest(p,q,quote->{if(!quote.get("affordable").getAsBoolean()){p.sendMessage("Not enough available Dunemarks in your central personal bank account.");return;}var home=GuildRoutes.home(current.house());int fare=quote.get("fareMinor").getAsInt();if(!home.world().equals(quote.get("destination").getAsString())){p.sendMessage("Your House destination changed. Reopen the menu.");return;}var booked=bookings.book(p.getUniqueId(),current,home.world(),fare,Instant.now().getEpochSecond());p.closeInventory();p.sendMessage(Component.text("Passage booked to "+home.name()+". Fare "+String.format(java.util.Locale.ROOT,"%.2f",booked.fare()/100.0)+" DM is reserved at boarding and collected after arrival.",NamedTextColor.GOLD));});
});
}
private void board(GuildBookings.Booking booking){
Player p=Bukkit.getPlayer(booking.player());if(p==null||!p.isOnline()||!lobby(p)||guild==null||!boarding.add(booking.player()))return;
Bukkit.getScheduler().runTaskAsynchronously(this,()->{JsonObject data=null;boolean online=false;try{data=bridge.request(booking.player(),null,0,null);online=bridge.worldOnline(booking.world());}catch(Exception unavailable){}JsonObject fresh=data;boolean destinationOnline=online;if(!isEnabled())return;
Bukkit.getScheduler().runTask(this,()->{if(!boarding.remove(booking.player()))return;if(!p.isOnline()||!lobby(p))return;
try{var current=fresh==null?null:permit(fresh);if(current==null||!booking.matches(current,guild.quote(p,booking.world()),Instant.now().getEpochSecond())||!destinationOnline||!guild.affordable(p,booking.fare())){p.sendMessage("Guild boarding could not be confirmed: your key, fare, funds or destination changed. No fare was taken; please rebook.");return;}
p.closeInventory();p.sendMessage(Component.text("Imperial boarding · "+GuildRoutes.home(current.house()).name(),NamedTextColor.GOLD));guild.requestDeparture(p,booking.world());
}catch(RuntimeException unavailable){p.sendMessage("The Guild could not request your departure. Reopen the passage menu.");}
});
});
Player p=Bukkit.getPlayer(booking.player());if(p==null||!p.isOnline()||!lobby(p)||!boarding.add(booking.player()))return;
Bukkit.getScheduler().runTaskAsynchronously(this,()->{JsonObject ticket=null;String failure=null;try{var fresh=bridge.request(booking.player(),null,0,null);var current=permit(fresh);if(current==null||!booking.matches(current,booking.fare(),Instant.now().getEpochSecond())||!bridge.worldOnline(booking.world()))throw new IllegalStateException("Your key, boarding window or destination changed. Please rebook.");var q=new JsonObject();q.addProperty("action","board");q.addProperty("requestId",booking.requestId().toString());q.addProperty("keyId",current.keyId().toString());q.addProperty("version",current.version());q.addProperty("fareMinor",booking.fare());ticket=bridge.guild(booking.player(),q);}catch(Exception e){failure=e.getMessage();}var result=ticket;String message=failure;if(!isEnabled())return;Bukkit.getScheduler().runTask(this,()->{if(!boarding.remove(booking.player())||!p.isOnline()||!lobby(p))return;try{if(result==null){p.sendMessage(message==null?"Passage was not confirmed. Any unused reservation expires automatically.":message);return;}p.closeInventory();bridge.dispatchGuild(p,result);}catch(Exception unavailable){p.sendMessage("The transfer was not sent. Your unused fare reservation will expire automatically.");}});});
}
private void fetch(Player p,String house,int version,UUID requestId,Consumer<JsonObject> callback){
UUID owner=p.getUniqueId();if(requests.containsKey(owner)){p.sendMessage("The House register is processing your request.");return;}
UUID operation=UUID.randomUUID();requests.put(owner,operation);p.closeInventory();p.sendMessage(Component.text("Jarvis executing matrix",NamedTextColor.GOLD));
UUID operation=UUID.randomUUID(),worldId=p.getWorld().getUID();requests.put(owner,operation);p.closeInventory();p.sendMessage(Component.text("Jarvis executing matrix",NamedTextColor.GOLD));
Bukkit.getScheduler().runTaskAsynchronously(this,()->{
JsonObject result=null;String error=null;
try{result=bridge.request(owner,house,version,requestId);}catch(Exception unavailable){error=unavailable instanceof java.io.IOException?unavailable.getMessage():"The House register is unavailable. Please retry.";}
JsonObject received=result;String failure=error;if(!isEnabled())return;
Bukkit.getScheduler().runTask(this,()->{if(!operation.equals(requests.get(owner)))return;requests.remove(owner);if(!p.isOnline()||!lobby(p))return;
Bukkit.getScheduler().runTask(this,()->{if(!operation.equals(requests.get(owner)))return;requests.remove(owner);if(!p.isOnline()||!worldId.equals(p.getWorld().getUID()))return;
if(received==null){p.sendMessage(Component.text(failure,NamedTextColor.RED));return;}
records.put(owner,received);updateSidebar(p,received);callback.accept(received);
});
@ -114,16 +142,35 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
private void refreshSidebar(Player p){
UUID owner=p.getUniqueId();if(requests.containsKey(owner))return;UUID operation=UUID.randomUUID();requests.put(owner,operation);
Bukkit.getScheduler().runTaskAsynchronously(this,()->{JsonObject result=null;try{result=bridge.request(owner,null,0,null);}catch(Exception unavailable){}JsonObject received=result;if(!isEnabled())return;
Bukkit.getScheduler().runTask(this,()->{if(!operation.equals(requests.get(owner)))return;requests.remove(owner);if(!p.isOnline()||!lobby(p)||!sidebar.enabled(p))return;
Bukkit.getScheduler().runTask(this,()->{if(!operation.equals(requests.get(owner)))return;requests.remove(owner);if(!p.isOnline()||!sidebar.enabled(p))return;
if(received!=null){records.put(owner,received);updateSidebar(p,received);}else{records.remove(owner);sidebar.update(p,null,null);}
});
});
}
private void updateSidebar(Player p,JsonObject data){String house=selection(data);sidebar.update(p,data,house==null?null:houseName(data,house));}
private void toggleSidebar(Player p){sidebar.toggle(p);p.sendMessage(Component.text(sidebar.enabled(p)?"Personal scoreboard enabled.":"Personal scoreboard hidden.",NamedTextColor.GOLD));if(sidebar.enabled(p)){JsonObject data=records.get(p.getUniqueId());if(data!=null)updateSidebar(p,data);refreshSidebar(p);}}
@EventHandler public void scoreboardCommand(PlayerCommandPreprocessEvent e){String command=e.getMessage().trim();if(command.equalsIgnoreCase("/scoreboard")&&lobby(e.getPlayer())){e.setCancelled(true);toggleSidebar(e.getPlayer());}}
@EventHandler public void join(PlayerJoinEvent e){Bukkit.getScheduler().runTaskLater(this,()->{if(e.getPlayer().isOnline()&&lobby(e.getPlayer())&&sidebar.enabled(e.getPlayer()))refreshSidebar(e.getPlayer());},40L);}
@EventHandler public void world(PlayerChangedWorldEvent e){bookings.cancel(e.getPlayer().getUniqueId());boarding.remove(e.getPlayer().getUniqueId());sidebar.hide(e.getPlayer());records.remove(e.getPlayer().getUniqueId());if(lobby(e.getPlayer())&&sidebar.enabled(e.getPlayer()))refreshSidebar(e.getPlayer());}
@EventHandler public void scoreboardCommand(PlayerCommandPreprocessEvent e){String command=e.getMessage().trim();if(command.equalsIgnoreCase("/scoreboard")){e.setCancelled(true);toggleSidebar(e.getPlayer());}}
@EventHandler(priority=EventPriority.HIGHEST) public void oldNavigator(PlayerInteractEvent e){if(e.getHand()!=EquipmentSlot.HAND||e.getItem()==null||!e.getItem().hasItemMeta()||!e.getAction().isRightClick())return;var data=e.getItem().getItemMeta().getPersistentDataContainer();for(var key:data.getKeys())if(data.has(key,PersistentDataType.STRING)&&"menu_opener".equals(data.get(key,PersistentDataType.STRING))){e.setCancelled(true);organisations.console(e.getPlayer());return;}}
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void legacyTravel(PlayerCommandPreprocessEvent e){String[] args=e.getMessage().substring(1).trim().toLowerCase(Locale.ROOT).split("\\s+");String label=args[0].replaceFirst("^[^:]+:","");if(label.equals("balance")||label.equals("bal")||label.equals("money")){e.setCancelled(true);if(!sidebar.enabled(e.getPlayer()))sidebar.toggle(e.getPlayer());refreshSidebar(e.getPlayer());return;}if(label.equals("exchange")){e.setCancelled(true);exchange.open(e.getPlayer());return;}if(label.equals("server")||label.equals("duneess")&&args.length>1&&args[1].equals("travel")){e.setCancelled(true);openGuild(e.getPlayer(),null);}}
private void offerGuiPack(Player p){
guiPackLoaded.remove(p.getUniqueId());
var pack=guiPack();p.setResourcePack(pack.id(),pack.url(),java.util.HexFormat.of().parseHex(pack.hash()),Component.text("DuneRealms menus and item artwork"),false);
}
@EventHandler public void join(PlayerJoinEvent e){Bukkit.getScheduler().runTaskLater(this,()->{
Player p=e.getPlayer();if(!p.isOnline())return;
// Offer once in the play phase too: configuration-phase pack loading may finish
// before the ordinary Bukkit player status event is available. The hash reuses cache.
if(!BedrockForms.isBedrock(p)&&!guiPackLoaded.contains(p.getUniqueId()))offerGuiPack(p);
giveCodex(p,false);
if(sidebar.enabled(p))refreshSidebar(p);
},40L);}
@EventHandler public void packStatus(PlayerResourcePackStatusEvent e){
if(!guiPack().id().equals(e.getID()))return;
getLogger().info("GUI pack status for "+e.getPlayer().getName()+": "+e.getStatus());
if(e.getStatus()==PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED){guiPackLoaded.add(e.getPlayer().getUniqueId());e.getPlayer().sendMessage(Component.text("DuneRealms artwork loaded. Reopen your menu.",NamedTextColor.GREEN));return;}
guiPackLoaded.remove(e.getPlayer().getUniqueId());
}
@EventHandler public void world(PlayerChangedWorldEvent e){bookings.cancel(e.getPlayer().getUniqueId());boarding.remove(e.getPlayer().getUniqueId());sidebar.hide(e.getPlayer());records.remove(e.getPlayer().getUniqueId());if(sidebar.enabled(e.getPlayer()))refreshSidebar(e.getPlayer());}
static String selection(JsonObject data){if(!data.has("selection")||data.get("selection").isJsonNull())return null;String value=data.get("selection").getAsString();return HOUSE_IDS.contains(value)?value:null;}
private String houseName(JsonObject data,String id){for(var entry:data.getAsJsonArray("choices")){var h=entry.getAsJsonObject();if(h.get("id").getAsString().equals(id))return h.get("name").getAsString();}throw new IllegalArgumentException("Unknown House");}
private void select(Player p,JsonObject data,String picked){
@ -156,10 +203,10 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
private void mentat(Player p,JsonObject data){
String house=selection(data);if(house==null){select(p,data,null);return;}
JsonObject mentor=data.getAsJsonObject("mentat");String name=mentor.get("name").getAsString();int index=Arrays.asList(IDS).indexOf(house);
if(BedrockForms.isBedrock(p)){BedrockForms.show(this,p,"Your Mentat · "+name,houseName(data,house)+"\nYour House briefing is ready.",List.of(new BedrockForms.Choice("Open Mentat Report","Open your website mission journal",()->report(p),"https://www.dunerealms.com/assets/gui/mentat-"+house+"-v1.png"),new BedrockForms.Choice(sidebar.enabled(p)?"Hide scoreboard":"Show scoreboard","Personal briefing display",()->{toggleSidebar(p);mentat(p,data);}),new BedrockForms.Choice("Spacing Guild travel","Book passage to your House world",()->openGuild(p,null))));return;}
if(BedrockForms.isBedrock(p)){BedrockForms.show(this,p,"Your Mentat · "+name,houseName(data,house)+"\nYour House briefing is ready.",List.of(new BedrockForms.Choice("Open Mentat Report","Open your website mission journal",()->quests.open(p),"https://www.dunerealms.com/assets/gui/mentat-"+house+"-v1.png"),new BedrockForms.Choice(sidebar.enabled(p)?"Hide scoreboard":"Show scoreboard","Personal briefing display",()->{toggleSidebar(p);mentat(p,data);}),new BedrockForms.Choice("Spacing Guild travel","Book passage to your House world",()->openGuild(p,null))));return;}
Screen screen=screen(p,"Your Mentat · "+name,0xE310+index);
screen.inventory.setItem(13,icon(p,name,houseName(data,house),"drgui_transparent",Material.PLAYER_HEAD));
button(screen,p,38,"Open Mentat Report","Personal level, Reputation and active quests",Material.WRITABLE_BOOK,()->report(p));
button(screen,p,38,"Open Mentat Report","Personal level, Reputation and active quests",Material.WRITABLE_BOOK,()->quests.open(p));
button(screen,p,42,"Spacing Guild travel","Book passage to your House world",Material.COMPASS,()->openGuild(p,null));
button(screen,p,45,"Your House",houseName(data,house),Material.ARROW,()->select(p,data,house));
button(screen,p,49,sidebar.enabled(p)?"Hide scoreboard":"Show scoreboard","Toggle your personal briefing",Material.LEVER,()->{toggleSidebar(p);mentat(p,data);});for(int slot:new int[]{48,50})screen.actions.put(slot,screen.actions.get(49));
@ -167,27 +214,27 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
p.openInventory(screen.inventory);expire(screen);
}
private void report(Player p){p.closeInventory();p.sendMessage(Component.text("Open your Mentat Report →",NamedTextColor.GOLD).clickEvent(net.kyori.adventure.text.event.ClickEvent.openUrl("https://clans.dunerealms.com/#quests/quests")));}
private Screen screen(Player p,String title,int glyph){Screen s=new Screen(p);Component heading=p.hasResourcePack()?Component.text(GuiArtwork.background(glyph),NamedTextColor.WHITE).font(Key.key("dunerealms:house_selector")):Component.text(title,NamedTextColor.GOLD);s.inventory=Bukkit.createInventory(s,54,heading);return s;}
private ItemStack icon(Player p,String title,String description,String model,Material fallback){ItemStack item=new ItemStack(p.hasResourcePack()?Material.PAPER:fallback);var meta=item.getItemMeta();meta.displayName(Component.text(title,NamedTextColor.GOLD));meta.lore(List.of(Component.text(description,NamedTextColor.GRAY)));if(p.hasResourcePack())meta.setItemModel(new NamespacedKey("dunerealms",model));item.setItemMeta(meta);return item;}
private Screen screen(Player p,String title,int glyph){Screen s=new Screen(p);Component heading=guiPackLoaded.contains(p.getUniqueId())?Component.text(GuiArtwork.background(glyph),NamedTextColor.WHITE).font(Key.key("dunerealms:house_selector")):Component.text(title,NamedTextColor.GOLD);s.inventory=Bukkit.createInventory(s,54,heading);return s;}
private ItemStack icon(Player p,String title,String description,String model,Material fallback){ItemStack item=new ItemStack(guiPackLoaded.contains(p.getUniqueId())?Material.PAPER:fallback);var meta=item.getItemMeta();meta.displayName(Component.text(title,NamedTextColor.GOLD));meta.lore(List.of(Component.text(description,NamedTextColor.GRAY)));if(guiPackLoaded.contains(p.getUniqueId()))meta.setItemModel(new NamespacedKey("dunerealms",model));item.setItemMeta(meta);return item;}
private void button(Screen s,Player p,int slot,String title,String description,Material material,Runnable action){s.inventory.setItem(slot,icon(p,title,description,"drgui_transparent",material));s.actions.put(slot,action);}
private void expire(Screen screen){Bukkit.getScheduler().runTaskLater(this,screen.gate::expire,2400L);}
@EventHandler public void click(InventoryClickEvent event){if(!(event.getView().getTopInventory().getHolder() instanceof Screen s))return;event.setCancelled(true);
if(!(event.getWhoClicked() instanceof Player p)||!p.getUniqueId().equals(s.owner)||event.getClickedInventory()!=s.inventory||event.getClick()!=ClickType.LEFT)return;
Runnable action=s.actions.get(event.getRawSlot());if(action==null||!s.gate.claim(p.getUniqueId()))return;
Bukkit.getScheduler().runTask(this,()->{if(p.isOnline()&&lobby(p)&&p.getOpenInventory().getTopInventory()==s.inventory)action.run();});
Bukkit.getScheduler().runTask(this,()->{if(p.isOnline()&&s.worldId.equals(p.getWorld().getUID())&&p.getOpenInventory().getTopInventory()==s.inventory)action.run();});
}
@EventHandler public void drag(InventoryDragEvent e){if(e.getView().getTopInventory().getHolder() instanceof Screen)e.setCancelled(true);}
@EventHandler public void close(InventoryCloseEvent e){if(e.getInventory().getHolder() instanceof Screen s)s.gate.expire();}
@EventHandler public void quit(PlayerQuitEvent e){bookings.cancel(e.getPlayer().getUniqueId());boarding.remove(e.getPlayer().getUniqueId());requests.remove(e.getPlayer().getUniqueId());records.remove(e.getPlayer().getUniqueId());sidebar.hide(e.getPlayer());departure.removePlayer(e.getPlayer());}
@EventHandler public void quit(PlayerQuitEvent e){guiPackLoaded.remove(e.getPlayer().getUniqueId());bookings.cancel(e.getPlayer().getUniqueId());boarding.remove(e.getPlayer().getUniqueId());requests.remove(e.getPlayer().getUniqueId());records.remove(e.getPlayer().getUniqueId());sidebar.hide(e.getPlayer());departure.removePlayer(e.getPlayer());}
private void ensureRegistrar(){World world=Bukkit.getWorld("guild_lobby");if(world==null)return;Location at=world.getSpawnLocation().clone().add(2,0,0);at.getChunk().load();
for(Entity entity:world.getEntities())if(entity.getPersistentDataContainer().has(registrar,PersistentDataType.BYTE))return;
Villager npc=world.spawn(at,Villager.class);npc.setAI(false);npc.setInvulnerable(true);npc.setPersistent(true);npc.setSilent(true);npc.setCollidable(false);npc.setProfession(Villager.Profession.LIBRARIAN);npc.customName(Component.text("House Registrar · Choose your House",NamedTextColor.GOLD));npc.setCustomNameVisible(true);npc.getPersistentDataContainer().set(registrar,PersistentDataType.BYTE,(byte)1);
}
@EventHandler public void npc(PlayerInteractEntityEvent e){if(!e.getRightClicked().getPersistentDataContainer().has(registrar,PersistentDataType.BYTE))return;e.setCancelled(true);if(e.getHand()!=EquipmentSlot.HAND||!lobby(e.getPlayer()))return;fetch(e.getPlayer(),null,0,null,data->{if(selection(data)!=null)mentat(e.getPlayer(),data);else select(e.getPlayer(),data,null);});}
private void tick(){
long remaining=DepartureWindow.remaining(Instant.now().getEpochSecond());departure.setTitle("Spacing Guild · Imperial departure window in "+String.format(Locale.ROOT,"%02d:%02d",remaining/60,remaining%60));departure.setProgress(remaining/900.0);
long seconds=Instant.now().getEpochSecond(),remaining=DepartureWindow.remaining(seconds);var phase=DepartureWindow.phase(seconds);departure.setTitle("Spacing Guild · "+switch(phase){case BOARDING->"Travel open · closes in ";case LAUNCHING->"Launching · ";case WAITING->"Boarding opens in ";}+String.format(Locale.ROOT,"%02d:%02d",remaining/60,remaining%60));departure.setColor(phase==DepartureWindow.Phase.BOARDING?BarColor.GREEN:BarColor.YELLOW);departure.setProgress(DepartureWindow.progress(seconds));
long now=Instant.now().getEpochSecond();for(var booking:bookings.due(now))board(booking);
if((remaining==300||remaining==60||remaining==10)&&lastDepartureNotice!=now){lastDepartureNotice=now;for(Player p:Bukkit.getOnlinePlayers())if(lobby(p))p.sendMessage(Component.text("Spacing Guild · next Imperial transport in "+(remaining>=60?remaining/60+" minute(s).":remaining+" seconds."),NamedTextColor.GOLD));}
if(((phase==DepartureWindow.Phase.BOARDING&&remaining==300)||(phase==DepartureWindow.Phase.WAITING&&(remaining==300||remaining==60||remaining==10)))&&lastDepartureNotice!=now){lastDepartureNotice=now;for(Player p:Bukkit.getOnlinePlayers())if(lobby(p))p.sendMessage(Component.text(phase==DepartureWindow.Phase.BOARDING?"Spacing Guild · travel is open for five minutes.":"Spacing Guild · boarding opens in "+(remaining>=60?remaining/60+" minute(s).":remaining+" seconds."),NamedTextColor.GOLD));}
for(World world:Bukkit.getWorlds())if(world.getName().equals("guild_lobby")){var battle=world.getEnderDragonBattle();if(battle!=null){if(battle.getBossBar()!=null){battle.getBossBar().setVisible(false);battle.getBossBar().removeAll();}
if(!detached.containsKey(world.getUID()))try{Object handle=world.getClass().getMethod("getHandle").invoke(world);detached.put(world.getUID(),DragonController.detach(handle));getLogger().info("Lobby dragon controller detached; native bossbar disabled.");}catch(ReflectiveOperationException|RuntimeException unsupported){if(dragonWarnings.add(world.getUID()))getLogger().warning("Lobby dragon controller could not be detached; native bossbar fallback active.");}
}}

View file

@ -0,0 +1,5 @@
package com.dunerealms.gui;
final class ExchangeArtwork {
static String background(int screen){if(screen<0||screen>4)throw new IllegalArgumentException("Unknown Exchange screen");var out=new StringBuilder("\uE7FF");for(int row=0;row<4;row++){for(int col=0;col<4;col++)out.append((char)(0xE700+screen*16+row*4+col)).append('\uE7FE');out.append('\uE7FD');}return out.toString();}
private ExchangeArtwork(){}
}

View file

@ -0,0 +1,63 @@
package com.dunerealms.gui;
import com.google.gson.*;
import java.util.*;
import java.util.function.*;
import java.math.BigDecimal;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.event.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.*;
import org.bukkit.inventory.*;
import org.bukkit.plugin.java.JavaPlugin;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
/** Presentation only. Bank payments stay central; physical items use Core's checkpoint. */
final class ExchangeMenus implements Listener,AutoCloseable {
private final JavaPlugin plugin;private final HouseBridge bridge;private final Consumer<Player> back;private final Predicate<Player> artwork;
private final Map<UUID,UUID> pending=new HashMap<>();private final Set<UUID> delivering=new HashSet<>();
private final Map<UUID,Purchase> retries=new HashMap<>();
private record Draft(ItemStack item,int slot,int amount,long price){Draft quantity(int n){return new Draft(item,slot,n,price);}Draft price(long n){return new Draft(item,slot,amount,n);}}
private record Purchase(JsonObject row,int amount,UUID request){Purchase quantity(int n){return new Purchase(row,n,UUID.randomUUID());}}
private static final class Panel implements InventoryHolder {
final UUID owner,world;final GuiSession gate;final Map<Integer,Runnable> actions=new HashMap<>();final List<BedrockForms.Choice> choices=new ArrayList<>();final Inventory inventory;final String title;final boolean artwork;String description="Central bank · J.A.R.V.I.S. Exchange";
Panel(Player p,String title,boolean artwork,int screen){owner=p.getUniqueId();world=p.getWorld().getUID();gate=new GuiSession(owner);this.title=title;this.artwork=artwork;inventory=Bukkit.createInventory(this,54,artwork?Component.text(ExchangeArtwork.background(screen),NamedTextColor.WHITE).font(net.kyori.adventure.key.Key.key("dunerealms:exchange")):Component.text(title,NamedTextColor.GOLD));}
public Inventory getInventory(){return inventory;}
}
private static final class PricePanel implements InventoryHolder {
final UUID owner,world;final GuiSession gate;final Draft draft;final Inventory inventory;
PricePanel(Player p,Draft draft){owner=p.getUniqueId();world=p.getWorld().getUID();gate=new GuiSession(owner);this.draft=draft;inventory=Bukkit.createInventory(this,InventoryType.ANVIL,Component.text("Price per item · DM",NamedTextColor.GOLD));}
public Inventory getInventory(){return inventory;}
}
ExchangeMenus(JavaPlugin plugin,HouseBridge bridge,Consumer<Player> back,Predicate<Player> artwork){this.plugin=plugin;this.bridge=bridge;this.back=back;this.artwork=artwork;Bukkit.getPluginManager().registerEvents(this,plugin);Bukkit.getScheduler().runTaskTimer(plugin,()->{for(Player p:Bukkit.getOnlinePlayers())deliver(p,false);},80L,1200L);}
void open(Player p){deliver(p,false);var retry=retries.get(p.getUniqueId());if(retry!=null){purchase(p,retry);return;}list(p,false,0);}
private static String money(long value){return BigDecimal.valueOf(value,2).toPlainString()+" DM";}
static long price(String text){return ExchangePrice.parse(text);}
private static ItemStack icon(Material material,String title,String... lore){var item=new ItemStack(material);var meta=item.getItemMeta();meta.displayName(Component.text(title,NamedTextColor.GOLD));meta.lore(Arrays.stream(lore).map(s->Component.text(s,NamedTextColor.GRAY)).toList());item.setItemMeta(meta);return item;}
private Panel panel(Player p,String title){int screen=title.endsWith("Your listings")?1:title.endsWith("Add item")?2:title.endsWith("Confirm purchase")?3:title.endsWith("Withdraw listing")?4:0;var s=new Panel(p,title,artwork.test(p)&&!BedrockForms.isBedrock(p),screen);if(!s.artwork){var pane=icon(Material.GREEN_STAINED_GLASS_PANE," ");for(int i=0;i<54;i++)s.inventory.setItem(i,pane);}return s;}
private void button(Panel s,int slot,Material material,String title,String description,Runnable action){s.inventory.setItem(slot,icon(material,title,description));s.actions.put(slot,action);s.choices.add(new BedrockForms.Choice(title,description,action));}
private void show(Player p,Panel s){if(BedrockForms.isBedrock(p)){s.gate.expire();BedrockForms.show(plugin,p,s.title,s.description,s.choices);}else{p.openInventory(s.inventory);Bukkit.getScheduler().runTaskLater(plugin,s.gate::expire,2400L);}}
private void request(Player p,JsonObject input,Consumer<JsonObject> success,Consumer<String> failure){
UUID id=p.getUniqueId(),world=p.getWorld().getUID();if(pending.containsKey(id)){p.sendMessage("J.A.R.V.I.S. is processing your Exchange action.");return;}UUID token=UUID.randomUUID();pending.put(id,token);p.closeInventory();
Bukkit.getScheduler().runTaskAsynchronously(plugin,()->{JsonObject result=null;String error=null;try{result=bridge.exchange(id,input);}catch(Exception e){error=e.getMessage();}var response=result;String message=error;if(!plugin.isEnabled())return;Bukkit.getScheduler().runTask(plugin,()->{if(!token.equals(pending.get(id)))return;pending.remove(id);if(!p.isOnline()||!world.equals(p.getWorld().getUID()))return;if(response==null){failure.accept(message==null?"The Exchange is temporarily unavailable.":message);return;}if(response.has("rejectedStatus")){if(input.get("action").getAsString().equals("buy"))retries.remove(id);failure.accept(response.has("message")?response.get("message").getAsString():"The Exchange rejected this action.");return;}success.accept(response);});});
}
private void request(Player p,JsonObject input,Consumer<JsonObject> done){request(p,input,done,p::sendMessage);}
private JsonObject action(String action){var q=new JsonObject();q.addProperty("action",action);return q;}
private void list(Player p,boolean mine,int page){var q=action("read");q.addProperty("mine",mine);q.addProperty("page",page);request(p,q,data->{var s=panel(p,mine?"Exchange · Your listings":"Exchange · Buy");button(s,1,Material.EMERALD,"Buy","Browse all available items",()->list(p,false,0));button(s,7,Material.CHEST,"Sell","Your listings and add held item",()->list(p,true,0));int index=0;for(var value:data.getAsJsonArray("listings")){var row=value.getAsJsonObject();int slot=10+(index/6)*9+index%6;index++;try{var item=bridge.exchangeIcon(row);var meta=item.getItemMeta();List<Component> lore=new ArrayList<>(meta.hasLore()?meta.lore():List.of());lore.add(Component.text(" "));lore.add(Component.text("Seller: "+row.get("seller").getAsString(),NamedTextColor.GRAY));lore.add(Component.text(row.get("quantity").getAsInt()+" available · "+money(row.get("priceMinor").getAsLong())+" each",NamedTextColor.GOLD));meta.lore(lore);item.setItemMeta(meta);s.inventory.setItem(slot,item);Runnable pick=()->{if(row.get("sellerUuid").getAsString().equals(p.getUniqueId().toString()))withdraw(p,row);else purchase(p,new Purchase(row,1,UUID.randomUUID()));};s.actions.put(slot,pick);s.choices.add(new BedrockForms.Choice(row.get("title").getAsString(),money(row.get("priceMinor").getAsLong())+" · "+row.get("quantity").getAsInt()+" available",pick));}catch(Exception unsupported){s.inventory.setItem(slot,icon(Material.BARRIER,"Unsupported item","This version cannot display the stored item."));}}
if(index==0)s.inventory.setItem(22,icon(Material.PAPER,"No listings",mine?"Hold an item and choose Add held item.":"Check again after players publish goods."));
if(page>0)button(s,45,Material.ARROW,"Previous","Page "+page,()->list(p,mine,page-1));if(data.get("hasNext").getAsBoolean())button(s,53,Material.ARROW,"Next","More listings",()->list(p,mine,page+1));button(s,48,Material.BOOK,"Imperial Codex","Return to your services",()->back.accept(p));button(s,49,Material.HOPPER,"Add held item","List an item from your main hand",()->draft(p));button(s,50,Material.CHEST_MINECART,"Collect purchases","Deliver paid items waiting for inventory space",()->{deliver(p,true);list(p,mine,page);});show(p,s);
});}
private void draft(Player p){var item=p.getInventory().getItemInMainHand();if(item.isEmpty()){p.sendMessage("Hold the item you want to sell first.");return;}sell(p,new Draft(item.clone(),p.getInventory().getHeldItemSlot(),Math.min(64,item.getAmount()),100));}
private void sell(Player p,Draft draft){var s=panel(p,"Exchange · Add item");s.description=draft.item.getType().name()+" · "+draft.amount+" items\n"+money(draft.price)+" per item\nTotal: "+money(draft.price*draft.amount);s.inventory.setItem(13,draft.item.clone());button(s,30,Material.RED_DYE,"− Quantity","Sell "+draft.amount+" items",()->sell(p,draft.quantity(Math.max(1,draft.amount-1))));button(s,31,Material.PAPER,"Quantity: "+draft.amount,"Maximum "+Math.min(64,draft.item.getAmount()),()->sell(p,draft));button(s,32,Material.LIME_DYE,"+ Quantity","Add one item",()->sell(p,draft.quantity(Math.min(Math.min(64,draft.item.getAmount()),draft.amount+1))));button(s,40,Material.GOLD_INGOT,"Price: "+money(draft.price),"Price per item · total "+money(draft.price*draft.amount),()->editPrice(p,draft));button(s,45,Material.ARROW,"Back","Return to your listings",()->list(p,true,0));button(s,49,Material.EMERALD,"Confirm listing","Move "+draft.amount+" items into the Exchange",()->{UUID id=UUID.randomUUID();var q=action("prepare_sale");q.addProperty("requestId",id.toString());q.addProperty("amount",draft.amount);q.addProperty("priceMinor",draft.price);request(p,q,permit->{try{bridge.exchangePublish(p,permit,id,draft.item,draft.slot,draft.amount,draft.price);p.sendMessage("Listing published. Items are held by the Exchange until sold or withdrawn.");list(p,true,0);}catch(Exception e){p.sendMessage(e.getMessage()==null?"The listing was not confirmed.":e.getMessage());}});});show(p,s);}
private void editPrice(Player p,Draft draft){if(BedrockForms.isBedrock(p)){BedrockForms.input(plugin,p,"Listing price","Dunemarks per item",BigDecimal.valueOf(draft.price,2).toPlainString(),text->{try{sell(p,draft.price(price(text.trim())));}catch(IllegalArgumentException e){p.sendMessage(e.getMessage());sell(p,draft);}});return;}var s=new PricePanel(p,draft);s.inventory.setItem(0,icon(Material.PAPER,BigDecimal.valueOf(draft.price,2).toPlainString(),"Rename this paper to the price per item."));p.openInventory(s.inventory);Bukkit.getScheduler().runTaskLater(plugin,s.gate::expire,2400L);}
private void purchase(Player p,Purchase purchase){var row=purchase.row;var s=panel(p,"Exchange · Confirm purchase");s.description=row.get("title").getAsString()+"\nSeller: "+row.get("seller").getAsString()+"\nQuantity: "+purchase.amount+" · Total: "+money(row.get("priceMinor").getAsLong()*purchase.amount);try{s.inventory.setItem(13,bridge.exchangeIcon(row));}catch(Exception bad){p.sendMessage("This item cannot be delivered by your current version.");return;}button(s,30,Material.RED_DYE,"− Quantity","Buy "+purchase.amount,()->purchase(p,retries.containsKey(p.getUniqueId())?purchase:purchase.quantity(Math.max(1,purchase.amount-1))));button(s,31,Material.PAPER,"Quantity: "+purchase.amount,money(row.get("priceMinor").getAsLong())+" per item",()->purchase(p,purchase));button(s,32,Material.LIME_DYE,"+ Quantity","Maximum "+Math.min(64,row.get("quantity").getAsInt()),()->purchase(p,retries.containsKey(p.getUniqueId())?purchase:purchase.quantity(Math.min(Math.min(64,row.get("quantity").getAsInt()),purchase.amount+1))));button(s,45,Material.ARROW,"Back","Return to the Exchange",()->{if(retries.containsKey(p.getUniqueId())){p.sendMessage("Resolve the previous purchase by retrying the same confirmation first.");purchase(p,purchase);}else list(p,false,0);});button(s,49,Material.EMERALD,(retries.containsKey(p.getUniqueId())?"Retry purchase · ":"Buy · ")+money(row.get("priceMinor").getAsLong()*purchase.amount),"Pay from your central personal bank account",()->{retries.put(p.getUniqueId(),purchase);var q=action("buy");q.addProperty("requestId",purchase.request.toString());q.addProperty("listingId",row.get("id").getAsString());q.addProperty("amount",purchase.amount);q.addProperty("priceMinor",row.get("priceMinor").getAsLong());q.addProperty("confirmed",true);request(p,q,receipt->{retries.remove(p.getUniqueId());p.sendMessage("Purchase confirmed: "+money(receipt.get("totalMinor").getAsLong())+". Your items are ready for delivery.");deliver(p,true);list(p,false,0);},error->{p.sendMessage(error+" Retry this confirmation with the same purchase reference.");purchase(p,purchase);});});show(p,s);}
private void withdraw(Player p,JsonObject row){var s=panel(p,"Exchange · Withdraw listing");try{s.inventory.setItem(13,bridge.exchangeIcon(row));}catch(Exception bad){p.sendMessage("This stored item cannot be decoded.");return;}button(s,45,Material.ARROW,"Back","Your listings",()->list(p,true,0));button(s,49,Material.CHEST,"Withdraw "+row.get("quantity").getAsInt()+" items","Return all unsold stock to your inventory",()->{UUID id=UUID.randomUUID();var q=action("prepare_cancel");q.addProperty("requestId",id.toString());request(p,q,permit->{try{int quantity=bridge.exchangeCancel(p,permit,id,Long.parseLong(row.get("id").getAsString()));p.sendMessage("Listing withdrawn. Returned "+quantity+" items.");list(p,true,0);}catch(Exception e){p.sendMessage(e.getMessage()==null?"The listing was not withdrawn.":e.getMessage());}});});show(p,s);}
private void deliver(Player p,boolean explain){if(!p.isOnline()||!delivering.add(p.getUniqueId()))return;UUID id=p.getUniqueId();var q=action("pending");Bukkit.getScheduler().runTaskAsynchronously(plugin,()->{JsonObject response=null;try{response=bridge.exchange(id,q);}catch(Exception ignored){}var data=response;if(!plugin.isEnabled())return;Bukkit.getScheduler().runTask(plugin,()->{delivering.remove(id);if(!p.isOnline())return;if(data==null||!data.has("pending")){if(explain)p.sendMessage("Paid deliveries remain queued. Reopen the Exchange to try again.");return;}if(data.getAsJsonArray("pending").isEmpty()){if(explain)p.sendMessage("No paid items are waiting for delivery.");return;}try{int count=bridge.exchangeDeliver(p);if(explain||count>0)p.sendMessage(count>0?"J.A.R.V.I.S. delivered "+count+" purchased items.":"Make inventory space. Your paid items remain queued.");}catch(Exception unavailable){if(explain)p.sendMessage("Paid items remain queued until your shared inventory is ready.");}});});}
@EventHandler public void join(PlayerJoinEvent e){Bukkit.getScheduler().runTaskLater(plugin,()->deliver(e.getPlayer(),false),60L);}
@EventHandler(priority=EventPriority.HIGHEST) public void anvil(PrepareAnvilEvent e){if(!(e.getInventory().getHolder() instanceof PricePanel))return;((org.bukkit.inventory.view.AnvilView)e.getView()).setRepairCost(0);e.setResult(icon(Material.PAPER,"Confirm price","Use a decimal price such as 1.00"));}
@EventHandler(priority=EventPriority.HIGHEST) public void click(InventoryClickEvent e){var holder=e.getView().getTopInventory().getHolder();if(!(holder instanceof Panel)&&!(holder instanceof PricePanel))return;e.setCancelled(true);if(!(e.getWhoClicked() instanceof Player p)||!Set.of(ClickType.LEFT,ClickType.RIGHT).contains(e.getClick()))return;if(holder instanceof Panel s){if(!s.owner.equals(p.getUniqueId())||!s.world.equals(p.getWorld().getUID())||!s.actions.containsKey(e.getRawSlot())||!s.gate.claim(p.getUniqueId()))return;Runnable selected=s.actions.get(e.getRawSlot());Bukkit.getScheduler().runTask(plugin,selected);}else if(holder instanceof PricePanel s){if(e.getRawSlot()!=2||!s.owner.equals(p.getUniqueId())||!s.world.equals(p.getWorld().getUID())||!s.gate.claim(p.getUniqueId()))return;String text=((org.bukkit.inventory.view.AnvilView)e.getView()).getRenameText();Bukkit.getScheduler().runTask(plugin,()->{try{sell(p,s.draft.price(price(text)));}catch(IllegalArgumentException bad){p.sendMessage(bad.getMessage());sell(p,s.draft);}});}}
@EventHandler(priority=EventPriority.HIGHEST) public void drag(InventoryDragEvent e){if(e.getView().getTopInventory().getHolder() instanceof Panel||e.getView().getTopInventory().getHolder() instanceof PricePanel)e.setCancelled(true);}
@EventHandler public void quit(PlayerQuitEvent e){pending.remove(e.getPlayer().getUniqueId());delivering.remove(e.getPlayer().getUniqueId());}
@Override public void close(){pending.clear();delivering.clear();retries.clear();for(Player p:Bukkit.getOnlinePlayers())if(p.getOpenInventory().getTopInventory().getHolder() instanceof Panel||p.getOpenInventory().getTopInventory().getHolder() instanceof PricePanel)p.closeInventory();}
}

View file

@ -0,0 +1,6 @@
package com.dunerealms.gui;
import java.math.BigDecimal;
final class ExchangePrice {
static long parse(String text){if(text==null||!text.matches("[0-9]{1,7}(?:\\.[0-9]{1,2})?"))throw new IllegalArgumentException("Enter a price such as 1.00 DM.");long n=new BigDecimal(text).movePointRight(2).longValueExact();if(n<1||n>100000000)throw new IllegalArgumentException("Choose a price between 0.01 and 1000000.00 DM.");return n;}
private ExchangePrice(){}
}

View file

@ -2,27 +2,17 @@ package com.dunerealms.gui;
import org.bukkit.Bukkit;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.lang.reflect.Method;
import java.util.function.BiConsumer;
/** Keep the existing fare, permission and proxy-transfer consumer; replace only lobby entry. */
import java.util.*;
import java.util.function.*;
/** Old entry points delegate to current menus, including NPC-dispatched commands. */
final class ExistingGuildService implements AutoCloseable {
private final PluginCommand command;
private final CommandExecutor original,wrapper;
private final Plugin owner;
private final Method fare;
ExistingGuildService(BiConsumer<Player,String> open)throws ReflectiveOperationException {
command=Bukkit.getPluginCommand("duneess:duneess");
if(command==null||!command.getPlugin().getName().equals("DuneEss"))throw new IllegalStateException("DuneEss travel service unavailable");
original=command.getExecutor();owner=command.getPlugin();fare=owner.getClass().getDeclaredMethod("travelFare",Player.class,String.class);fare.setAccessible(true);
wrapper=(sender,cmd,label,args)->{if(sender instanceof Player p&&p.getWorld().getName().equals("guild_lobby")&&args.length>=1&&args[0].equalsIgnoreCase("travel")){open.accept(p,args.length==2?args[1].toLowerCase(java.util.Locale.ROOT):null);return true;}return original.onCommand(sender,cmd,label,args);};
command.setExecutor(wrapper);
private record Route(PluginCommand command,CommandExecutor original,CommandExecutor wrapper){}
private final List<Route> routes=new ArrayList<>();
ExistingGuildService(BiConsumer<Player,String> travel,Consumer<Player> exchange,Consumer<Player> quests,Consumer<Player> console,Consumer<Player> bank){
wrap("duneess:duneess",(p,args)->{if(args.length==0)return false;switch(args[0].toLowerCase(Locale.ROOT)){case "travel"->travel.accept(p,args.length==2?args[1]:null);case "sell","exchange"->exchange.accept(p);case "balance","bal","money"->bank.accept(p);default->{return false;}}return true;});
wrap("duneess:exchange",(p,args)->{exchange.accept(p);return true;});
wrap("dunecore:dune",(p,args)->{String action=args.length==0?"menu":args[0].toLowerCase(Locale.ROOT);switch(action){case "menu","open","gui","choose","faction","house","menuitem","politics","trust"->console.accept(p);case "kit","kits","quests","quest","elytra"->quests.accept(p);case "exchange","sell"->exchange.accept(p);case "travel"->travel.accept(p,args.length==2?args[1]:null);case "balance","bank"->bank.accept(p);default->{return false;}}return true;});
}
int quote(Player p,String world){try{if(!owner.isEnabled())throw new IllegalStateException();return Math.max(0,((Number)fare.invoke(owner,p,world)).intValue());}catch(ReflectiveOperationException error){throw new IllegalStateException("Guild fare is unavailable",error);}}
@SuppressWarnings({"rawtypes","unchecked"}) boolean affordable(Player p,int amount){
if(amount==0)return true;
try{Class api=Class.forName("net.milkbowl.vault.economy.Economy");var registration=Bukkit.getServicesManager().getRegistration(api);if(registration==null)return false;return Boolean.TRUE.equals(api.getMethod("has",org.bukkit.OfflinePlayer.class,double.class).invoke(registration.getProvider(),p,(double)amount));}catch(ReflectiveOperationException error){return false;}
}
void requestDeparture(Player p,String world){if(!owner.isEnabled())throw new IllegalStateException("Guild service unavailable");original.onCommand(p,command,"duneess",new String[]{"travel",world});}
@Override public void close(){if(command.getExecutor()==wrapper)command.setExecutor(original);}
private void wrap(String label,BiPredicate<Player,String[]> action){var command=Bukkit.getPluginCommand(label);if(command==null)return;var original=command.getExecutor();CommandExecutor wrapper=(sender,cmd,used,args)->sender instanceof Player p&&action.test(p,args)||original.onCommand(sender,cmd,used,args);routes.add(new Route(command,original,wrapper));command.setExecutor(wrapper);}
@Override public void close(){for(var route:routes)if(route.command.getExecutor()==route.wrapper)route.command.setExecutor(route.original);routes.clear();}
}

View file

@ -2,8 +2,8 @@ package com.dunerealms.gui;
/** Four by four bounded bitmap glyphs, each <=256px, compose one crisp screen. */
final class GuiArtwork {
static String background(int oldGlyph){
int index=oldGlyph>=0xE330?oldGlyph-0xE330+11:oldGlyph>=0xE310?oldGlyph-0xE310+6:oldGlyph-0xE300;
if(index<0||index>15)throw new IllegalArgumentException("Unknown GUI screen");
int index=oldGlyph>=0xE340?oldGlyph-0xE340+16:oldGlyph>=0xE330?oldGlyph-0xE330+11:oldGlyph>=0xE310?oldGlyph-0xE310+6:oldGlyph-0xE300;
if(index<0||index>19)throw new IllegalArgumentException("Unknown GUI screen");
StringBuilder result=new StringBuilder("\uE32F");
for(int row=0;row<4;row++){for(int column=0;column<4;column++)result.append((char)(0xE400+index*16+row*4+column)).append('\uE32E');result.append('\uE32D');}
return result.toString();

View file

@ -3,14 +3,14 @@ import java.util.*;
/** A transient boarding request, never an entitlement or payment receipt. */
final class GuildBookings {
record Permit(String house,UUID keyId,int version){Permit{if(GuildRoutes.home(house)==null||keyId==null||version<1)throw new IllegalArgumentException("A current House key is required");}}
record Booking(UUID player,Permit permit,String world,int fare,long departureAt){
boolean matches(Permit current,int currentFare,long now){return permit.equals(current)&&fare==currentFare&&GuildRoutes.allowed(current.house(),world)&&now>=departureAt&&now-departureAt<=60;}
record Booking(UUID player,Permit permit,String world,int fare,long departureAt,UUID requestId){
boolean matches(Permit current,int currentFare,long now){return permit.equals(current)&&fare==currentFare&&GuildRoutes.allowed(current.house(),world)&&DepartureWindow.open(now)&&now>=departureAt&&Math.floorDiv(now,DepartureWindow.CYCLE)==Math.floorDiv(departureAt,DepartureWindow.CYCLE);}
}
private final Map<UUID,Booking> bookings=new HashMap<>();
Booking book(UUID player,Permit permit,String world,int fare,long now){
if(!GuildRoutes.allowed(permit.house(),world)||fare<0)throw new IllegalArgumentException("This world is unavailable for your House");
Booking old=bookings.get(player);if(old!=null){if(old.permit().equals(permit)&&old.world().equals(world)&&old.fare()==fare)return old;throw new IllegalStateException("Cancel your existing booking before changing it");}
Booking booking=new Booking(player,permit,world,fare,now+DepartureWindow.remaining(now));bookings.put(player,booking);return booking;
Booking booking=new Booking(player,permit,world,fare,DepartureWindow.nextBoarding(now),UUID.randomUUID());bookings.put(player,booking);return booking;
}
Booking get(UUID player){return bookings.get(player);}
boolean cancel(UUID player){return bookings.remove(player)!=null;}

View file

@ -1,38 +1,45 @@
package com.dunerealms.gui;
import com.google.gson.*;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.*;
import java.net.URI;
import java.net.http.*;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import com.google.gson.JsonObject;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
/** Uses the existing private game bridge credential. Never logs it or returns codes. */
/** Presentation delegates to the one shared translator API; no credentials or HTTP client here. */
final class HouseBridge {
private final HttpClient http=HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)).followRedirects(HttpClient.Redirect.NEVER).build();
private final File config;
HouseBridge(File config){this.config=config;}
boolean worldOnline(String world)throws Exception {
var request=HttpRequest.newBuilder(URI.create("https://cp.dunerealms.com/api/worlds")).timeout(Duration.ofSeconds(8)).GET().build();
var response=http.send(request,HttpResponse.BodyHandlers.ofString());if(response.statusCode()!=200||response.body().length()>16384)return false;
var data=JsonParser.parseString(response.body()).getAsJsonObject();if(!data.has("available")||!data.get("available").getAsBoolean()||!data.has("checkedAt")||data.get("checkedAt").isJsonNull()||Math.abs(System.currentTimeMillis()-data.get("checkedAt").getAsLong())>90000)return false;
for(var row:data.getAsJsonArray("servers")){var server=row.getAsJsonObject();if(world.replace('_','-').equals(server.get("id").getAsString()))return "online".equals(server.get("state").getAsString());}return false;
private final Plugin translator;
private final Method house, world;
HouseBridge() {
translator = Bukkit.getPluginManager().getPlugin("JarvisTranslator");
if (translator == null || !translator.isEnabled()) throw new IllegalStateException("JarvisTranslator is required");
try {
house = translator.getClass().getMethod("requestHouse", UUID.class, String.class, int.class, UUID.class);
world = translator.getClass().getMethod("worldOnline", String.class);
} catch (ReflectiveOperationException missing) { throw new IllegalStateException("Translator API unavailable", missing); }
}
JsonObject request(UUID player,String faction,int version,UUID requestId) throws Exception {
var settings=YamlConfiguration.loadConfiguration(config);
String origin=settings.getString("origin",""),secret=settings.getString("secret","");
if(!origin.equals("https://cp.dunerealms.com")||secret.length()<32)throw new IOException("House bridge unavailable");
JsonObject data=new JsonObject();data.addProperty("action",faction==null?"read":"choose");data.addProperty("uuid",player.toString());
if(faction!=null){data.addProperty("faction",faction);data.addProperty("version",version);data.addProperty("confirmed",true);data.addProperty("requestId",requestId.toString());}
var req=HttpRequest.newBuilder(URI.create(origin+"/internal/game/house")).timeout(Duration.ofSeconds(10)).header("Authorization","Bearer "+secret).header("Content-Type","application/json").POST(HttpRequest.BodyPublishers.ofString(data.toString())).build();
var response=http.send(req,HttpResponse.BodyHandlers.ofInputStream());
byte[] body;try(var in=response.body()){body=in.readNBytes(32769);}
if(body.length>32768)throw new IOException("House response too large");
JsonObject result=JsonParser.parseString(new String(body,StandardCharsets.UTF_8)).getAsJsonObject();
if(response.statusCode()!=200)throw new IOException(response.statusCode()==403?"Link your personal Minecraft account at cp.dunerealms.com first.":response.statusCode()==409?"Your House record changed. Reopen the menu.":"The House register is temporarily unavailable. Please retry.");
if(!result.has("ok")||!result.get("ok").getAsBoolean()||!result.has("choices")||result.getAsJsonArray("choices").size()!=5)throw new IOException("Invalid House response");
return result;
private Object call(Method method, Object... args) throws Exception {
if (!translator.isEnabled()) throw new IllegalStateException("Translator unavailable");
try { return method.invoke(translator, args); }
catch (InvocationTargetException wrapped) { if (wrapped.getCause() instanceof Exception cause) throw cause; throw new IllegalStateException("Translator request failed"); }
}
JsonObject request(UUID player, String faction, int version, UUID requestId) throws Exception { return (JsonObject) call(house, player, faction, version, requestId); }
JsonObject quests(UUID player,JsonObject input)throws Exception{return (JsonObject)call(translator.getClass().getMethod("requestQuests",UUID.class,JsonObject.class),player,input);}
void citizenIntroduction(org.bukkit.entity.Player player)throws Exception{call(translator.getClass().getMethod("citizenIntroduction",org.bukkit.entity.Player.class),player);}
JsonObject itemPreview(UUID player,UUID id,int revision)throws Exception{return (JsonObject)call(translator.getClass().getMethod("requestItemPreview",UUID.class,UUID.class,int.class),player,id,revision);}
org.bukkit.inventory.ItemStack buildItemPreview(org.bukkit.entity.Player player,JsonObject data,boolean panels)throws Exception{return (org.bukkit.inventory.ItemStack)call(translator.getClass().getMethod("buildItemPreview",org.bukkit.entity.Player.class,JsonObject.class,boolean.class),player,data,panels);}
JsonObject exchange(UUID player,JsonObject input)throws Exception{return (JsonObject)call(translator.getClass().getMethod("requestExchange",UUID.class,JsonObject.class),player,input);}
org.bukkit.inventory.ItemStack exchangeIcon(JsonObject row)throws Exception{return (org.bukkit.inventory.ItemStack)call(translator.getClass().getMethod("exchangeIcon",JsonObject.class),row);}
long exchangePublish(org.bukkit.entity.Player p,JsonObject permit,UUID request,org.bukkit.inventory.ItemStack expected,int slot,int amount,long price)throws Exception{return ((Number)call(translator.getClass().getMethod("exchangePublish",org.bukkit.entity.Player.class,JsonObject.class,UUID.class,org.bukkit.inventory.ItemStack.class,int.class,int.class,long.class),p,permit,request,expected,slot,amount,price)).longValue();}
int exchangeCancel(org.bukkit.entity.Player p,JsonObject permit,UUID request,long id)throws Exception{return ((Number)call(translator.getClass().getMethod("exchangeCancel",org.bukkit.entity.Player.class,JsonObject.class,UUID.class,long.class),p,permit,request,id)).intValue();}
int exchangeDeliver(org.bukkit.entity.Player p)throws Exception{return ((Number)call(translator.getClass().getMethod("exchangeDeliver",org.bukkit.entity.Player.class),p)).intValue();}
JsonObject guild(UUID player,JsonObject input)throws Exception{return (JsonObject)call(translator.getClass().getMethod("requestGuild",UUID.class,JsonObject.class),player,input);}
void dispatchGuild(org.bukkit.entity.Player player,JsonObject ticket)throws Exception{call(translator.getClass().getMethod("dispatchGuild",org.bukkit.entity.Player.class,JsonObject.class),player,ticket);}
boolean worldOnline(String name) throws Exception { return Boolean.TRUE.equals(call(world, name)); }
JsonObject organisations(UUID player)throws Exception{return (JsonObject)call(translator.getClass().getMethod("requestOrganisations",UUID.class),player);}
org.bukkit.inventory.ItemStack menuItem(org.bukkit.entity.Player player)throws Exception{return (org.bukkit.inventory.ItemStack)call(translator.getClass().getMethod("menuItem",org.bukkit.entity.Player.class),player);}
void addedItem(org.bukkit.entity.Player player,org.bukkit.inventory.ItemStack item,int slot)throws Exception{call(translator.getClass().getMethod("announceItemInventory",org.bukkit.entity.Player.class,org.bukkit.inventory.ItemStack.class,int.class),player,item,slot);}
@SuppressWarnings("unchecked") org.bukkit.inventory.ItemStack lorePreview(String kind,org.bukkit.Material material,String title,java.util.Map<String,String> facts)throws Exception{return (org.bukkit.inventory.ItemStack)call(translator.getClass().getMethod("formatItemLore",org.bukkit.inventory.ItemStack.class,String.class,String.class,String.class,java.util.Map.class,String.class,String.class),new org.bukkit.inventory.ItemStack(material),kind,title,"Design preview. Not a redeemable instrument.",facts,"Issued values come from its JARVIS key.",null);}
@SuppressWarnings("unchecked") java.util.concurrent.CompletableFuture<JsonObject> action(org.bukkit.entity.Player player,JsonObject input)throws Exception{return (java.util.concurrent.CompletableFuture<JsonObject>)call(translator.getClass().getMethod("organisationAction",org.bukkit.entity.Player.class,JsonObject.class),player,input);}
}

Some files were not shown because too many files have changed in this diff Show more