Jump to content

[Solved]PlayerInteractEvent SMP compatible?


Recommended Posts

Posted

Hi,

 

Ive made a mod which is meant as a customized creative mode in survival. The thought is that certain blocks are free to use and you dont run out of them.

The mod works fine in single player and on lan play, but when used in smp the game crashes instantly when the player right clicks, the reason given is genericreason.

 

I assume this is due to not being handled properly from a SMP perspective?

How should I fix this? Packets?

 

here is the mod class code:

 

  Reveal hidden contents

 

Posted

Bah, sorry my mistake. :)

 

here is the crash message from the client:

 

 

  Reveal hidden contents

 

 

 

 

 

the forgelog from the client:

 

  Reveal hidden contents

 

 

 

 

here is the forgelog from the server(from startup to crash):

 

  Reveal hidden contents

 

Posted

Something's null that shouldn't be in your PlayerInteractEvent handler

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

  Reveal hidden contents

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Posted

Hmmm, does player exist on server?(EntityPlayer)

 

Just to make sure:

 

With PlayerInteractEvent handler, you are refering to my getBlockUse method right?

Posted

I fixed it :)

 

For anyone who was wondering: It works indeed in SMP, it was just idiot me testing a value that can be null, so I just wrapped the if statement in a try & check if the variable was null. the try was probably not needed(didnt get any exceptions in the log atleast), but good to have anyways :P

 

It was abit strange that it happened nonetheless, because it crashed even if the variable would have a value. I guess its a safety measure somewhere.

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.