Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. @EventHandler
  2. public void onFull(InventoryFullEvent e)
  3. {
  4. Player p = e.getPlayer();
  5.  
  6. if ((p == null) || (e.getItem() == null)) {
  7. return;
  8. }
  9.  
  10. IFOptions opt = getOptions();
  11.  
  12. String type = e.getItem().getType().name();
  13.  
  14. if (opt.useChatMsg()) {
  15. for (String line : opt.getChatMsg()) {
  16. sms(p, line.replace("%player%", p.getName()).replace("%block%", type));
  17. }
  18. }
  19.  
  20. if ((opt.useHolo()) && (this.holo != null)) {
  21. this.holo.send(p, opt.getHoloMsg(), type);
  22. }
  23.  
  24. if ((opt.useActionAnnouncer()) && (this.aa != null)) {
  25. this.aa.send(p, opt.getActionMsg(), type, opt.getActionTime());
  26. }
  27.  
  28. if ((opt.useTitleManager()) && (this.tm != null)) {
  29. this.tm.sendTitle(p, opt.getTitleMsg(),
  30. opt.getSubTitleMsg(), type, opt.getFadeIn(),
  31. opt.getDuration(), opt.getFadeOut());
  32. }
  33.  
  34. if ((opt.useTitleABar()) && (this.tm != null)) {
  35. this.tm.sendActionbar(p, opt.getTitleABarMsg(), type);
  36. }
  37.  
  38. if (!opt.useSound()) {
  39. return;
  40. }
  41.  
  42. try
  43. {
  44. Sound s = Sound.valueOf(getOptions().getSound().toUpperCase());
  45.  
  46. if (s != null)
  47. p.playSound(p.getLocation(), s, getOptions().getVolume(), opt.getPitch());
  48. }
  49. catch (Exception ex)
  50. {
  51. getLogger().warning("Your inventory full sound " + opt.getSound() + " is invalid!");
  52. getLogger().info("Valid sound names can be found at the following link:");
  53. getLogger().info("https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html");
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement