Skip to content

Parallax-Development/DataLens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” DataLens

Real-time data inspector for Minecraft β€” inspect, edit, compare and export any block, entity or item.

Features β€’ Commands β€’ Permissions β€’ Configuration β€’ API β€’ Building β€’ Project Structure


Overview

DataLens is a Bukkit plugin that gives server operators and developers a powerful lens into the internal data structures of Minecraft objects. Point at any block, entity or player, and instantly explore its full data tree β€” PDC tags, attributes, potion effects, enchantments, block states and more β€” through both a paginated chest GUI and chat commands.

Unlike simple NBT viewers, DataLens provides a complete inspect β†’ edit β†’ validate β†’ diff β†’ export pipeline with automatic rollback on failure, a built-in changelog, and a public API for third-party schema registration.

Supported platforms: Bukkit / Spigot / Paper 1.20.x – 1.21.x Β· Java 21+


Features

πŸ”Ž Deep Inspection

  • Blocks, Entities, Items & Players β€” inspect any object via raytrace targeting or by player name.
  • Full data tree extraction β€” PDC keys, block states, entity attributes, potion effects, equipment, enchantments, lore, and more are captured into a hierarchical DataNode tree.
  • Version-adaptive β€” pluggable adapter layer auto-detects the server version and loads the appropriate reader/writer (Paper120Adapter, Paper121Adapter).

✏️ Safe In-Place Editing

  • Set / Remove any primitive value by dot-notation path (e.g. pdc.myplugin:level).
  • Type validation & coercion β€” raw string inputs are validated against the target node's DataType before committing.
  • Atomic rollback β€” a deep-copy snapshot is taken before every write; if persistence fails the tree is restored automatically.

πŸ“Š Diff Engine

  • Compare the live data tree against your working copy to see exactly what changed β€” additions, removals and modifications are displayed with color-coded chat output.

πŸ“€ Export

  • Dump the complete data tree as JSON (via Jackson) or YAML (via SnakeYAML) directly to chat.

πŸ–₯️ Inspector GUI

  • 54-slot paginated inventory with navigation breadcrumbs.
  • Click into compound/list nodes to drill down; use Back to navigate up.
  • Color-coded type indicators, pagination controls, and one-click export.

πŸ“ Changelog

  • Every SET and REMOVE operation is logged to plugins/DataLens/changelog.log with timestamps, actor, path, and old/new values.
  • Configurable β€” can be disabled entirely.

πŸ” Permission System

  • Granular permission nodes (datalens.inspect, datalens.edit, datalens.admin) centralized through PermissionGuard.

🧩 Public API

  • Third-party plugins can register schemas for their PDC namespaces to improve labelling and validation.
  • Programmatic access to InspectorService and SessionService via DataLensPlugin.getAPI().

⚑ Performance

  • Per-player sessions backed by a Caffeine LRU cache with configurable TTL and capacity.
  • Read operations are thread-safe; writes enforce main-thread execution.

Commands

Command Description Permission
/inspect Inspect the block/entity you are looking at (raytrace) datalens.inspect
/inspect <player> Inspect a named online player directly datalens.inspect
/data set <path> <value> Edit a primitive value at the given path datalens.edit
/data remove <path> Delete the node at the given path datalens.edit
/data export [json|yaml] Export the inspected data tree to chat datalens.inspect
/data diff Show differences between live data and working copy datalens.inspect

Both commands include context-aware tab completion β€” paths are autocompleted from the live data tree, and values suggest type-appropriate options.


Permissions

Node Description Default
datalens.inspect Inspect blocks, entities and items op
datalens.edit Edit inspected data values op
datalens.admin Full administrative access (inherits inspect + edit) op

Configuration

Configuration is stored in plugins/DataLens/config.yml:

debug: false

cache:
  session-ttl-seconds: 60     # Idle timeout for player sessions
  max-sessions: 100            # Maximum concurrent inspection sessions

inspect:
  max-ray-distance: 5.0        # Raytrace distance in blocks for /inspect

changelog:
  enabled: true                # Enable/disable edit logging
  max-entries: 10000           # Maximum changelog entries

API

Other plugins can interact with DataLens programmatically:

// Obtain the API instance
DataLensAPI api = DataLensPlugin.getAPI();

// Register a schema for your PDC namespace
Schema schema = new Schema("myplugin", List.of(
    new SchemaField("level", DataType.INT, "Player level"),
    new SchemaField("guild", DataType.STRING, "Guild name")
));
api.registerSchema("myplugin", schema);

// Programmatic inspection
InspectorService inspector = api.getInspectorService();
InspectableObject obj = inspector.inspect(someEntity);

// Session management
SessionService sessions = api.getSessionService();
PlayerSession session = sessions.open(player.getUniqueId(), obj);

Building

Requirements: Java 21+, Gradle 8+

# Clone the repository
git clone https://github.com/Parallax-Development/DataLens.git
cd DataLens

# Build the fat JAR (output: build/libs/DataLens-<version>.jar)
./gradlew clean build

# Run a local Paper test server (requires run-paper plugin)
./gradlew runServer

The build produces a shadow JAR that bundles Jackson, Caffeine and the Adventure platform adapter. Server-provided dependencies (Spigot API, SnakeYAML) are excluded.


Project Structure

