Solved Placing banner on top of player (like player stacking)

Discussion in 'Plugin Development' started by Larsn, Jul 20, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Larsn

    I currently run this code:
    Code:
    @EventHandler
        public void withFlagWalking(PlayerMoveEvent e){
                final Block block = e.getPlayer().getLocation().add(0,3,0).getBlock();
                final Player p = e.getPlayer();
                if(block.getType() != Material.STANDING_BANNER){
                    p.sendMessage(block.getType().toString());
                }
                if(block.getType() != Material.AIR){
                    return;
                }
                block.setType(Material.STANDING_BANNER);
                Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
                {
                    public void run()
                    {
                        block.getDrops().clear();
                        block.breakNaturally();
                    }
                }, 5*20L);
            return;
        }
    It works, but I only have 1 problem:
    The item of the banner keeps dropping. Is there anyway to cancel this?
     
  2. Offline

    AcePilot10

    Just set the players helmet to the banner :)
     
    Larsn and Konato_K like this.
  3. If that doesn't work you might be able to make it an entity and then set it as a passenger
     
  4. Offline

    Larsn

    Well this does work, but I want it slightly above the head is this possible with this method?

    Don't think you can convert it to an entity
     
  5. Offline

    AcePilot10

    @Larsn maybe make a runnable so every tick it gets teleport?
     
  6. Offline

    Larsn

    Well I don't want to make it a lagmachine.

    I like your method to make it in such a way that the helmet is the banner. But can't it be a bit higher above the head?
     
  7. Offline

    AcePilot10

    Not that i know of :/
     
  8. Offline

    Larsn

    Well I guess I have to try something with just teleporting it then. Will let know if I come across some more problems.
     
  9. @Larsn
    Maybe set something like an invisible armor stand as a player's passenger, and give that one a banner as hat
     
  10. Offline

    Larsn

    For anyone that's wondering:
    Both these options work. I went with the one I got from @AcePilot10 because with the option from @megamichiel it is hanging about 2 blocks above their head. It's not really looking that great.

    Thanks for your guys help!
     
  11. @Larsn
    You could make the armor stand small so it would be around 0.5 blocks above their head ;)
     
  12. Offline

    DoggyCode™

    How do you set a invisible armor stand!!??
     
  13. @DoggyCode™
    ArmorStand#setInvisible(true)
     
    DoggyCode™ likes this.
Thread Status:
Not open for further replies.

Share This Page