Fardin Rahman
๐Ÿ“Ž 1 file 3,558 chars
๐Ÿ“„
pasted-code-1792063486197.txt
txt 46 lines
โ–ถ
Act as an expert Minecraft Java developer specializing in the Fabric API. Please write and build the complete, fully compiled .jar file for a server-side Fabric mod targeting Minecraft 1.26.2.

**Mod Overview:**
The mod introduces a lightweight, server-side team system where players can create teams, manage memberships, share a communal "Team Ender Chest" (E-Chest), and display their team name as a visible prefix.

**Flat Permissions Rule:**
There is NO team hierarchy, ownership, or superiority. All team members have equal access to every command and feature (e.g., any member can invite, kick, disband, or access the shared E-Chest).

**Technical Requirements:**
*   **Modloader:** Fabric API.
*   **Target Version:** Minecraft 1.26.2.
*   **Environment:** Strictly server-side (clients should not need to download the mod to join the server).
*   **Data Storage:** Persist team data and shared E-Chest inventories using standard Minecraft server data storage (e.g., NBT format or JSON in the world save directory).

**Nametag & Tab List Display:**
*   When a player joins a team, format their display name and overhead nametag to show their team name as a prefix: `[TeamName] PlayerName`.
*   This prefix must be visible:
    1.  In the player list when pressing **Tab**.
    2.  Above the player's head (visible to other players and in third-person **F5** view).
    3.  In chat messages.
*   If a player leaves, gets kicked, or the team disbands, their display name and nametag prefix must automatically revert back to normal.
*   Utilize native Minecraft Scoreboard Teams or Fabric server display name hooks so this works purely server-side without requiring client-side mods.

**Core Features & Commands:**
Implement a command structure under the root command `/team`:

1.  **Creation & Management (Equal Access for All Members):**
    *   `/team create `: Creates a new team with the specified name, sets up the prefix, and adds the creator as a member.
    *   `/team disband`: Deletes the team and removes prefixes for all members (can be executed by ANY team member).
    *   `/team leave`: Leaves the current team and removes the player's prefix. If the last member leaves, the team auto-disbands.

2.  **Invites & Joining (Equal Access for All Members):**
    *   `/team invite `: Sends a clickable chat message to the target player inviting them to the team (can be executed by ANY team member).
    *   `/team accept `: Accepts a pending invite and applies the team prefix.
    *   `/team kick `: Removes a player from the team and strips their team prefix (can be executed by ANY team member).

3.  **Team Shared E-Chest (Equal Access for All Members):**
    *   `/team echest`: Opens a 27-slot GUI (standard chest size) shared equally among all members of the team.
    *   This inventory must save its contents reliably when the server stops or restarts.
    *   Multiple team members should be able to open and interact with this chest simultaneously without duplicating or voiding items (ensure proper inventory synchronization).

**Deliverables:**
1.  Complete, bug-free, and compiled ready-to-use .jar file ready for immediate server deployment in the server's `mods/` folder.
2.  Full source code files (including `fabric.mod.json`, `gradle.properties`, main entrypoint, Brigadier commands handler, nametag/scoreboard integration, and data/inventory handlers).
```
Kodari AI
KodariOct 15 at 11:52 am 4
TeamEnderChestSystem
A server-side Fabric mod for Minecraft 1.26.2 introducing a flat-permission team system. Players can create teams, manage memberships through invites/kicks, and share a synchronized 27-slot Ender Chest. All members have equal access to all commands including disband, leave, and inventory management. Team names display as prefixes in nametags, tab list, and chat using native scoreboard teams for pure server-side operation. Data persists via NBT storage in the world save directory, ensuring reliable inventory synchronization and team state across restarts.
  1. Build the server-only Fabric 26.2 project and its command/data layers.

  2. Use native scoreboard teams for synchronized prefixes and a persistent shared chest.

  3. Include the complete source and deployment metadata.

Created the server-only Fabric 26.2 project with /team create, disband, leave, invite, accept, kick, and echest. Native scoreboard prefixes appear in chat, the player list, and overhead name tags. The shared chest uses one synchronized inventory per team and saves through world data storage. All team members have equal command access.

To generate and download the jar in Kodari:

  1. Click Compile in the top bar, or on phone tap โ‹ฎ โ†’ Compile Project.

  2. Click Compile in the window.

  3. When it succeeds, click Download on the build.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
9 440
src/main/java/com/kodari/serverteams/ServerTeams.java
package com.kodari.serverteams;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class ServerTeams implements ModInitializer {
	public static final String MOD_ID = "serverteams";
	public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

	@Override
	public void onInitialize() {
		CommandRegistrationCallback.EVENT.register((dispatcher, buildContext, selection) -> TeamCommands.register(dispatcher));
	}
}