Jump to content

Recommended Posts

Posted

I've started to use variables to store information about players.

 

Example:

 

 

if (event.entity instanceof EntityPlayer) {

EntityPlayer player = (EntityPlayer) event.entity;

if(event.entity.isWet()) {

int watersealing = MageniteIngotItem.watersealing;

if(watersealing <= 0) {

event.entity.attackEntityFrom(DamageSource.drown, 1.0F);

} else {

--watersealing;

MageniteIngotItem.watersealing = watersealing;

if(watersealing == 200) {

player.addChatMessage(new ChatComponentText("5 Seconds left of WaterSealing."));

}

if(watersealing == 50) {

player.addChatMessage(new ChatComponentText("1 Second left of WaterSealing!"));

}

}

}

 

 

 

However the problem with this code is that it's obviously a global variable that applies to everyone.

 

And I would like each player to have their own value for this variable.

What would I need to do make this individual to each player?

 

And what is the best way to store info for this kind of thing?

 

Would I use the player file for this or is there a way to write a file of my own?(I plan on eventually storing a fairly good chunk of info.)

I'm not trying to be rude it just comes out that way sometimes.

I'm here to try and learn as much as I can, won't you join me?

Posted

Thank you that's much appreciated. :)

I'm not trying to be rude it just comes out that way sometimes.

I'm here to try and learn as much as I can, won't you join me?

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.