Solved HolographicDisplaysAPI

Discussion in 'Spigot Plugin Development' started by ThatGuyLogi, Jan 14, 2020.

Thread Status:
Not open for further replies.
  1. I need help with HDAPI. I have some code here that sets a chest with items in it on death but I cannot get HD to create a hologram above my chest.

    This is my main class
    Code (Text):

    package me.thatguylogi.chestdeathplus;

    import org.bukkit.Bukkit;

    public class Main extends JavaPlugin {
        public void onEnable(){
            DeathEvent event = new DeathEvent(this);
                getLogger().severe("*** Holographic displays not found! ***");
                getLogger().severe("*** This plugin will now disable! ***");

                    + " v1.0" + " has started!");
            getServer().getPluginManager().registerEvents(event, this);
    This is my DeathEvent class

    Code (Text):


    import me.thatguylogi.chestdeathplus.Main;
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.block.Block;
    import org.bukkit.block.Chest;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.Plugin;

    public class DeathEvent implements Listener {

        public Main main;
        public DeathEvent(Main main){
            this.main = main;

        public void onDeath(PlayerDeathEvent e){
            Player p = e.getEntity();
            Location deathLocation = p.getLocation();
            Block b = deathLocation.getBlock();
            //Death message
            e.setDeathMessage("You got rekt m8");
            Chest chest = (Chest) b.getState();
            Inventory chestInv = chest.getInventory();
            //For loop
            for (ItemStack itemStack : p.getInventory().getContents()){
                if(itemStack == null) return;
            Hologram hologram = HologramsAPI.createHologram(main, deathLocation.add(0, 6, 0));
            //Broadcast message
            Bukkit.broadcastMessage(p.getName() + " has died! A chest with their items has spawned!");
    And finally... my plugin.yml
    Code (Text):

    name: ChestDeathPlus
    main: me.thatguylogi.chestdeathplus.Main
    version: 1.0
    api-version: 1.13
      - HolographicDisplays
  2. This looks about right. Not sure if Player#getLocation() clones the player location.
    The lightning strikes?
    Any errors in the console?
  3. No lightning strike, no error in console. And to clone its Player#getLocation().clone()
  4. You do not have to use clone on the player's location, making changes to the object won't actually change the player's location
  5. No Lightning? Did you actually export and load this version?
    Write some debug messages scattered in your method and tell us when your code stops working.
    Does the event fire? Is the chest there?
  6. Yes the chest is there, I do not hear the lightning nor see the hologram
  7. Again... Debug the method and tell us where it stops.
  8. Update: Thread is SOLVED! Mods, close this please
Thread Status:
Not open for further replies.