@Override public void run() { if (messageIndex >= finalIndex) { Commons.getInstance().getThreadManager().cancelTask(taskId); return; } Player player = Players.getPlayer(playerId); if (messageCooldown.isOnCooldown(player)) { return; } try { String message = messages[messageIndex]; Chat.message(player, message); Sounds.playSound(player, sound); messageCooldown.setOnCooldown(player); messageIndex++; } catch (IndexOutOfBoundsException e) { Commons.getInstance() .debug( "Uh oh! Message index[" + messageIndex + "] doesn't exist!\n" + StringUtil.joinString(messages, "\n")); } }
public static void loadItem(File file) { String itemName = FilenameUtils.removeExtension(file.getName()); XmlItemStack item = null; try { item = serializer.read(XmlItemStack.class, file); } catch (Exception e) { e.printStackTrace(); } if (item == null) { return; } items.put(itemName, item.getItemStack()); Chat.debug( String.format( "Loaded item %s", StringUtil.joinString(Messages.itemInfo(item.getItemStack()), "\n", 0))); }