Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onFull(InventoryFullEvent e)
- {
- Player p = e.getPlayer();
- if ((p == null) || (e.getItem() == null)) {
- return;
- }
- IFOptions opt = getOptions();
- String type = e.getItem().getType().name();
- if (opt.useChatMsg()) {
- for (String line : opt.getChatMsg()) {
- sms(p, line.replace("%player%", p.getName()).replace("%block%", type));
- }
- }
- if ((opt.useHolo()) && (this.holo != null)) {
- this.holo.send(p, opt.getHoloMsg(), type);
- }
- if ((opt.useActionAnnouncer()) && (this.aa != null)) {
- this.aa.send(p, opt.getActionMsg(), type, opt.getActionTime());
- }
- if ((opt.useTitleManager()) && (this.tm != null)) {
- this.tm.sendTitle(p, opt.getTitleMsg(),
- opt.getSubTitleMsg(), type, opt.getFadeIn(),
- opt.getDuration(), opt.getFadeOut());
- }
- if ((opt.useTitleABar()) && (this.tm != null)) {
- this.tm.sendActionbar(p, opt.getTitleABarMsg(), type);
- }
- if (!opt.useSound()) {
- return;
- }
- try
- {
- Sound s = Sound.valueOf(getOptions().getSound().toUpperCase());
- if (s != null)
- p.playSound(p.getLocation(), s, getOptions().getVolume(), opt.getPitch());
- }
- catch (Exception ex)
- {
- getLogger().warning("Your inventory full sound " + opt.getSound() + " is invalid!");
- getLogger().info("Valid sound names can be found at the following link:");
- getLogger().info("https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement