Sueta
OM

Omels API

1.0.8

Simple but functional API

·Plugin

Omels API

This API is a functional Tool for every Developer. It contains tons of cool stuff which is made simple.

Stats!!!
Stats about this API can be seen here >CLICK<

How do I use it?
Simply right click on your Project then you click on Properties then you click on Java Build Path and there you have to click on "Add external Jar" then you select the API and click on APPLY. Now the API is implemented in your Project. (This was an eclipse Tutorial)

Upload the API on your server and now you can use it!

What does it Contains?!!

  • Self register Commands
  • Self register Quick Events
  • Entity stuff
  • FileBuilder
  • Fun stuff (Pets, Airdrops etc)
  • Hologram (ALPHA)
  • Inventorys
  • ItemBuilder
  • MySQL
  • Packets
  • Particles
  • Scheduler
  • Skin API (Not available now)
  • Self register TabComplete Adapters

Examples

Self register Commands

You dont need to register them in the Plugin.yml!

Method 1
package de.omel.api.command;

import org.bukkit.command.CommandSender;

public class MyCommand extends AbstractCommand{

    public MyCommand(String commandName) {
        super(commandName);
    }

    @Override
    public boolean command(CommandSender s, String[] args) {
        //do Stuff
        return false;
    }

}

Then register in the onEnable method

public void onEnable() {

        new MyCommand("commandName");

}
Method 2
public void onEnable() {

        new AbstractCommand("commandName") {

            @Override
            public boolean command(CommandSender s, String[] args) {
                //do Stuff
                return false;
            }
        };

}
Self register QuickEvents
Method 1
package de.omel.api.event;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.Plugin;

public class MyEvent extends QuickEvent<NameOfEvent>{

    public MyEvent(Plugin pl) {
        super(pl);
        // TODO Auto-generated constructor stub
    }

    @Override
    @EventHandler //MUST BE ADDED MANUALLY
    public void callEvent(NameOfEvent e) {
        // TODO Auto-generated method stub

    }

}

Then register it in your onEnable

public void onEnable() {

        new MyEvent(this);

}
Method 2
public void onEnable() {

        new QuickEvent<NameOfEvent>(this) {

            @Override
            @EventHandler //MUST BE ADDED MANUALLY
            public void callEvent(NameOfEvent e) {



            }
        };

}
Entity stuff
CustomEntity ce = new CustomEntity(EntityType.COW, Location);
        ce.setAge(EntityAge.ADULT);
        ce.setName("Cool cow");
File Builder
FileBuilder f = new FileBuilder("plugins//Your_Folder//", "Your_File_Name.yml");
        f.setValue("ValuePath", 100);
        f.save();
Fun stuff
Pets

PETS CURRENTLY DO NOT FOLLOW THE OWNER DUE TO NMS PROBLEMS!

Pet pet = new Pet(EntityType.COW, PLAYER);
        pet.setBaby();
        pet.setAgeLock(true);
        pet.setName("Cool cow");
Airdrops
Airdrop drop = new Airdrop(WORLD, this);

        drop.setLocation(MAX_RADIUS, MIN_RADIUS);
        drop.setContents(new ItemStack[]{

                new ItemStack(Material.APPLE)
        });

        drop.spawn();

        Bukkit.broadcastMessage("A new Airdrop appeared!");
        Bukkit.broadcastMessage("Location: X" + drop.getX() + " Y: " + drop.getY()+ " Z: " + drop.getZ());
Autobroadcaster
new AutoBroacaster() {

            @Override
            public int period() {
                //IN SECONDS
                return 60 * 5;
            }

            @Override
            public List<String> messages() {
                // TODO Auto-generated method stub
                return Arrays.asList("This is message number 1", "This is message number 2");
            }
        }.run();
Warps
Warp warp = new Warp("WARP_NAME");
        warp.setLocation(LOCATION);
Holograms

ALPHA TAKE CARE!

Hologram holo = new Hologram("HOLOGRAM_NAME");
        holo.setLocation(LOCATION);
        holo.addLine("This is a HOLOGRAM!");
        holo.addLine("§aCool this is green!");
        holo.update();
Inventorys
Inv inv = new Inv(InventoryType.HOPPER);
        inv.addItem(new ItemStack(Material.BREAD));
        inv.setCancelOnClick(true); //NOBODY CAN STEAL ITEMS IN THE INVENTORY!
        PLAYER.openInventory(inv.getInventory());
        //inv.getWatchers() returns a list of PLAYERS who currently watching THIS inventory!
Item Builder
ItemBuilder item = new ItemBuilder(Material.BREAD, 1);
        item.setDisplayname("CoOL BREAD");
        item.setLore(Arrays.asList("Line 1", "Line 2", "Line 3"));
        item.addEnchantment(Enchantment.DAMAGE_ALL, 10, false); //false = Allow Unsafe Enchantment

        ItemStack i = item.build();

        //OR YOU CAN USE IT THIS WAY

        ItemStack it = new ItemBuilder(Material.BREAD, 1)
                .setDisplayname("CoOL BREAD")
                .setLore(Arrays.asList("Line 1", "Line 2", "Line 3"))
                .addEnchantment(Enchantment.DAMAGE_ALL, 10, false)
                .build();

        //ITS SHORTER NOW
MySQL

First you need a static Database in your Main class.

static Database database;

Now you initialize the Database

public void onEnable() {

        database = new MySQL(hostname, port, database, username, password);

}

Now u can access your MySQL Database easy with

try {
            database.updateSQL("MySQL COMMAND");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

Or if u need a ResultSet easy use

ResultSet query =
                  database
                      .querySQL("MySQL COMMAND");
Packets

Not Supported anymore

Particles

This is a little Particle API

Single Effect
SingleEffect effect = new SingleEffect(PLUGIN);

    effect.setTicks(10); //IN TICKS
    effect.setDelay(20); //DELAY TO WAIT BEFORE PARTICLE SHOW
    effect.setEffect(Effect.FLAME);
    effect.setPeriod(10); //THIS MEANS THE PARTICLE WILL SHOW 10 TIMES! DEFAULT -1
    effect.attachToEntity(ENTITY); //THIS WILL ATTACH THE EFFECT TO AN ENTITY
    effect.setLocation(LOCATION); //THIS SETS THE LOCATION OF THE EFFECT

    effect.start(); //THIS STARTS THE EFFECT

    effect.cancel(); //THIS CANCEL THE EFFECT
Line Effect
LineEffect effect = new LineEffect(PLUGIN);
        effect.setEffect(Effect.FLAME);
        effect.setStartLocation(LOCATION);  //SETS THE START LOCATION OF THE LINE
        effect.setEndLocation(LOCATION); //SETS THE END LOCATION OF THE LINE
        effect.setDisplayRadius(30); //WILL SHOW for 30 BLOCKS
        effect.start();
Scheduler
new Scheduler() {
    
            @Override
            public void runTask() {
                //DO STUFF
        
            }
        }.start(initialDelay, period, TIMEUNIT);

Similar projects

Plugin →