Jump to content

Recommended Posts

Posted

I'm hardly on skype anymore, pm me your skype id tho, I forgot it.

 

Also one thing I noticed was you're using a lot of static variables inside your code. (all these 'static' declarations can and should be removed)

	private static final int _Baium = 29020;
private static final int _Antharas = 29068;
private static final int _Valakas = 29028;
private static final int _AntQueen = 29001;
private static final int npcid = 36650; // npc id
private static final boolean EnableObservation = true; // Set it true to allow players to observe raidbosses
private static final boolean EnableTeleport = true; // Set it true to allow players to teleport to raidbosses
private static final int ObservationAdena = 5000;  
private static String htm = "data/scripts/custom/RaidObserver/1.htm"; //html location

 

You only need to use static variables/methods when calling them from another class or instance . Like if you were trying to access methods or a variables like '_Baium' from a different class. It is highly recommended to not use static when not needed.

 

Let's say you had another java like this, and wanted to call things from 'RaidObserver' in RaidObserver2, you would use static variables/methods in RaidObserver and call them like this in RaidObserver2:

 

public class RaidObserver2 extends Quest
{
private final int _Baium2 = RaidObserver._Baium;


public RaidObserver2(int questId, String name, String descr)
{
}

 

If "_Baium" isn't static in RaidObserver.java then it would error, not being able to access/find it.

It's sorta like a "global" variable or method, static.

For a good explanation, one of the simplest I could find, read this. http://www.leepoint.net/notes-java/flow/methods/50static-methods.html

Posted

I'm hardly on skype anymore, pm me your skype id tho, I forgot it.

 

Also one thing I noticed was you're using a lot of static variables inside your code. (all these 'static' declarations can and should be removed)

	private static final int _Baium = 29020;
private static final int _Antharas = 29068;
private static final int _Valakas = 29028;
private static final int _AntQueen = 29001;
private static final int npcid = 36650; // npc id
private static final boolean EnableObservation = true; // Set it true to allow players to observe raidbosses
private static final boolean EnableTeleport = true; // Set it true to allow players to teleport to raidbosses
private static final int ObservationAdena = 5000;  
private static String htm = "data/scripts/custom/RaidObserver/1.htm"; //html location

 

You only need to use static variables/methods when calling them from another class or instance . Like if you were trying to access methods or a variables like '_Baium' from a different class. It is highly recommended to not use static when not needed.

 

Let's say you had another java like this, and wanted to call things from 'RaidObserver' in RaidObserver2, you would use static variables/methods in RaidObserver and call them like this in RaidObserver2:

 

public class RaidObserver2 extends Quest
{
private final int _Baium2 = RaidObserver._Baium;


public RaidObserver2(int questId, String name, String descr)
{
}

 

If "_Baium" isn't static in RaidObserver.java then it would error, not being able to access/find it.

It's sorta like a "global" variable or method, static.

For a good explanation, one of the simplest I could find, read this. http://www.leepoint.net/notes-java/flow/methods/50static-methods.html

 

Thanks for the lesson Doug. However, this code could be done easier, without use so much methods. I did it like this, because i think that people can understand it more, than make them all in 1 method :P

So if ppl understand how the code works, they can add their own things.

 

Work 100%  thx for the share

 

Good job !

Thank you too

  • 4 weeks later...

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.


×
×
  • Create New...