public static boolean sendTitle( Player player, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub) { if (!get().isAvailable()) return false; try { // Fadein, stay, fadeout Object timesPacket = titlePacketConstructorTimes.newInstance( titleTimesEnum, null, ticksIn, ticksStay, ticksOut); sendPacket(player, timesPacket); if (titleMain != null) { // Title Object titleMainChat = toChatBaseComponent(titleMain); Object titleMainPacket = titlePacketConstructor.newInstance(titleMainEnum, titleMainChat); sendPacket(player, titleMainPacket); } if (titleSub != null) { // SubTitle Object titleSubChat = toChatBaseComponent(titleSub); Object titleSubPacket = titlePacketConstructor.newInstance(titleSubEnum, titleSubChat); sendPacket(player, titleSubPacket); } } catch (Exception ex) { MassiveCore.get().log(Txt.parse("<b>Sending title failed!")); ex.printStackTrace(); // So we failed, didn't work. return false; } // It worked. return true; }
public static void updateSoon(final HumanEntity human) { Bukkit.getScheduler() .scheduleSyncDelayedTask( MassiveCore.get(), new Runnable() { @Override public void run() { update(human); } }); }
public static boolean sendActionbar(Player player, String string) { if (!get().isAvailable()) return false; try { Object actionbar = toChatBaseComponent(string); Object chatPacket = chatPacketActionbarConstructor.newInstance(actionbar, (byte) 2); sendPacket(player, chatPacket); } catch (Exception ex) { MassiveCore.get().log(Txt.parse("<b>Sending actionbar failed!")); ex.printStackTrace(); // So we failed and it didn't work. return false; } return true; }