devan2010

ad reload feature and also add placeholder api support

Kodari AI
KodariJul 11 at 6:39 pm 16
  1. Add a plugin reload command that refreshes configuration safely.

  2. Add PlaceholderAPI expansion support for the plugin’s player values.

  1. Done — /team reload reloads config and requires teams.reload.

  2. Add PlaceholderAPI placeholders for team name, owner, member count, bank balance, ally count, and war count.

  1. Added /team reload with teams.reload permission.

  2. Added PlaceholderAPI as a soft dependency and compile-time dependency.

  3. Placeholder expansion registration is incomplete because the environment lacks Maven; no expansion class was created.

devan2010

how can i test tjis pluging all are working i mean like commad and this run the the serevr

Kodari AI
KodariJul 11 at 6:42 pm 2
  1. Build the JAR locally:

    Shell
    mvn clean package
    

    Your plugin JAR will be in the target/ folder.

  2. Run a Paper server matching your plugin’s target Minecraft version:

    Shell
    java -Xms1G -Xmx2G -jar paper.jar --nogui
    

    Accept the EULA in eula.txt, then start it again.

  3. Put the built JAR into:

    Plain Text
    server/plugins/
    

    Restart the server fully. Do not use Bukkit’s /reload.

  4. Verify startup:

    Plain Text
    /plugins
    

    Your plugin should be green. If it is red or absent, inspect logs/latest.log for the startup error.

  5. Test commands as an OP:

    Plain Text
    /op YourName
    /team help
    /team create TestTeam
    /team invite AnotherPlayer
    /team accept TestTeam
    /team info
    /team reload
    

    Change a value in the plugin’s config.yml, run /team reload, then repeat the related command to confirm the new config value applies.

  6. Test permissions with a non-OP account. For example, remove OP and grant only the needed permissions through LuckPerms:

    Plain Text
    /lp user YourName permission set teams.reload true
    

    Confirm /team reload works with teams.reload and is denied without it.

  7. For PlaceholderAPI testing, install PlaceholderAPI’s JAR in plugins/, restart, and verify:

    Plain Text
    /plugins
    /papi parse me %<identifier>_<placeholder>%
    

    Replace <identifier> with the value returned by the expansion’s getIdentifier() method and <placeholder> with one of its supported parameters. If the expansion is registered correctly, the command returns your team data instead of the raw %...% text.

  8. Check logs/latest.log after every restart and after testing reloads. A clean test means: no stack traces, commands respond correctly, config changes apply through /team reload, and PlaceholderAPI parses values successfully.

devan2010
📎 1 file 1,843 chars
📄
pasted-code-1783795993988.txt
txt 55 lines
▶
The PlaceholderAPI support is incomplete.

Currently `/papi parse me %teams_name%` returns nothing, which means the expansion is not registered or not implemented correctly.

Implement FULL PlaceholderAPI support for the TeamsPlugin.

Requirements:

1. Add a proper PlaceholderExpansion class.
2. Register it automatically during plugin startup if PlaceholderAPI is installed.
3. Make PlaceholderAPI a softdepend in plugin.yml.
4. If PlaceholderAPI is not installed, the plugin should continue working normally.
5. Ensure all placeholders return valid values instead of null or empty strings.

Support at least these placeholders:

Player Team
- %teams_name%
- %teams_owner%
- %teams_member_count%
- %teams_bank%
- %teams_allies%
- %teams_wars%

Optional but recommended:
- %teams_is_owner%
- %teams_is_in_team%
- %teams_online_members%
- %teams_prefix%

Behaviour:
- If the player is not in a team, return an empty string or configurable value like "None".
- Never throw errors if data is missing.
- Support offline players whenever possible.

Register the expansion in onEnable():

if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
    new TeamsPlaceholderExpansion(this).register();
}

Implement getIdentifier(), getAuthor(), getVersion(), persist(), canRegister(), and onPlaceholderRequest() correctly.

After implementation the following commands must work:

/papi parse me %teams_name%
/papi parse me %teams_owner%
/papi parse me %teams_member_count%
/papi parse me %teams_bank%
/papi parse me %teams_allies%
/papi parse me %teams_wars%

Each command should return the correct value instead of the raw placeholder or an empty result.

Finally, verify the expansion is successfully registered during plugin startup and report any registration errors to the console.
Kodari AI
KodariJul 11 at 6:54 pm 10
  1. Inspect the existing plugin startup, team data APIs, and PlaceholderAPI dependency state.

  2. Implement and register a resilient teams placeholder expansion.

  3. Add the required soft dependency and registration diagnostics.

Implemented full PlaceholderAPI support.

  • Registers the teams expansion at startup only when PlaceholderAPI is installed, with console success/failure logging.

  • Supports %teams_name%, %teams_owner%, %teams_member_count%, %teams_bank%, %teams_allies%, and %teams_wars%.

  • Also supports %teams_is_owner%, %teams_is_in_team%, %teams_online_members%, and %teams_prefix%.

  • Supports offline-player requests using stored UUID team data.

  • Returns safe values such as None, 0, 0.0, or false when team data is unavailable.

  • plugin.yml already correctly declares PlaceholderAPI as a soft dependency.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
23 2,195
src/main/java/com/yourserver/teams/TeamsPlugin.java
package com.yourserver.teams;

import com.yourserver.teams.command.TeamCommand;
import com.yourserver.teams.listener.ChatInputListener;
import com.yourserver.teams.listener.GuiListener;
import com.yourserver.teams.manager.ConfigManager;
import com.yourserver.teams.manager.TeamManager;
import com.yourserver.teams.manager.VaultHook;
import com.yourserver.teams.placeholder.TeamsPlaceholderExpansion;
import org.bukkit.plugin.java.JavaPlugin;

public final class TeamsPlugin extends JavaPlugin {

    private static TeamsPlugin instance;

    private ConfigManager configManager;
    private TeamManager teamManager;
    private VaultHook vaultHook;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();

        this.configManager = new ConfigManager(this);
        this.teamManager = new TeamManager(this);
        this.vaultHook = new VaultHook();

        if (!vaultHook.setup(this)) {
            getLogger().warning("Vault (or an economy plugin behind it) was not found! " +
                    "Team bank deposits/withdrawals will not work until Vault + an economy plugin are installed.");
        }

        TeamCommand teamCommand = new TeamCommand(this);
        getCommand("team").setExecutor(teamCommand);
        getCommand("team").setTabCompleter(teamCommand);

        getServer().getPluginManager().registerEvents(new GuiListener(this), this);
        getServer().getPluginManager().registerEvents(new ChatInputListener(this), this);

        if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
            try {
                if (new TeamsPlaceholderExpansion(this).register()) {
                    getLogger().info("PlaceholderAPI expansion registered with identifier: teams");
                } else {
                    getLogger().warning("PlaceholderAPI expansion could not be registered.");
                }
            } catch (Exception exception) {
                getLogger().warning("PlaceholderAPI expansion registration failed: " + exception.getMessage());
            }
        }

        getLogger().info("TeamsPlugin enabled.");
    }

    @Override
    public void onDisable() {
        if (teamManager != null) {
            teamManager.saveAll();
        }
        getLogger().info("TeamsPlugin disabled.");
    }

    public static TeamsPlugin getInstance() {
        return instance;
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public TeamManager getTeamManager() {
        return teamManager;
    }

    public VaultHook getVaultHook() {
        return vaultHook;
    }
}