Albert3069

Untitled

Feb 10th, 2020
150
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.first.testpl;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.player.PlayerJoinEvent;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. import net.minecraft.server.v1_12_R1.PacketPlayOutTitle;
  13. import net.minecraft.server.v1_12_R1.IChatBaseComponent.ChatSerializer;
  14. import net.minecraft.server.v1_12_R1.PacketPlayOutTitle.EnumTitleAction;
  15.  
  16. public class Main extends JavaPlugin implements Listener{
  17.     @Override
  18.     public void onEnable(){
  19.         Bukkit.getConsoleSender().sendMessage(ChatColor.BLUE + "플러그인이 활성화 되었습니다.");
  20.         getCommand("test").setExecutor(new Cmd());
  21.         getCommand("test2").setExecutor(new Cmd());
  22.         loadConfig();
  23.         getServer().getPluginManager().registerEvents((Listener) this, this);
  24.  
  25.     }
  26.    
  27.     private void loadConfig() {
  28.         getConfig().options().copyDefaults(true);
  29.         saveConfig();
  30.     }
  31.    
  32.     @Override
  33.     public void onDisable(){
  34.         Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "플러그인이 비활성화 되었습니다.");
  35.     }
  36.     @EventHandler
  37.         public void onJoin(PlayerJoinEvent event){
  38.             Player player = event.getPlayer();
  39.             PacketPlayOutTitle title = new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR,
  40.                     ChatSerializer.a("{\"text\":\"§a안녕하세요.\"}"),100,20,20);     
  41.             ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
  42.         }
  43.     }
RAW Paste Data