Fero Ali

ak 47 mermisi ve slotuyla oyuna ekle

Kodari AI
KodariSep 13 at 4:19 pm 1
AK47AmmoSystem
Adds AK-47 bullets and a dedicated ammo slot to the game. Players can obtain AK-47 ammunition items, store them in a new inventory slot, and use them with AK-47 weapons. The plugin manages ammo counts, reload mechanics, and bullet consumption during firing. Includes crafting recipes, loot tables, and configurable ammo stack sizes for balanced gameplay integration.
  1. Ak47Plugin: plugin giriş noktası, komut ve listener kaydı.

  2. Ak47Items: AK-47 ve mermi item’larını üretir, özel kimliklerini yönetir.

  3. Ak47Command: oyuncuya silahı hotbar slotuna ve mermiyi envantere verir.

  4. Ak47Listener: sağ tıkla ateş etme, mermi tüketme, cooldown ve hedef hasarı.

  5. Gradle/plugin metadata: derleme ve Bukkit kayıt dosyaları.

AK-47 sistemi oluşturuldu.

  • /ak47 komutu oyuncunun mevcut hotbar slotuna AK-47 verir.

  • 32 adet AK-47 mermisi envantere eklenir.

  • AK-47 sağ tıkla ateş eder.

  • Her atış 1 mermi tüketir.

  • Mermi yoksa ateş edilmez ve uyarı gösterilir.

  • Silah 60 blok menzile ve 7 hasara sahiptir.

  • Ateş etme cooldown’u: 120 ms.

  • Özel item kimlikleri PersistentDataContainer ile korunur.

  • plugin.yml, Gradle yapılandırması ve Java sınıfları eklendi.

Kullanım:

Plain Text
/ak47

Gerekli izin:

Plain Text
ak47.give
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 277
src/main/java/com/example/ak47/Ak47Plugin.java
package com.example.ak47;

import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

public final class Ak47Plugin extends JavaPlugin {

    private NamespacedKey itemKey;
    private NamespacedKey ammoKey;

    @Override
    public void onEnable() {
        this.itemKey = new NamespacedKey(this, "item_type");
        this.ammoKey = new NamespacedKey(this, "ammo");

        Ak47Items items = new Ak47Items(itemKey, ammoKey);
        getCommand("ak47").setExecutor(new Ak47Command(items));
        getServer().getPluginManager().registerEvents(new Ak47Listener(items), this);
        getLogger().info("AK-47 and ammunition enabled.");
    }
}