ProtocolLib -Error

Discussion in 'Plugin Development' started by CactusComboPvP, Sep 24, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    CactusComboPvP

    Okay, so I used this code:

    Code:java
    1. package me.cactuscombo.cmduhc.main;
    2.  
    3. import java.lang.reflect.InvocationTargetException;
    4.  
    5. import me.cactuscombo.cmduhc.extras.AutoSmeltL;
    6.  
    7. import org.bukkit.Bukkit;
    8. import org.bukkit.Location;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.event.Listener;
    13. import org.bukkit.plugin.java.JavaPlugin;
    14.  
    15. import com.comphenix.packetwrapper.Packet14SpawnNamedEntity;
    16. import com.comphenix.protocol.ProtocolLibrary;
    17.  
    18. public class Main extends JavaPlugin implements Listener{
    19. public void onEnable(){
    20.  
    21. getServer().getPluginManager().registerEvents(new AutoSmeltL(), this);
    22. getServer().getPluginManager().registerEvents(this, this);
    23. }
    24. @Override
    25. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    26. if(command.getName().equalsIgnoreCase("disguiseme")) {
    27. Location location = getServer().getWorld("world").getSpawnLocation();
    28. Packet14SpawnNamedEntity spawned = new Packet14SpawnNamedEntity(); //The packet
    29. spawned.setEntityID(12345); // This id has to be unique
    30. spawned.setPosition(location.toVector()); //Location where the fake player spawns
    31. spawned.setPlayerName("Notch"); //From this player the skin will be renderer!
    32. spawned.setYaw(location.getYaw());
    33. spawned.setPitch(location.getPitch());
    34. //This is very basic, you can set a bunch of more settings, if you want to know, you can tag me
    35. try {
    36. for (Player players : Bukkit.getOnlinePlayers()) {
    37. ProtocolLibrary.getProtocolManager().sendServerPacket(players, spawned.getHandle());
    38. }
    39. e.printStackTrace();
    40. }
    41. }
    42. return false;
    43. }
    44. }


    But every time I execute the command, I get an error on this line:
    Code:java
    1. Packet14SpawnNamedEntity spawned = new Packet14SpawnNamedEntity(); //The packet


    Also I'm using PacketWrapper

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  2. Offline

    Gerov

  3. Offline

    CactusComboPvP

    Gerov It's the same, I just forgot to mention in the original post.
     
Thread Status:
Not open for further replies.

Share This Page