Jump to content

Recommended Posts

Posted

Hello everyone,

 

  I am trying to do a packet for a bukkit server, but i cant send it on the vanilla ... I followed the Wiki tutorial about making Packet.

Mine is supposed to send a String when entering a World Guard region, but i need to try if it works before start modding Bukkit, so in a onItemUse, i wrote this:

PacketRegionHandler pack = new PacketRegionHandler(MessagesPacket.messageVille);
    	Packet250CustomPayload packet = pack;
    	PacketDispatcher.sendPacketToPlayer(packet, (Player)par2EntityPlayer);

but i have an error where its underlined. I cant cast a PacketRegionHandler to a Packet250CustomPayload, so how am i supposed to do?

 

Thanks,

Posted

i dont understand you are trying to make a packet for mcpc bukkit or normal bukkit?, because the normal bukkit dont have the Packet250CustomPayload.

Its a forge packet, and you need a packet handler to use him.

I dont know if this will work..

 

 

PacketRegionHandler pack = new PacketRegionHandler(MessagesPacket.messageVille);

    Packet250CustomPayload packet = (Packet250CustomPayload )pack;

    PacketDispatcher.sendPacketToPlayer(packet, (Player)par2EntityPlayer);

 

 

if that dont work(im not good with bukkit and packet stuff), you can try

 

 

Iterator iterator = MinecraftServer.getServer().configManager.playerEntities.iterator();

 

while (iterator.hasNext())

{

        Object obj = iterator.next();

        if ((obj instanceof EntityPlayer) && !((EntityPlayerMP)obj).username.isEmpty())

        {

                EntityPlayerMP pmp = (EntityPlayerMP)obj;

                pmp.addChatMessage(string here);

        }

}

 

 

as far i know entityplayer its entityhuman in bukkit (just change), but if you will make a version of this mod for vannila just use packet handler, there is some tutorials on the wiki, also a lot of things are obfuscated on bukkit, so the best way its do directly for bukkit and ask for help in the bukkit forums.

Posted

Now, i'm trying to make it in SP / SMP, and then i will do it with MCPC

I cant send it from vanilla server

And i cant cast the PacketHandler in any other kind of packet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.