Git Product home page Git Product logo

Comments (13)

menacher avatar menacher commented on July 3, 2024

Here is the link to the Events class in the jetclient side which has LOG_IN event. Mostly you will find all event related stuff in the event package.
In one way jetclient having similar class as jetserver is misleading. I should actually have a common project which both jetclient and jetserver can use. But I created jetclient project so that it has minimum jar dependencies and size at client side.

from java-game-server.

nikolaykuz avatar nikolaykuz commented on July 3, 2024

Sorry, I do not understand how it would help me.

 ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(opCode, NettyUtils.writeStrings(refKey, userId, accessToken, firstName, lastName));

On LOG_IN attempt I send 5 parameters to the server. Server has to parse this message and accept or reject the client. Now reject is not possible since the server always accepts every client. And LOG_IN handler is implemented inside the library.

from java-game-server.

menacher avatar menacher commented on July 3, 2024

Sorry for closing issue, tried to reopen it and could not...:( I will look into and answer.

from java-game-server.

menacher avatar menacher commented on July 3, 2024

The LoginHandler has the following code

    public Player lookupPlayer(final ChannelBuffer buffer, final Channel channel)
    {
        Credentials credentials = new SimpleCredentials(buffer);
        Player player = lookupService.playerLookup(credentials);
        if(null == player){
            LOG.error("Invalid credentials provided by user: {}",credentials);
        }
        return player;
    }
    public void handleLogin(Player player,Channel channel)
    {
        if (null != player)
        {
            channel.write(NettyUtils
                    .createBufferForOpcode(Events.LOG_IN_SUCCESS));
        }
        else
        {
            // Write future and close channel
            closeChannelWithLoginFailure(channel);
        }
    }

So if you return a null from the lookup service its going to invalidate the player and close the connection. In the ZombieSpringConfig class you can see the LookupService being injected. Please use your own implementation here, the default SimpleLookupService does not care for credentials.

from java-game-server.

nikolaykuz avatar nikolaykuz commented on July 3, 2024

This is the message I have written before you last comment but did not post solving some other issue.

"No problem, you help me a lot!

I guess these lines of code are important to this task from LoginHandler.java

public Player lookupPlayer(final ChannelBuffer buffer, final Channel channel)
     {
          Credentials credentials = new SimpleCredentials(buffer);
          Player player = lookupService.playerLookup(credentials);

I need to override lookupService.playerLookup to return null if authorization fails.

BUT, I think it is much better to have this function
public abstract Player playerLookup(final ChannelBuffer buffer);
NOT
public abstract Player playerLookup(Credentials loginDetail);

so I will be able to parse ChannelBuffer by myself and not being stuck to SimpleCredentials."

from java-game-server.

nikolaykuz avatar nikolaykuz commented on July 3, 2024

So my advice is to add following method
public abstract Player playerLookup(final ChannelBuffer buffer)

My application would be authenticated with social network and client would submit 3 parameters to the server.

  1. social network id (facebook, vkontakte, twitter)
  2. user id
  3. access_token

Of course, I can combine 1) and 2) in one String and then parse it to make it work with currently library build.

from java-game-server.

menacher avatar menacher commented on July 3, 2024

Credentials ,interface was very simplistic hence you are running into this problem. Passing ChannelBuffer to a service is not a great idea, first of all it leaks and second the new netty version Netty 4 changes this and other interfaces drastically, so when jetserver updates to new version it will end up breaking the service interface also. It will be good if you can stick to overriding the lookupservice for the moment. I will log a feature request for revamping the credentials interface from the very simplistic one we have now.

from java-game-server.

nikolaykuz avatar nikolaykuz commented on July 3, 2024

Yes, this makes sense.
I will combine 1) and 2) in one string them.

from java-game-server.

nikolaykuz avatar nikolaykuz commented on July 3, 2024

In here why player is not used to create a playerSession?

public void handleGameRoomJoin(Player player, Channel channel, ChannelBuffer buffer)
    {
        String refKey = NettyUtils.readString(buffer);

        GameRoom gameRoom = lookupService.gameRoomLookup(refKey);
        if(null != gameRoom)
        {
            PlayerSession playerSession = gameRoom.createPlayerSession();

from java-game-server.

menacher avatar menacher commented on July 3, 2024

I have added an issue for this. I will update and provide code.

from java-game-server.

menacher avatar menacher commented on July 3, 2024

I have committed the change for this. Binaries are NOT updated, please build and use latest jetserver jar file.

from java-game-server.

nikolaykuz avatar nikolaykuz commented on July 3, 2024

I have imported the jetserver folder to Eclipse.

And these are two major types of errors I am getting.

Description Resource    Path    Location    Type
ArtifactDescriptorException: Failed to read artifact descriptor for cglib:cglib-nodep:jar:2.1_3: ArtifactResolutionException: Failure to transfer cglib:cglib-nodep:pom:2.1_3 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact cglib:cglib-nodep:pom:2.1_3 from/to central (http://repo1.maven.org/maven2): Connect times out  pom.xml /jetserver  line 1  Maven Dependency Problem
Description Resource    Path    Location    Type
Project 'jetserver' is missing required library: 'C:\Users\Nikolay\.m2\repository\backport-util-concurrent\backport-util-concurrent\3.1\backport-util-concurrent-3.1.jar'   jetserver       Build path  Build Path Problem

from java-game-server.

nikolaykuz avatar nikolaykuz commented on July 3, 2024

Was able to solve it using

http://stackoverflow.com/questions/2061094/importing-maven-project-into-eclipse
http://stackoverflow.com/questions/5074063/maven-problem-failure-to-transfer
http://stackoverflow.com/questions/7737710/maven-plugin-not-using-eclipses-proxy-settings

from java-game-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.