Classes between Extensions

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
2morrowMan
Posts: 8
Joined: 04 May 2009, 21:27
Contact:

Classes between Extensions

Post by 2morrowMan »

Hello!

I have read a lot information about horribe Class Loader and want to ask advice about SFS2X.

I have GameZoneExtension.
And FightExtension - game room extension.

When user connects and login to GameZoneExtension it loads from DB information about user character and creates instance of GameCharacter class and fill it with loaded info.

Each new room with FightExtension should be able to get every user GameCharacter instance from GameZoneExtension.

So I should put jar with GameZoneExtension and FightExtension {SFS2X-DIR}/SFS2X/extensions/game/ and jar with GameCharacter to {SFS2X-DIR}/SFS2X/extensions/__lib__/. Am I right?

And every time I changed GameCharacter (or any other model class) I should restart SFS2X to apply changes?

P.S. So what for extension auto reloading? For simple server-side projects?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

The idea is explained in the docs here:
http://docs2x.smartfoxserver.com/Advanc ... extensions

In order to share data across extensions that are segregated in terms of class loading, you should put your Model interfaces in the lib/ folder and always work with those interfaces.
Extensions should be kept in extension/ folder otherwise the reloading won't work.
Lapo
--
gotoAndPlay()
...addicted to flash games
2morrowMan
Posts: 8
Joined: 04 May 2009, 21:27
Contact:

Post by 2morrowMan »

Thanks for the answer! :)
Post Reply