BarAPI

BarAPI

Server Owners

This plugin does nothing on its own. It is simply an API for other plugins to implement with.

Developers

Simply add BarAPI.jar to your project build path.

This plugin makes use of reflection and therefore "shouldn't" break on craftbukkit updates.

Limitations

The message can not be more than 64 characters. If it is more, BarAPI will automatically cut it to 64 characters to prevent the client from crashing.

This is a client limitation and cannot be changed.

Examples

BarAPI.setMessage(Player player, String message)

Set a message for the player. It will remain there until the player logs off or another plugin overrides it.

BarAPI.setMessage(Player player, String message, float percent)

Same as above except you can set the % of the health bar. 100 shows the entire health bar, 50 shows half the health bar and so on.

BarAPI.setMessage(final Player player, String message, int seconds)

Sets a timed message for the player. It will remain until the timer runs out. The health automatically reduces based on how long the timer is.

BarAPI.hasBar(Player player)

Pretty self explanatory, returns a boolean.

BarAPI.removeBar(Player player)

Also pretty self explanatory.

BarAPI.setHealth(Player player, float percent)

Allows you to modify the health of an existing bar. If the player has no bar, this does nothing.

Tutorials

German - DerFeliix

Source

GitHub

Maven

<repositories>
	<repository>
		<id>confuser-repo</id>
		<url>http://ci.frostcast.net/plugin/repository/everything</url>
	</repository>
</repositories>

<dependencies>
	<dependency>
		<groupId>me.confuser</groupId>
		<artifactId>BarAPI</artifactId>
		<version>3.0</version>
	</dependency>
</dependencies>

Developer Builds

These builds have not been approved by BukkitDev staff, therefore, use at your own risk.

Frostcast CI

Updater

This plugin contains an auto updater which is enabled by default. If you do not wish to automatically download new updates, edit BarAPI/config.yml and set autoUpdate to false.

To Dos

  • Scroll messages if string is greater than 64 characters.

Plugins Using BarAPI

WelcomeBar

Parkour

QuickSupport

BossBroadcast

BossMessage

PvPGames Automated

BossEventScheduler

Infernal Mobs

MythicMobs

MultiKill

PlayerBoss

BossAds

Item Lore Stats

BossBarPro

VIPLobby

Battle Of Blocks

BossBroadcaster

SilkSpawners

BarJoin

JoinGlobalMessages

Metrics

To determine popularity and usage of BarAPI, plugin installs are automatically tracked by the Metrics plugin tracking system. Your Java version, OS, player count, server country location and plugin & server versions are collected. This is used to determine what environments are using the plugin to ensure full compatibility. This collection is anonymous. If you don't want this tracking, edit plugins/PluginMetrics/config.yml and set opt-out to true.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of LihPeu LihPeu Oct 29, 2014 at 16:50 UTC - 0 likes

    Please ensure you are using the latest patch of spigot and the latest build of BarAPI if your going to enable the config option "useSpigotHack: true".

    The LihP Network - pvp.lihp.us
    A Minecraft community since 2011

  • Avatar of koca2000 koca2000 Oct 28, 2014 at 14:03 UTC - 0 likes

    I have this problem too.

    Look at my projects Stopwatch Timer and FullDurability BFAK:90905446,739818bad8e825122856b8f7ba2b11c1fd126d9e1693cb9185418a27d249984d

  • Avatar of Tomas325 Tomas325 Oct 26, 2014 at 23:08 UTC - 0 likes

    Yes, I have a same problem, as lucasdidur has.

  • Avatar of relampagorojo93 relampagorojo93 Oct 26, 2014 at 17:35 UTC - 0 likes

    I changed the spigot hack to true, but the error is in the console.

  • Avatar of lucasdidur lucasdidur Oct 26, 2014 at 10:48 UTC - 1 like

    I got this error on last spigot patch, how I can fix?

    java.lang.NoSuchMethodException: net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport.<init>(int, int, int, int, byte, byte)

    BFAK:lucasdidur,87417,32aae222c3d1d7d49a46cbb126db1387820eae93c93b4fb9c4eb80ee5141a1f7

  • Avatar of LihPeu LihPeu Oct 25, 2014 at 18:22 UTC - 0 likes

    @Mineraftair: Go

    If you are using a spigot build then use the latest dev build of BarAPI and edit the BarAPI config like this:

    # Set to false to disable the auto updater
    autoUpdate: false
    testMode: false
    useSpigotHack: true
    
  • Avatar of Mineraftair Mineraftair Oct 25, 2014 at 09:06 UTC - 0 likes

    Hi,

    I´m using your API for my plugin, and I like it! But, can you please make your Updater stop Spamming Errors in my log? I know that Bukkitdev is down because of an DMCA. So please correct that! Thanks!

    Yours Minecraftair

  • Avatar of Difd9 Difd9 Oct 19, 2014 at 23:44 UTC - 0 likes

    @confuserr perhaps this may be of use... I hear a lot of people say it crashes their servers I have yet to try it https://github.com/mgone2010/BossbarAPI EDIT: Ok although it may help you it only takes 2 seconds to see how unstable the plugin is

    Last edited Oct 19, 2014 by Difd9
  • Avatar of Bars96 Bars96 Oct 19, 2014 at 22:29 UTC - 0 likes

    Bars not shown to players. My code:

    public final class OnlyCore extends JavaPlugin {
    	public static OnlyCore plugin;
    	boolean barapi = false;
    	long time = 0;
    	int mes = 0;
    
    	public void onEnable() {
    		try {
    			loadConfiguration();
    		} catch (IOException e) {
    			getLogger().info("[OnlyCore] Can't load config");
    		}
    
    		setupBarAPI();
    
    		if ((barapi) && (time >= 60L) && (tips.size() > 0)) {
    			getLogger().info("Loaded "+tips.size()+" messages to bar");
    			Bukkit.getServer().getScheduler().runTaskTimer(this, new Runnable() {
    				@Override
    				public void run() {
    					int length = tips.size();
    					String msg = ChatColor.translateAlternateColorCodes('&', tips.get(mes));
    					for (Player p : Bukkit.getServer().getOnlinePlayers()) {
    						msg = msg.replace("%p", p.getName());
    						BarAPI.setMessage(p, msg);
    						BarAPI.setHealth(p, (mes/length*100F));
    					}
    
    					if (mes == length) mes = 0;
    					else mes++;
    				}
    			}, 20L, time);
    		}
    	}
    
    	public void onDisable() {
    	}
    
    	public void loadConfiguration() throws IOException {
    		File cfgFile = new File(this.getDataFolder() + File.separator + "config.yml");
    		YamlConfiguration config = YamlConfiguration.loadConfiguration(cfgFile);
    		if (barapi) {
    			tips.addAll(config.getStringList("tips.messages"));
    			time = config.getInt("tips.time") * 20L;
    		}
    	}
    
    	private void setupBarAPI() {
    		if (Bukkit.getServer().getPluginManager().isPluginEnabled("BarAPI")) {
    			barapi = true;
    			getLogger().info("BarAPI found, hooked");
    		}
    	}
    }
    
  • Avatar of Difd9 Difd9 Oct 19, 2014 at 18:00 UTC - 0 likes

    Humm well could you at least post the version on Jenkins

Facts

Date created
Sep 01, 2013
Category
Last update
Apr 19, 2014
Development stage
Release
License
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Curse link
BarAPI
Downloads
317,822
Recent files

Authors