Giter VIP home page Giter VIP logo

ba-api's Introduction

BA-API

BossBarAPI, ActionBarAPI & TitleAPI for 1.8.X (Very Lightweight)

Maven Dependency

<repositories>
    <repository>
	<id>github</id>
	<url>https://maven.pkg.github.com/Posse-Plugins/BA-API</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
	<groupId>me.classy</groupId>
	<artifactId>ba-api</artifactId>
	<version>2.1</version>
    </dependency>
</dependencies>

Gradle Dependency

repositories {
	maven {
		url "https://maven.pkg.github.com/Posse-Plugins/BA-API"
	}
}
dependencies {
	implementation "me.classy:ba-api:2.1"
}

Usage/Examples

// BossBarAPI
BossBar bossBar = new BossBar("Hello World", 100); // Hello World bossbar with full health
bossBar.setColor("PURPLE"); // Purple color (default)
bossBar.setStyle("SOLID"); // Solid style (default)
bossBar.sendToPlayer(p); // Send to a player
bossBar.updateHealth(p, 50) // Changes the health to 50
bossBar.removeFromPlayer(p); // Remove from the player

// ActionBarAPI
ActionBar actionBar = new ActionBar("Hello World", 2000); // Hello World for 100 seconds
actionBar.sendToPlayer(p); // Send the actionbar to a specific player
actionBar.sendToAll(); // Send the actionbar to all the players online on the server

// TitleAPI
Title title = new Title();
title.sentToPlayer(p, "Hello World (Title)", "Hello World (Subtitle)", 10, 70, 20); // Hello World (title) and Hello World (subtitle) for 3.5 seconds (70 ticks)
title.sentToAll("Hello World (Title)", "Hello World (Subtitle)", 10, 70, 20); // Hello World (title) and Hello World (subtitle) for 3.5 seconds (70 ticks) to all players

// Example Command
package me.classy.baapi.commands;

import org.bukkit.entity.Player;
import org.bukkit.command.CommandSender;

import me.classy.baapi.commandsapi.BaseCommand;
import me.classy.baapi.utility.Util;

public class ECommand extends BaseCommand {
	
	public ECommand() {
		super("example", new String[]{"ex", "e"}, "I made this command for example, if you want to make a command then use this for example.", "/example <message> OR /ex <message> OR /e <message>", "e.command");
	}

	@Override
	public void execute(CommandSender sender, String[] args) {
		if (sender instanceof Player) {
			
			Player p = (Player) sender;
			
			if (args.length > 0) {
				String message = String.join(" ", args);
				p.sendMessage(Util.setColor("&b[TEST] &f" + message));
			} else {
				p.sendMessage(Util.setColor("&eUsage: &b" + getUsage()));
			}
		} else {
			sender.sendMessage("Nuh uh");
		}
	}
} // This is just an example on how you can create commands using our api.

Tested Versions

  • 1.8
    If you test it in other versions make a pull request. Please follow PULL_REQUEST.md.

Authors

Credits

ba-api's People

Contributors

classycoder1 avatar

Stargazers

 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.