Icarus (Production) - Java Server [MySQL, Netty]

Page 1 of 19 12345678911 ... LastLast
Results 1 to 15 of 274
  1. #1
    Moderator Quackster is online now
    ModeratorRank
    Dec 2010 Join Date
    AustraliaLocation
    3,052Posts

    Icarus (Production) - Java Server [MySQL, Netty]


    RaGEZONE Recommends

    RaGEZONE Recommends

    Icarus

    Icarus is a server which is emulating the most recent version of Habbo. It's programmed in Java 1.8. The server aims at minimising memory leaks, easy to maintain and expand upon and to maximise the server uptime/stability.

    All files which access and query the database are called data access objects (DAO) and they have been completely separated from the rest of the server, and the only calls to the database are forced through the data access objects.

    This server is created by me and built from the ground up, it is not based on any previous servers

    Open-source

    Yes, this project is open source, the stable source can code can be located at:

    https://github.com/TheAmazingAussie/Icarus

    (All pull requests will be rejected while this project is in alpha and beta stage).

    Code Snippet

    Example of the database access separated from the main project.

    Spoiler:
    Code:
    package org.alexdev.icarus.dao.mysql;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    
    import org.alexdev.icarus.game.player.PlayerDetails;
    import org.alexdev.icarus.game.player.PlayerManager;
    import org.alexdev.icarus.game.player.Player;
    import org.alexdev.icarus.log.Log;
    
    public class PlayerDao {
    
    	public static PlayerDetails getDetails(int userId) {
    
    		PlayerDetails details = new PlayerDetails(null);
    		Player player = PlayerManager.findById(userId);
    
    		if (player != null) {
    			details = player.getDetails();
    		} else {
    
    			Connection sqlConnection = null;
    			PreparedStatement preparedStatement = null;
    			ResultSet resultSet = null;
    
    			try {
    
    				sqlConnection = Dao.getStorage().getConnection();
    				
    				preparedStatement = Dao.getStorage().prepare("SELECT id, username, rank, sso_ticket, mission, figure, credits FROM users WHERE id = ? LIMIT 1", sqlConnection);
    				preparedStatement.setInt(1, userId);
    				
    				resultSet = preparedStatement.executeQuery();
    
    				if (resultSet.next()) {
    					fill(details, resultSet);
    				}
    
    			} catch (Exception e) {
    				Log.exception(e);
    			} finally {
    				Storage.closeSilently(resultSet);
    				Storage.closeSilently(preparedStatement);
    				Storage.closeSilently(sqlConnection);
    			}
    		}
    
    		return details;
    	}
    
    	public static boolean login(Player player, String ssoTicket) {
    		
    	    boolean success = false;
    	    
    		Connection sqlConnection = null;
    		PreparedStatement preparedStatement = null;
    		ResultSet resultSet = null;
    
    		try {
    
    			sqlConnection = Dao.getStorage().getConnection();
    			preparedStatement = Dao.getStorage().prepare("SELECT id, username, rank, sso_ticket, mission, figure, credits FROM users WHERE sso_ticket = ? LIMIT 1", sqlConnection);
    			preparedStatement.setString(1, ssoTicket);
    			
    			resultSet = preparedStatement.executeQuery();
    
    			if (resultSet.next()) {
    				fill(player.getDetails(), resultSet);
    				success = true;
    			}
    
    		} catch (Exception e) {
    			Log.exception(e);
    		} finally {
    			Storage.closeSilently(resultSet);
    			Storage.closeSilently(preparedStatement);
    			Storage.closeSilently(sqlConnection);
    		}
    
    		return success;
    	}
    
    	public static int getId(String username) {
    
    	    int id = -1;
    	    
    		Connection sqlConnection = null;
    		PreparedStatement preparedStatement = null;
    		ResultSet resultSet = null;
    
    		try {
    
    			sqlConnection = Dao.getStorage().getConnection();
    			preparedStatement = Dao.getStorage().prepare("SELECT id FROM users WHERE username = ? LIMIT 1", sqlConnection);
    			preparedStatement.setString(1, username);
    			
    			resultSet = preparedStatement.executeQuery();
    			
    			if (resultSet.next()) {
    				id = resultSet.getInt("id");
    			}
    		} catch (Exception e) {
    			Log.exception(e);
    		} finally {
    			Storage.closeSilently(resultSet);
    			Storage.closeSilently(preparedStatement);
    			Storage.closeSilently(sqlConnection);
    		}
    
    		return id;	
    	}
    	
    
        public static void save(PlayerDetails details) {
            
            Connection sqlConnection = null;
            PreparedStatement preparedStatement = null;
            ResultSet resultSet = null;
    
            try {
    
                sqlConnection = Dao.getStorage().getConnection();
                preparedStatement = Dao.getStorage().prepare("UPDATE users SET mission = ?, figure = ?, rank = ?, credits = ? WHERE id = ?", sqlConnection);
                preparedStatement.setString(1, details.getMission());
                preparedStatement.setString(2, details.getFigure());
                preparedStatement.setInt(3, details.getRank());
                preparedStatement.setInt(4, details.getCredits());
                preparedStatement.setInt(5, details.getId());
                preparedStatement.execute();
    
            } catch (Exception e) {
                Log.exception(e);
            } finally {
                Storage.closeSilently(resultSet);
                Storage.closeSilently(preparedStatement);
                Storage.closeSilently(sqlConnection);
            }
        }
    	
    	public static PlayerDetails fill(PlayerDetails details, ResultSet row) throws SQLException {
    		details.fill(row.getInt("id"), row.getString("username"), row.getString("mission"),  row.getString("figure"), row.getInt("rank"), row.getInt("credits"));
    		return details;
    	}
    }


    Features

    The current client version it's using is called PRODUCTION-201701242205-837386173 this includes the new loader and the new navigator which gives more customization on how you want your navigator displayed.

    • User
      • Login with SSO (single sign on) ticket
    • Navigator
      • View public spaces
      • View most popular rooms
      • View own rooms
    • Messenger
      • Search for users
      • Send a friend request
      • Accept friend request
      • Reject friend request
      • Send friend a message
      • Delete friend
      • Invite friend
      • Follow friend
    • Rooms
      • Create own room
      • Edit room details
      • Room entry
      • Delete room
      • Walking/pathfinding around items and users (if walking through people is ticked)
      • Place items
      • Rotate and move items
      • Pickup items
      • Sit on items
      • Interact with items
    • Inventory
      • Load floor items
      • Load wall items
      • Update inventory when a new item is purchased/picked up
      • Show new item in inventory once item is purchased/picked up
    • Catalogue
      • Catalogue tabs
      • Catalogue pages, visible depending on rank
      • Catalogue item discount
      • Purchase items


    Completed Interaction Types

    • Default
    • Vending
    • Gate


    Libraries

    - BoneCP (connection pooling)
    - Netty 3 (as an extension, can be easily switched out for a different library or one more up to date)
    - More libraries...

    Screenshots

    Spoiler:











    Credits

    - @Leon, giving me some help for fixing structures, etc.
    - @Glaceon, guidance on fixing client crash when item quantity is enabled on the catalogue.
    - @Sledmore, updated my headers for me.
    Last edited by Quackster; 14-05-17 at 12:44 AM.
    - Alex


  2. #2
    Moderator asesinato is offline
    ModeratorRank
    Aug 2014 Join Date
    612Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Approved. Good luck with your development.

  3. #3
    C# Programmer Jax is offline
    True MemberRank
    Dec 2009 Join Date
    1,073Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good luck my friend - this will be your magnum opus

  4. #4
    Demi-god. Dominic is offline
    SubscriberRank
    Aug 2012 Join Date
    DenmarkLocation
    564Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good luck bro! Welcome back! :3

  5. #5
    Banned rafa95123 is offline
    BannedRank
    May 2009 Join Date
    /home/RaphaLocation
    566Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good Luck man! Good to see you back :D

  6. #6
    Platina endorser SeanRog is offline
    True MemberRank
    Nov 2009 Join Date
    1,019Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Interesting.

    But didn't you receive a C&D?

  7. #7
    Account Upgraded | Title Enabled! Alozi is offline
    True MemberRank
    Nov 2014 Join Date
    SwedenLocation
    440Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good luck with this!

  8. #8
    Death from above! The General is offline
    The OmegaRank
    Aug 2011 Join Date
    8,720Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    First line says minimizing memory leaks, first example given already has 3 memory leaks.

    I don't have much hope for this.

    PS: John broke his neck.
    If you are using Arcturus, contact me
    Skype: wesley.jabbo
    Discord: TheGeneral#4898

  9. #9
    Demi-god. Dominic is offline
    SubscriberRank
    Aug 2012 Join Date
    DenmarkLocation
    564Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    First line says minimizing memory leaks, first example given already has 3 memory leaks.

    I don't have much hope for this.

    PS: John broke his neck.
    Teach us master! Where is these memory leaks?

  10. #10
    Death from above! The General is offline
    The OmegaRank
    Aug 2011 Join Date
    8,720Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by Dominic View Post
    Teach us master! Where is these memory leaks?
    Not spoonfeeding. I've done (most) things all by myself with little suggestions. He'll figure it out if he ever gets to the point where he runs out of memory which, if he continues to work like this, is pretty soon.
    If you are using Arcturus, contact me
    Skype: wesley.jabbo
    Discord: TheGeneral#4898

  11. #11
    Demi-god. Dominic is offline
    SubscriberRank
    Aug 2012 Join Date
    DenmarkLocation
    564Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    Not spoonfeeding. I've done (most) things all by myself with little suggestions. He'll figure it out if he ever gets to the point where he runs out of memory which, if he continues to work like this, is pretty soon.
    Not even close to spoonfeeding, but suit yourself

  12. #12
    Platina endorser SeanRog is offline
    True MemberRank
    Nov 2009 Join Date
    1,019Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    Not spoonfeeding. I've done (most) things all by myself with little suggestions. He'll figure it out if he ever gets to the point where he runs out of memory which, if he continues to work like this, is pretty soon.
    You can not argue with no arguments.

    Says itself.

  13. #13
    C# Programmer Jax is offline
    True MemberRank
    Dec 2009 Join Date
    1,073Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    First line says minimizing memory leaks, first example given already has 3 memory leaks.

    I don't have much hope for this.

    PS: John broke his neck.
    Is it due to the fact that he isn't disposing the memory after use?

  14. #14
    Death from above! The General is offline
    The OmegaRank
    Aug 2011 Join Date
    8,720Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by Jax View Post
    Is it due to the fact that he isn't disposing the memory after use?
    Thats what memory leaks are...
    If you are using Arcturus, contact me
    Skype: wesley.jabbo
    Discord: TheGeneral#4898

  15. #15
    C# / Java Programmer scottstamp851 is offline
    True MemberRank
    Jan 2007 Join Date
    EverywhereLocation
    521Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    Thats what memory leaks are...
    He's releasing objects after use, the GC handles disposal afterwards. This code is fine.


    Sent from my iPhone using Tapatalk
    hayhay.




Page 1 of 19 12345678911 ... LastLast

Advertisement