Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. @EventHandler
  2. public void debug(PlayerInteractAtEntityEvent event) {
  3. System.out.println(event.getRightClicked().getEntityId() + " Passengers: " + event.getRightClicked().getPassengers().size());
  4. }
  5.  
  6. @EventHandler
  7. public void onChunkLoad(ChunkLoadEvent event) {
  8. for (Entity entity : event.getChunk().getEntities()) {
  9. if (!(entity instanceof LivingEntity) || entity.getType() == EntityType.PLAYER)
  10. continue;
  11.  
  12. LivingEntity living = (LivingEntity) entity;
  13.  
  14. Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
  15. PhoenixInfoBar bar = this.manager.createInfoBar(entity);
  16. bar.addLine(PhoenixAPI.get().getLanguageHelper().getEntityName(entity), InfoLineSpacing.MEDIUM);
  17. bar.addLine("Leben: " + living.getHealth(), InfoLineSpacing.SMALL);
  18.  
  19. }, 1L);
  20. }
  21.  
  22. }
  23.  
  24. @EventHandler
  25. public void onEntitySpawn(CreatureSpawnEvent event) {
  26. LivingEntity entity = event.getEntity();
  27.  
  28. Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
  29.  
  30. PhoenixInfoBar bar = this.manager.createInfoBar(entity);
  31. bar.addLine(PhoenixAPI.get().getLanguageHelper().getEntityName(entity), InfoLineSpacing.MEDIUM);
  32. bar.addLine("Leben: " + entity.getHealth(), InfoLineSpacing.SMALL);
  33. }, 1L);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement