Java Errors

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

Moderators: Lapo, Bax

Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

Java Errors

Postby Ninjaoninja2 » 30 Sep 2016, 07:09

Hey there,

I've been working tirelessly night to morning trying to get several java errors to go away I've gotten all but one to go away this one I don't see listed on the Forums anywhere so here it goes; I have an Extension using the Login Assistant Component, I've combined several methods from the docs to ensure safety and moderation capabilities for my game, however I keep getting an error similar to this:

Code: Select all

Exception: com.smartfoxserver.v2.exceptions.SFSException
Message: Extension creation failure: loginExtension - Extension does not implement ISFSExtension interface: loginExtension
Description: There were startup errors during the Zone Setup
Please connect via the AdminTool and correct the problem


I have no idea what it's telling me in the logs.

Here's my code from the Extension:

Code: Select all

import java.util.Arrays;

import com.smartfoxserver.v2.components.login.ILoginAssistantPlugin;
import com.smartfoxserver.v2.components.login.LoginAssistantComponent;
import com.smartfoxserver.v2.components.login.LoginData;
import com.smartfoxserver.v2.components.login.PasswordCheckException;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.extensions.ISFSExtension;
import com.smartfoxserver.v2.security.DefaultPermissionProfile;

public abstract class LoginExtension implements ISFSExtension {
private LoginAssistantComponent lac;
public void init()
{
   lac = new LoginAssistantComponent(this);
   //Configure The Component.
    lac.getConfig().loginTable = "users";
     lac.getConfig().userNameField = "userName";
     lac.getConfig().passwordField = "passWord";
     lac.getConfig().useCaseSensitiveNameChecks = true;
     lac.getConfig().extraFields = Arrays.asList("avatar", "isMod");
     lac.getConfig().customPasswordCheck = true;
}
public void execute(LoginData loginData) {
   ISFSObject fields = loginData.extraFields;
   
    String avatarPic = fields.getUtfString("avatar");
     boolean isMod = fields.getUtfString("isMod").equalsIgnoreCase("Y");
     
     loginData.session.setProperty("avatar", avatarPic);
    if (isMod)
         loginData.session.setProperty("$permission", DefaultPermissionProfile.MODERATOR);
}
}

class LoginPreProcess implements ILoginAssistantPlugin
{
    @Override
    public void execute(LoginData ld)
    {
        String clientPass = ld.clientIncomingData.getUtfString("passwd");
         
        // Let's see if the password from the DB matches that of the user
        if (!ld.password.equals(clientPass))
            throw new PasswordCheckException();
             
        // Success!
       
    }
}
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java Errors

Postby Lapo » 30 Sep 2016, 07:42

Hi,
use the SFSExtension class instead of implementing the top interface, which is what we suggest everywhere in our documentation:

    We provide two classes that work as the base type for your main Extension class: BaseSFSExtension and SFSExtension, both found under the com.smartfoxserver.v2.extensions package. The former is provided mainly for compatibility with SmartFoxServer PRO 1.x, while SFSExtension is the recommended class to extend in order to get the best of SFS2X.

http://docs2x.smartfoxserver.com/Develo ... extensions
http://docs2x.smartfoxserver.com/Develo ... ension-api

Also this video:
https://www.youtube.com/watch?v=nKGxhwJ0Ccc

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

Re: Java Errors

Postby Ninjaoninja2 » 30 Sep 2016, 08:33

Lapo wrote:Hi,
use the SFSExtension class instead of implementing the top interface, which is what we suggest everywhere in our documentation:

    We provide two classes that work as the base type for your main Extension class: BaseSFSExtension and SFSExtension, both found under the com.smartfoxserver.v2.extensions package. The former is provided mainly for compatibility with SmartFoxServer PRO 1.x, while SFSExtension is the recommended class to extend in order to get the best of SFS2X.

http://docs2x.smartfoxserver.com/Develo ... extensions
http://docs2x.smartfoxserver.com/Develo ... ension-api

Also this video:
https://www.youtube.com/watch?v=nKGxhwJ0Ccc

cheers

I'm still getting the same error.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java Errors

Postby Lapo » 30 Sep 2016, 09:18

Show me your Extension code, please.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 53 guests