'unknown' at BossBar

Discussion in 'Spigot Plugin Development' started by trikeyyy, Mar 31, 2016.

  1. Hey folks

    I noticed that my custom withers have their own custom name but the name isn't applied to the bossbar though.
    Is this a bug ?
    [​IMG]
    (http://imgur.com/7hSrUvg)

    I appreciate any help
    Greetings trikeyyy
     
  2. Ehm, I guess you're naming your withers "unknown"?
    Any errors in console?
     
  3. Can you show us the code you use to name the custom withers? Are you using Spigot 1.9? It has a new BossBar interface
     
    • Like Like x 1
  4. I'm using 1.9

    How do I apply the BossBar Interface to a wither ?

    My custom class
    Code (Text):
    public class CustomQueen extends EntityWither {

        public CustomQueen(World world, Location location, String displayname) {
            super(world);
            setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
            setCustomName(Utils.color(displayname));
            setCustomNameVisible(true);

            ((LivingEntity)getBukkitEntity()).setAI(false);
        }

        @Override
        protected void dropDeathLoot(boolean flag, int i) {
            super.dropDeathLoot(false, 0);
        }

        @Override
        protected void dropEquipment(boolean flag, int i) {
            super.dropEquipment(false, 0);
        }

        @Override
        public void move(double d0, double d1, double d2) {
            super.move(0, 0, 0);
        }

        @Override
        protected float h(float f, float f1) {
            return super.h(0, 0);
        }

        @Override
        public void h(boolean flag) {
            super.h(false);
        }

        @Override
        public void e(float f, float f1) {
            super.e(0F, 0F);
        }

        @Override
        public void collide(Entity entity) {

        }

        @Override
        public void m() {

        }

        @Override
        public double e(double d0, double d1, double d2) {
            return super.e(0, 0, 0);
        }

        @Override
        public void g(double d0, double d1, double d2) {
            super.g(0, 0, 0);
        }


        public Object getPrivateField(String fieldName, Class clazz, Object object) {
            Field field;
            Object o = null;

            try {
                field = clazz.getDeclaredField(fieldName);

                field.setAccessible(true);

                o = field.get(object);
            }
            catch(NoSuchFieldException e) {
                e.printStackTrace();
            }
            catch(IllegalAccessException e) {
                e.printStackTrace();
            }
            return o;
        }
    }
     
  5. Can you try using:
    Code (Text):
        this.setCustomName(displayname);
        this.setCustomNameVisible(true);
    instead?
     
  6. Doesn't work.

    @DarkSeraphim How do you apply the Bossbar to a mob or how do you remove the current one ?
     
  7. @DarkSeraphim I think @trikeyyy just wants to spawn a custom boss, which already has the bossbar applied to it.

    @trikeyyy if I'm right, could you print the "displayname" variable to the console?
     
  8. It has been working before updating the plugin to the 1.9
     
  9. I sence that something is null, and the game therefore displays the default rescue name: 'Unknown'.
     
  10. Any other solutions ?
     
  11.  
  12. @trikeyyy
    Neither the client, nor the server defaults to "unknown" when no message is specified (after searching for the magic word through both sources). Somewhere in your code, something isn't right
     
    • Agree Agree x 1
  13. I agree, it would default to null wouldn't it?

    We will likely need to see full classes. https://gist.github.com/ is a good place, it will colour code your code for you and if you have an account, you can take them down after you find the problem.
     
  14. @trikeyyy we've seen that class. We (at least I) don't believe that you set the names properly