Albert3069

Untitled

Feb 9th, 2020
204
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.first.testpl;
  2.  
  3. import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.event.HandlerList;
  6. import org.bukkit.event.player.PlayerEvent;
  7.  
  8. import net.minecraft.server.v1_12_R1.IChatBaseComponent;
  9. import net.minecraft.server.v1_12_R1.IChatBaseComponent.ChatSerializer;
  10. import net.minecraft.server.v1_12_R1.Packet;
  11. import net.minecraft.server.v1_12_R1.PacketPlayOutTitle;
  12. import net.minecraft.server.v1_12_R1.PacketPlayOutTitle.EnumTitleAction;
  13. import net.minecraft.server.v1_12_R1.PlayerConnection;
  14.  
  15. public class PlayerJoinEvent extends PlayerEvent
  16. {
  17.     public void onJoin(PlayerJoinEvent e){
  18.         public void sendTitle(Player player, String title, int FadeInTime, int ShowTime, int FadeOutTime)
  19.         {
  20.             CraftPlayer p = (CraftPlayer)player;
  21.             PlayerConnection c = p.getHandle().playerConnection;
  22.             IChatBaseComponent TitleText = ChatSerializer.a(title);
  23.             Packet<?> Length = new PacketPlayOutTitle(EnumTitleAction.TIMES, TitleText, FadeInTime*20, ShowTime*20, FadeOutTime*20);
  24.             Packet<?> TitlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, TitleText, FadeInTime*20, ShowTime*20, FadeOutTime*20);
  25.             c.sendPacket(TitlePacket);
  26.             c.sendPacket(Length);
  27.         }
  28.  
  29.     }
  30.    
  31. }
RAW Paste Data