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...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..