skybo11
๐Ÿ“Ž 1 file 1,546 chars
๐Ÿ“„
pasted-code-1777923364658.txt
txt 71 lines
โ–ถ
Create a Minecraft plugin for Paper API (versions 1.21โ€“1.21.11) using Java.

๐Ÿ“Œ Plugin Concept:

The plugin tracks specific player commands and sends detailed logs to a Discord channel using a webhook URL.

โš™๏ธ Features:

Monitor only these commands:

gamemode, gm, gS, give, xp, level, ban, ipban, op, deop,
mute, unmute, invsee, enchant, endersee, kill, tp,
tpa, tpahere, kick
When any player executes one of these commands:
Capture:
Player name
UUID
Full command used (including arguments)
Timestamp (formatted, e.g. yyyy-MM-dd HH:mm:ss)
Send this data to a Discord webhook as a formatted message (JSON POST request)
๐Ÿ“‚ Config Requirements:

Create a config.yml with:

webhook-url: "YOUR_DISCORD_WEBHOOK_URL"

tracked-commands:
  - gamemode
  - gm
  - gS
  - give
  - xp
  - level
  - ban
  - ipban
  - op
  - deop
  - mute
  - unmute
  - invsee
  - enchant
  - endersee
  - kill
  - tp
  - tpa
  - tpahere
  - kick
Server owners must be able to:
Add/remove commands
Modify the list without recompiling
๐Ÿง  Technical Requirements:
Use Paper API event listeners (PlayerCommandPreprocessEvent)
Async webhook sending (to avoid blocking server thread)
Clean plugin structure:
Main class
Config manager
Webhook utility class
Handle edge cases:
Ignore commands not in config
Prevent console commands from being logged (only players)
Use proper plugin.yml setup
๐Ÿ’ฌ Discord Message Format:

Example:

๐Ÿ“Œ Command Used

๐Ÿ‘ค Player: Notch
๐Ÿ†” UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
โŒจ๏ธ Command: /gamemode creative {Player_name}
โฐ Time: 2026-05-05 14:32:10
Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code