Code Monkey home page Code Monkey logo

vcore's Introduction

VCore

Bir çok proje için teker teker bu yardımcı öğeleri eklemek yerine sadece bir maven kodu ekleyerek tüm bu özelliklere erişebilirsiniz.

Bu proje genel olarak kendi projelerimizi geliştirmek üzere yardımcı bir araç olması amacı ile geliştirdik.

Özellikler

  • Zırh giyme eventleri
  • Dünya sınırını özelleştirme
  • Özel komut oluşturma sistemi
  • Özel config dosyası oluşturma sistemi
  • Envanter oluşturma sistemi
  • Particle effectleri olutuşturma
  • Hologram oluşturma
  • Ekrana veya action bar'a yazı gönderme
  • Eşyalara nbt tagları ekleme

Kurulum

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
<dependency>
    <groupId>com.github.kayraegek18</groupId>
    <artifactId>VCore</artifactId>
    <version>VERSION</version>
</dependency>

Kullanım/Örnekler

Komut oluşturma

@VCommandArguments(
  commandName = "test", <- required
  isPlayerCommand = true, <- optional 
  permission = "testperm", <- optional
  hasSubCommand = false <- required if have a sub command
)
public class TestKomut extends VCommand {
  public void run(Player player, String[] args) { 
    
  }

  public List<String> tabComplete(CommandSender player, String[] args) { 
    return null; 
  }
}

Alt Komut oluşturma

@VSubCommandArguments(
  commandName = "test", <- required
  commandDescription = "Test command", <- optional
  commandPermission = "testperm" <- required
)
public class TestKomut extends VSubCommand {
  public void run(Player player, String[] args) { 
    
  }

  public List<String> tabComplete(CommandSender player, String[] args) { 
    return null; 
  }
}

Komut Sınıfındaki Ekstra Fonksiyonlar

/* Verilen string listesi ve başlangıç 
 * indexini alarak başlangıç indexsinden itibaren
 * tüm string değerlerini tek bir string olarak döndürür 
 */
getFinalArgs(args, start)

/*
 * Sunucudaki tüm oyuncuların isimlerini
 * liste olarak döndürür
 */
getPlayerNicknames()

/*
 * Sunucudaki verilen değer ile başlayan 
 * oyuncuların isimlerini liste olarak döndürür
 */
getPlayerNicknames(startsWith)

/*
 * Verilen komutu sunucuya tanımlamak için kullanılır
 */
registerCommand(plugin, command)

/*
 * Verilen komutu sunucuya tanımlamak için kullanılır
 * + Tab tamamlamasını kullanmak için "withTabCompleter" değerini
 * "true" yapınız.
 */
registerCommand(plugin, command, withTabCompleter)

Config Dosyası Oluşturma

@VConfigArguments(
  configFileName = "config" <- don't write .yml at the end
)
public class TestConfig extends VConfig {
  public TestConfig(JavaPlugin plugin) {
    super(plugin);
  }
}

Ardından main sınıfınızda şu çağırma işlemini yapabilirsiniz.

...
@Override
public void onEnable() {
  TestConfig config = new TestConfig(this);
  // config.getConfig()
  // config.getConfig().addDefault("test", "test")
  // config.saveConfig()
  // config.getConfig().get("test")
  // config.reloadConfig()
}
...

Envanter Arayüzü Oluşturma

public class TestEnvater extends VInv {

    private boolean preventClose = false;

    public TestEnvater() {
        super(VInventorySize.Medium, ChatColor.GOLD + "Örnek envanter");

        // Just add a random item
        setItem(22, new ItemStack(Material.IRON_SWORD), e -> e.getWhoClicked().sendMessage("Kılıca tıkladınız!"));

        // Sınırlara block ekle
        setItems(getBorders(), new VItemBuilder(Material.LAPIS_BLOCK).name(" ").build());

        // Basit bir envanteri kapatma butonu ekleyelim
        setItem(34, new VItemBuilder(Material.BARRIER).name(ChatColor.RED + "Kapat").build(), e -> {
            this.preventClose = !this.preventClose;
        });

        // Eğer "preventClose" değeri false olursa envanteri kapatalım
        setCloseFilter(p -> this.preventClose);
    }

    @Override
    public void onOpen(InventoryOpenEvent event) {
        event.getPlayer().sendMessage(ChatColor.GOLD + "Envanteri açtınız!");
    }

    @Override
    public void onClose(InventoryCloseEvent event) {
        event.getPlayer().sendMessage(ChatColor.GOLD + "Envanteri kapattınız!");
    }

    @Override
    public void onClick(InventoryClickEvent event) {
        // bişiler yapabilirsiniz.
    }
}

Şimdi oyuncuda envanteri açalım

new TestEnvanter().open(player);

VInv örneğini nasıl alabilirim?

if (inventory.getHolder() instanceof VInv) {
    VInv fastInv = (VInv) inventory.getHolder();
}

Parçacık Efekti Oluşturma

// Get a ParticleType
VParticleType flame = VParticleType.of("FLAME");
VParticleType redstone = VParticleType.of("REDSTONE");
VParticleType blockCrack = VParticleType.of("BLOCK_CRACK");

// Spawn particle for a player
flame.spawn(player, loc, 1);

// Spawn particle for all players in a world
flame.spawn(world, loc, 1);

// Spawn colored particle to a player
redstone.spawn(player, loc, 1, VParticleData.createDustOptions(Color.BLUE, 1));

// Spawn block crack particle to a player
blockCrack.spawn(player, loc, 1, VParticleData.createBlockData(Material.DIAMOND));

Çok miktarda parçacık oluşturmanız gerektiğinde, performansları biraz iyileştirmek için VParticleType ve VParticleData örneklerini önbelleğe alabilirsiniz.`

Hologram Oluşturma

// Lokasyon ve satırları yazın
VHologram hologram = new VHologram(loc, lines);

// Hologramları oluştur
hologram.spawn();

// Hologramları yok et
hologram.remove();

Ekrana veya ActionBar'a Yazı Oluşturma

// Ekrana yazı oluşturma
// fadeIn, stay ve fadeOut için 20 = 1 saniye, 10 = 0.5 saniye gibi yazmalısınız
VTitle.sendTitle(player, title, subTitle, fadeIn, stay, fadeOut);
// ActionBar'a yazı oluşturma
VTitle.sendActionbar(player, text)

NBT Tagları Oluşturma

VNbt nbt = new VNbt(item, key);
nbt.add(type, value); // Değer ekleme
nbt.has(type); // Değerin olup olmadığını kontrol etme
nbt.get(type); // Değeri okuma
nbt.getItemContainer();
nbt.getKey();

vcore's People

Contributors

kayraegek18 avatar

Stargazers

Wendellmeset avatar Hasan Kılıcı avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.