Skip to content

Latest commit

 

History

History
96 lines (71 loc) · 2.99 KB

README.md

File metadata and controls

96 lines (71 loc) · 2.99 KB

GlowAPI

Build Status Latest release GitHub contributors License

This API allows you to change the glow-color of entities and players.

Depends on ProtocolLib.

Versions 1.4.11 and below depended on PacketListenerAPI instead.

API versions 1.4.11 and below are also compatible with APIManager.

Version 1.4.7 is intended for 1.13+ only. For older MC versions, please use 1.4.6.

Usage

import org.bukkit.Bukkit;
import org.bukkit.event.player.PlayerJoinEvent;
import org.inventivetalent.glow.GlowAPI;

public class PlayerJoinListener implements Listener {

    @EventHandler
    public void onPlayerJoin(final PlayerJoinEvent event) {

        //Delay the update by a few ticks until the player is actually on the server
        Bukkit.getScheduler().runTaskLater(this, () -> {

            //Set the event's player glowing in DARK_AQUA for all online players
            GlowAPI.setGlowing(event.getPlayer(), GlowAPI.Color.DARK_AQUA, Bukkit.getOnlinePlayers());
            
        }, 10);

    }

}
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.inventivetalent.glow.GlowAPI;

public class MyClass {

    public static void myMethod(Entity entity, Player player) {
        if (GlowAPI.isGlowing(entity, player)) {
            System.out.println("The entity is glowing for the player.");
        }
    }

}
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.inventivetalent.glow.GlowAPI;

public class MyClass {

    public static void myMethod(Collection<Entity> entities, Collection<Player> players) {
        CompleteableFuture<Void> future = GlowAPI.setGlowingAsync(entities, GlowAPI.Color.DARK_AQUA, players);

        // Do some other work while that executes in the background

        future.join(); //Wait for glowing to be set
    }

}

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.github.metalshark</groupId>
        <artifactId>GlowAPI</artifactId>
        <version>2.0.0</version>
    </dependency>
</dependencies>