ShreyanshGamersYT

I know you are a expert minecraft plugin developer so make the project

Create a Minecraft Paper/Spigot plugin for version 1.21 called "PlayerTracker".

Plugin Description:

This plugin allows an admin to place a live tracker on any player in the server. Once a player is tracked, a dynamic boss bar appears on the screens of all online players, showing:

  • The tracked player's name
  • Their current coordinates (X, Z)
  • The world dimension they’re in (Overworld, Nether, End)
  • Remaining tracking duration (e.g., 2 days, 3 hours, etc.)

When the timer expires, the tracker automatically stops and removes the boss bar.

---

Main Features:

  1. Commands:

- /trackplayer <player> <duration> → starts tracking the specified player for the given time. - Duration format examples: 2d, 3h, 20m, 45s (support multiple formats). - /stoptrack → instantly stops the tracking event. - Both commands usable by console or players with permission playertracker.control.

  1. Boss Bar Display:

- Show a boss bar at the top of all players’ screens (like the attached image). - Example format:

🔥 Target Locked: <playerName> | ⏳ <timeLeft> | 🌍 <dimension> | X=<x> Z=<z>
- Boss bar color: RED (or dynamic color as time decreases). - Boss bar should smoothly update every 2 seconds with live coordinates and remaining time.

  1. Tracking Behavior:

- The boss bar is visible to all online players. - The bar updates the target’s live position (rounded to one decimal). - If the tracked player goes offline, display “Target Offline” but keep timer running. - If they rejoin, resume normal tracking automatically.

  1. Time Control:

- Track duration is fully customizable by command (seconds, minutes, hours, or days). - When the timer ends, the plugin automatically: - Removes the boss bar from all players. - Sends a title message to all players: - Title (gold): “🔍 Tracking Ended” - Subtitle (gray): “The target has escaped…”

  1. Dimension Display:

- Show current world/dimension in text: - “🌍 Overworld”, “🔥 Nether”, or “☁ The End”.

  1. Permissions:

- playertracker.control → Allows using /trackplayer and /stoptrack.

  1. Optimization:

- Use Bukkit scheduler to update boss bar text every 2 seconds. - Efficient memory use (only one active tracker at a time). - Compatible with Paper 1.21+.

  1. Config.yml:

- Store default boss bar color and update interval. - Option to enable/disable dimension display.

---

Bonus:

  • Play a sound (ENTITY_ENDER_EYE_DEATH or UI_TOAST_CHALLENGE_COMPLETE) when tracking starts.
  • Broadcast chat message: “📡 Tracking started on <playerName> for <time>!”

---

Plugin Name: PlayerTracker Main Commands:

  • /trackplayer <player> <duration>
  • /stoptrack

---

Expected Behavior Example:

If I run /trackplayer Shreyansh 2d, → all players see a boss bar like:

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code