fishikxd

zrób komende w stylu /code i wtedy admin moze utworzyc jakis kod na serwer np. "/createcode start addmoney 100" czy cos w tym stylu, admin moze wybrac czy to bedzie jakis itemek czy parę itemków albo moze mogą byc to coinsy dodane przez plugin vault. chyba rozumiesz o co chodzi?

Kodari AI
KodariMay 21 at 1:16 pm 7,684 (v2)

Zrobię plugin do tworzenia i używania kodów promocyjnych z nagrodami.

RedeemCodes
A promotional code system allowing admins to create redeemable codes with customizable rewards. Players can redeem codes to receive items, money (via Vault), or other rewards. Features include one-time use codes, usage limits, expiration dates, and cooldown management. Admins can create, delete, and manage codes through intuitive commands. All codes are stored in a config file with full customization.

Plugin gotowy!

System kodów promocyjnych z pełną funkcjonalnością:

Komendy:

  • /code <kodename> - użyj kodu (gracze)

  • /code create <name> [maxUses] - stwórz kod (-1 = nieograniczone użycia)

  • /code delete <name> - usuń kod

  • /code list - lista wszystkich kodów

Przykład użycia admina:

Plain Text
/code create WELCOME 100

Potem edytujesz config.yml:

YAML
codes:
  WELCOME:
    max-uses: 100
    used-by: []
    rewards:
      - type: MONEY
        amount: 500
      - type: ITEM
        material: DIAMOND
        amount: 5
        name: "&bWelcome Diamond"
        lore:
          - "&7Special gift!"

Cechy:

  • Integracja z Vault (pieniądze)

  • Itemki z XSeries (cross-version)

  • Śledzenie użytych kodów per gracz

  • Limit użyć globalnych

  • Wiele nagród na jeden kod

  • Tab completion

fishikxd

zmien nazwe moda na "RedeemCodes by fishik"

Kodari AI
KodariMay 21 at 1:18 pm 2,805 (v2)

Gotowe! Zmieniłem nazwę plugina na “RedeemCodes by fishik” i autora na fishik.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
8 560
src/main/java/com/redeemcodes/RedeemCodes.java
package com.redeemcodes;

import lombok.Getter;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.ChatColor;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public class RedeemCodes extends JavaPlugin {
    @Getter
    private CodeManager codeManager;
    @Getter
    private Economy economy;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        if (!setupEconomy()) {
            getLogger().warning("Vault not found! Economy rewards will not work.");
        }

        this.codeManager = new CodeManager(this);

        getCommand("code").setExecutor(new CodeCommand(this));

        getLogger().info("RedeemCodes enabled successfully!");
    }

    @Override
    public void onDisable() {
        if (codeManager != null) {
            codeManager.saveCodes();
        }
        getLogger().info("RedeemCodes disabled!");
    }

    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false;
        }
        economy = rsp.getProvider();
        return economy != null;
    }

    public String msg(String path) {
        return color(getConfig().getString("messages." + path, "&cMessage not found: " + path));
    }

    public String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }
}