Albert3069

수정한 온조인

Feb 9th, 2020
116
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.  
  18.     public PlayerJoinEvent(Player who) {
  19.         super(who);
  20.         // TODO Auto-generated constructor stub
  21.     }
  22.  
  23.     public void sendTitle(Player player, String title, int FadeInTime, int ShowTime, int FadeOutTime)
  24.     {
  25.         CraftPlayer p = (CraftPlayer)player;
  26.         PlayerConnection c = p.getHandle().playerConnection;
  27.         IChatBaseComponent TitleText = ChatSerializer.a(title);
  28.         Packet<?> Length = new PacketPlayOutTitle(EnumTitleAction.TIMES, TitleText, FadeInTime*20, ShowTime*20, FadeOutTime*20);
  29.         Packet<?> TitlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, TitleText, FadeInTime*20, ShowTime*20, FadeOutTime*20);
  30.         c.sendPacket(TitlePacket);
  31.         c.sendPacket(Length);
  32.     }
  33.    
  34.     public void onJoin(PlayerJoinEvent e){
  35.  
  36.     }
  37.  
  38.     @Override
  39.     public HandlerList getHandlers() {
  40.         // TODO Auto-generated method stub
  41.         return null;
  42.     }
  43. }
RAW Paste Data