DataLens/
β”œβ”€β”€ build.gradle.kts                  # Build config (Shadow, run-paper)
β”œβ”€β”€ settings.gradle.kts               # Project settings
β”œβ”€β”€ gradle.properties                 # Version & Gradle flags
β”‚
└── src/
    β”œβ”€β”€ main/
    β”‚   β”œβ”€β”€ java/dev/darkblade/datalens/
    β”‚   β”‚   β”œβ”€β”€ DataLensPlugin.java           # Plugin entry point & lifecycle
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ adapter/
    β”‚   β”‚   β”‚   β”œβ”€β”€ common/
    β”‚   β”‚   β”‚   β”‚   └── Adapter.java          # Version-agnostic data I/O interface
    β”‚   β”‚   β”‚   └── versioned/
    β”‚   β”‚   β”‚       β”œβ”€β”€ Paper120Adapter.java   # Paper 1.20.x implementation
    β”‚   β”‚   β”‚       └── Paper121Adapter.java   # Paper 1.21.x implementation
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ api/
    β”‚   β”‚   β”‚   └── DataLensAPI.java          # Public API surface for third-party plugins
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ command/
    β”‚   β”‚   β”‚   β”œβ”€β”€ InspectCommand.java       # /inspect β€” raytrace & named targeting
    β”‚   β”‚   β”‚   └── DataCommand.java          # /data β€” set, remove, export, diff
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ core/
    β”‚   β”‚   β”‚   β”œβ”€β”€ diff/
    β”‚   β”‚   β”‚   β”‚   └── DiffService.java      # Recursive tree comparison engine
    β”‚   β”‚   β”‚   β”œβ”€β”€ edit/
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ EditService.java      # Safe edit pipeline with rollback
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PathResolver.java     # Dot-notation path resolution
    β”‚   β”‚   β”‚   β”‚   └── PathSegment.java      # Path segment model (key / index)
    β”‚   β”‚   β”‚   β”œβ”€β”€ inspect/
    β”‚   β”‚   β”‚   β”‚   └── InspectorService.java # Converts live objects to DataNode trees
    β”‚   β”‚   β”‚   β”œβ”€β”€ serialize/
    β”‚   β”‚   β”‚   β”‚   └── SerializationService.java  # JSON & YAML import/export
    β”‚   β”‚   β”‚   β”œβ”€β”€ session/
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PlayerSession.java    # Per-player inspection state & navigation
    β”‚   β”‚   β”‚   β”‚   └── SessionService.java   # Caffeine-backed session cache
    β”‚   β”‚   β”‚   └── validate/
    β”‚   β”‚   β”‚       └── ValidationService.java # Type validation & coercion
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ model/
    β”‚   β”‚   β”‚   β”œβ”€β”€ DataNode.java             # Core tree node (mutable, deep-copyable)
    β”‚   β”‚   β”‚   β”œβ”€β”€ DataType.java             # NBT-compatible type enum
    β”‚   β”‚   β”‚   β”œβ”€β”€ InspectableObject.java    # Inspected object wrapper
    β”‚   β”‚   β”‚   β”œβ”€β”€ InspectableType.java      # BLOCK / ENTITY / ITEM enum
    β”‚   β”‚   β”‚   β”œβ”€β”€ diff/
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ DataDiff.java         # Single diff entry model
    β”‚   β”‚   β”‚   β”‚   └── DiffType.java         # ADDED / REMOVED / CHANGED
    β”‚   β”‚   β”‚   β”œβ”€β”€ schema/
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Schema.java           # Namespace schema definition
    β”‚   β”‚   β”‚   β”‚   └── SchemaField.java      # Individual field descriptor
    β”‚   β”‚   β”‚   └── validation/
    β”‚   β”‚   β”‚       └── ValidationResult.java # Validation outcome (ok / error)
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ repository/
    β”‚   β”‚   β”‚   └── ChangeLogRepository.java  # File-based edit audit log
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ security/
    β”‚   β”‚   β”‚   └── PermissionGuard.java      # Centralized permission checks
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ service/
    β”‚   β”‚   β”‚   └── DataLensServiceLocator.java # Central service registry
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ ui/
    β”‚   β”‚   β”‚   β”œβ”€β”€ chat/
    β”‚   β”‚   β”‚   β”‚   └── ChatRenderer.java     # Tree & diff rendering to chat
    β”‚   β”‚   β”‚   └── gui/
    β”‚   β”‚   β”‚       β”œβ”€β”€ GuiListener.java      # Inventory click event handler
    β”‚   β”‚   β”‚       β”œβ”€β”€ InspectorGui.java     # 54-slot paginated chest GUI
    β”‚   β”‚   β”‚       └── NodeRenderer.java     # ItemStack rendering for data nodes
    β”‚   β”‚   β”‚
    β”‚   β”‚   └── util/
    β”‚   β”‚       β”œβ”€β”€ AdapterLoader.java        # Runtime version detection & adapter loading
    β”‚   β”‚       β”œβ”€β”€ PathCompleter.java        # Tab-completion for data paths & values
    β”‚   β”‚       β”œβ”€β”€ PdcUtil.java              # PDC reading utilities
    β”‚   β”‚       └── VersionUtil.java          # Server version parsing
    β”‚   β”‚
    β”‚   └── resources/
    β”‚       β”œβ”€β”€ plugin.yml                    # Bukkit plugin descriptor
    β”‚       └── config.yml                    # Default configuration
    β”‚
    └── test/
        └── java/dev/darkblade/datalens/
            β”œβ”€β”€ core/
            β”‚   β”œβ”€β”€ diff/
            β”‚   β”‚   └── DiffServiceTest.java
            β”‚   └── validate/
            β”‚       └── ValidationServiceTest.java
            └── model/
                └── DataNodeTest.java

License

Copyright Β© 2026 Parallax Development. All rights reserved.