Skip to content

Dual Interaction System (Commands + Right-Click) #85

Description

@FirebrickRed

Summary

Support both command-based AND right-click interactions for entities. Includes DM Wand item for quick DM actions. Provides flexibility for different player/DM preferences.

Phase: 2 - Interaction
Systems: Interaction, UI, DM Tools

Prerequisites

Goals

  • Right-click entity with empty hand → Stat block
  • Right-click entity with goods → Trade (if shop enabled)
  • Right-click entity with DM Wand → DM quick menu
  • DM Wand item (special tool for DM-only actions)
  • /dmwand command to spawn DM Wand
  • Quick menu: Possess, Teleport, Remove, Edit HP, Edit Shop
  • All right-click actions have command equivalents

DM Wand Item

// Special item for DM-only right-click actions
ItemStack dmWand = new ItemStack(Material.BLAZE_ROD);
ItemMeta meta = dmWand.getItemMeta();
meta.displayName(Component.text("DM Wand").color(NamedTextColor.GOLD));
meta.setCustomModelData(1); // Custom resource pack model
meta.getPersistentDataContainer().set(DM_WAND_KEY, PersistentDataType.BYTE, (byte) 1);
# Spawn DM Wand
/dmwand
> You received a DM Wand

Right-Click Behaviors

Player (empty hand):

  • Right-click entity → View stat block

Player (holding items):

  • Right-click merchant → Open shop (if has shop)

DM (DM Wand):

  • Right-click entity → DM Quick Menu

DM Quick Menu

┌─────────────────────────────────┐
│   DM Actions: Balin              │
├─────────────────────────────────┤
│ [Possess]  [Teleport]  [Remove] │
│ [Edit HP]  [Edit Shop]  [Notes] │
│         [Commands...]            │
└─────────────────────────────────┘

Command Equivalents

# Every right-click action has a command equivalent:
Right-click (empty hand)   = /entity info <entity>
Right-click (with goods)   = /entity trade <entity>
Right-click (DM wand) → Possess = /dmentity possess <entity>
Right-click (DM wand) → Remove  = /dmentity remove <entity>
# Etc.

Technical Implementation

@EventHandler
public void onEntityRightClick(PlayerInteractEntityEvent event) {
    Entity clicked = event.getRightClicked();
    Player player = event.getPlayer();
    DndEntityInstance entity = DndEntityManager.getEntity(clicked);
    
    if (entity == null) return;
    
    ItemStack hand = player.getInventory().getItemInMainHand();
    
    if (ItemUtil.isDMWand(hand) && player.hasPermission("jkvtt.dm")) {
        openDMQuickMenu(player, entity);
    } else if (hand.getType() == Material.AIR) {
        EntityStatBlockMenu.open(player, entity);
    } else if (entity.hasShop()) {
        ShopManager.openShop(player, entity);
    }
}

Next Steps

After completing this issue, tackle:

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestnpc/entityFor issues pertaining to npc's or monsters and is referred to as entities in the mod pack

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions