Keep deployed GUI bytes out of the DuneChat change
This commit is contained in:
parent
a5813cc270
commit
19200b07ad
2 changed files with 12 additions and 37 deletions
|
|
@ -1,36 +1,17 @@
|
||||||
# DuneChat
|
# DuneChat
|
||||||
|
|
||||||
Chat prefixes and private channels. Built on canonical main `5d727d7`. Not pushed. Not tested in game.
|
DuneChat formats public Minecraft chat and provides local private channels.
|
||||||
|
|
||||||
## What players see
|
| Command | Action |
|
||||||
Public chat: `[STAFF]/[VIP] [Race] [CLAN TAG] [Company] Name: message`. Order is `prefix-order` in config.yml. Race colour follows the house colour used by the nameplates.
|
|
||||||
|
|
||||||
| Command | Does |
|
|
||||||
|---|---|
|
|---|---|
|
||||||
| `/cc <msg>` (`/clanchat`) | one message to your clan. `/cc` alone toggles clan chat mode |
|
| /cc [message] | Toggle clan chat or send one message |
|
||||||
| `/coc <msg>` (`/companychat`) | same for your company |
|
| /coc [message] | Toggle company chat or send one message |
|
||||||
| `/sc <msg>` (`/staffchat`) | staff only, permission `dunechat.staff` |
|
| /sc [message] | Toggle staff chat or send one message |
|
||||||
| `/g` (`/gc`) | back to public chat |
|
| /g | Return to public chat |
|
||||||
| `/chatspy` | staff with `dunechat.spy` also see clan and company chat |
|
| /chatspy | Toggle clan and company visibility with the explicit spy permission |
|
||||||
|
|
||||||
You can be in one clan and one company at the same time; each has its own private channel. Private chat is logged to the console (`log-private-chat`).
|
Public prefixes use the existing JARVIS House briefing. Private clan and company delivery requires matching organisation UUIDs and current, explicit membership in the authenticated organisation roster. Public display labels grant no chat access. Staff commands require dunechat.staff. Chat spy requires dunechat.spy.
|
||||||
|
|
||||||
## Where the data comes from
|
The plugin uses Paper's chat pipeline so menu prompts and existing chat cancellation handlers retain precedence. DiscordSRV keeps its public route. The privacy hook suppresses private messages before Discord forwarding. Deploy with DiscordSRV configured to use modern Paper events and respect event cancellation, including menu prompt input. Private console logging defaults off.
|
||||||
The same central briefing the nameplates use (`briefing.identity`: staff, vip, clans, companies), pushed in by a 5-line hook in DuneRealmsGUI (`DuneGUI.pushChatIdentity`, reflection, no hard dependency). Group membership keys on the central id when the briefing carries one, otherwise on the name, so please confirm the briefing includes ids.
|
|
||||||
|
|
||||||
## Safety
|
Build with gradle -p DuneChat test jar. The release artifact contains DuneChat.jar. Existing GUI and JARVIS archives are retained.
|
||||||
- Names and tags are stripped of `& § % < >` and control characters before they reach a prefix; the message itself is never colour-parsed.
|
|
||||||
- Never un-cancels chat: a mute or filter from another plugin still wins.
|
|
||||||
- Leaving a clan or company while in its channel drops you back to public chat.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
1. Build: `gradle -p DuneChat build` -> `build/libs/DuneChat.jar`.
|
|
||||||
2. Apply the DuneRealmsGUI change (DuneGUI.java, plugin.yml softdepend), rebuild DuneRealmsGUI.
|
|
||||||
3. Grant `dunechat.staff` / `dunechat.spy` through LuckPerms.
|
|
||||||
|
|
||||||
## Verified / not verified
|
|
||||||
CI: DuneChat compiles; 7 unit tests (parsing, prefix order, injection, group isolation, staff rules). The DuneRealmsGUI edit was not compiled in CI (that module needs another module missing from the cut-down CI tree; the errors seen were unrelated). Not tested: real chat events, other chat plugins (LuckPerms prefixes, DuneEss, DuneMenus chat prompts), Bedrock clients.
|
|
||||||
|
|
||||||
## Limits
|
|
||||||
- Per server only: planets are separate servers, so clan/company/staff chat does not cross servers. A proxy relay would be a separate piece.
|
|
||||||
- No mute, filter, cooldown or channel history.
|
|
||||||
|
|
|
||||||
|
|
@ -212,19 +212,13 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
||||||
}
|
}
|
||||||
private void refreshSidebar(Player p){
|
private void refreshSidebar(Player p){
|
||||||
UUID owner=p.getUniqueId();if(requests.containsKey(owner))return;UUID operation=UUID.randomUUID();requests.put(owner,operation);
|
UUID owner=p.getUniqueId();if(requests.containsKey(owner))return;UUID operation=UUID.randomUUID();requests.put(owner,operation);
|
||||||
boolean chatEnabled=Bukkit.getPluginManager().isPluginEnabled("DuneChat");
|
|
||||||
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().runTaskAsynchronously(this,()->{JsonObject result=null;try{result=bridge.request(owner,null,0,null);}catch(Exception unavailable){}JsonObject received=result;if(!isEnabled())return;
|
||||||
JsonObject memberships=null;if(chatEnabled)try{memberships=bridge.organisations(owner);}catch(Exception unavailable){}
|
|
||||||
JsonObject chatMemberships=memberships;
|
|
||||||
Bukkit.getScheduler().runTask(this,()->{if(!operation.equals(requests.get(owner)))return;requests.remove(owner);if(!p.isOnline())return;
|
Bukkit.getScheduler().runTask(this,()->{if(!operation.equals(requests.get(owner)))return;requests.remove(owner);if(!p.isOnline())return;
|
||||||
if(chatEnabled)pushChatMemberships(owner,chatMemberships);
|
if(received!=null){records.put(owner,received);updateSidebar(p,received);}else{records.remove(owner);sidebar.update(p,null,null);nameplates.update(p,null,null,null);}
|
||||||
if(received!=null){records.put(owner,received);updateSidebar(p,received);}else{records.remove(owner);sidebar.update(p,null,null);nameplates.update(p,null,null,null);pushChatIdentity(p,null,null,null);}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void updateSidebar(Player p,JsonObject data){String house=selection(data),label=house==null?null:houseName(data,house);sidebar.update(p,data,label);nameplates.update(p,data,house,label);pushChatIdentity(p,data,house,label);}
|
private void updateSidebar(Player p,JsonObject data){String house=selection(data),label=house==null?null:houseName(data,house);sidebar.update(p,data,label);nameplates.update(p,data,house,label);}
|
||||||
private void pushChatIdentity(Player p,JsonObject data,String house,String race){var chat=Bukkit.getPluginManager().getPlugin("DuneChat");if(chat==null||!chat.isEnabled())return;try{chat.getClass().getMethod("identity",UUID.class,String.class,String.class,String.class).invoke(chat,p.getUniqueId(),data==null?null:data.toString(),house,race);}catch(ReflectiveOperationException|RuntimeException unavailable){}}
|
|
||||||
private void pushChatMemberships(UUID uuid,JsonObject data){var chat=Bukkit.getPluginManager().getPlugin("DuneChat");if(chat==null||!chat.isEnabled())return;try{chat.getClass().getMethod("memberships",UUID.class,String.class).invoke(chat,uuid,data==null?null:data.toString());}catch(ReflectiveOperationException|RuntimeException unavailable){}}
|
|
||||||
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);}}
|
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(priority=EventPriority.HIGHEST,ignoreCancelled=false) public void organisationContact(org.bukkit.event.player.PlayerInteractEntityEvent event){String marker=event.getRightClicked().getPersistentDataContainer().get(new NamespacedKey("dunerealms","organisation_home_npc"),PersistentDataType.STRING);if(marker==null)return;event.setCancelled(true);if(event.getHand()!=org.bukkit.inventory.EquipmentSlot.HAND)return;String[] parts=marker.split(":",2);if(parts.length!=2||!Set.of("clan","company").contains(parts[0]))return;try{String id=UUID.fromString(parts[1]).toString();organisations.openHomeNpc(event.getPlayer(),parts[0].equals("clan")?"clans":"companies",id,event.getRightClicked().getUniqueId());}catch(IllegalArgumentException ignored){}}
|
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=false) public void organisationContact(org.bukkit.event.player.PlayerInteractEntityEvent event){String marker=event.getRightClicked().getPersistentDataContainer().get(new NamespacedKey("dunerealms","organisation_home_npc"),PersistentDataType.STRING);if(marker==null)return;event.setCancelled(true);if(event.getHand()!=org.bukkit.inventory.EquipmentSlot.HAND)return;String[] parts=marker.split(":",2);if(parts.length!=2||!Set.of("clan","company").contains(parts[0]))return;try{String id=UUID.fromString(parts[1]).toString();organisations.openHomeNpc(event.getPlayer(),parts[0].equals("clan")?"clans":"companies",id,event.getRightClicked().getUniqueId());}catch(IllegalArgumentException ignored){}}
|
||||||
@EventHandler public void scoreboardCommand(PlayerCommandPreprocessEvent e){String command=e.getMessage().trim();if(command.equalsIgnoreCase("/scoreboard")){e.setCancelled(true);toggleSidebar(e.getPlayer());}}
|
@EventHandler public void scoreboardCommand(PlayerCommandPreprocessEvent e){String command=e.getMessage().trim();if(command.equalsIgnoreCase("/scoreboard")){e.setCancelled(true);toggleSidebar(e.getPlayer());}}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue

Staff