Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Sierra ~ Java // Netty // MySQL // BoneCP // Plugin System (Like Bukkit!)

Status
Not open for further replies.
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,689
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Okay, some bugs i discovered for you Alex :

* Walks threads are using same ressources when users walk same time -> Walk getting mad (fixed it making a new thread manager with own variables).
* At login, you're making tons of new Habbo() or newHabbo() who call new Habbo() ... Not really a problem but i don't know if Java free unused / unsaved memory pointers, if not it could be a problem.
* Problems with Room caching. You're caching room like it was Session, meaning that if user is not connected, his rooms are unseen to rest of connected, and that a bit weird i guess ? (Solved it by caching rooms at launch with an INNER JOIN query to retrive Owner name from rooms.ownerid, don't know if my sentence make sense but don't know how to explain in English ^^ )

The first two aren't really big but the last one is that rooms are unloaded when owner of the room disconnects with no users in it. Or when the owner is offline and it waits until the last person is when the owner is offline until it unloads it.
Understand?
 
Newbie Spellweaver
Joined
Jun 3, 2007
Messages
49
Reaction score
13
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

The first two aren't really big but the last one is that rooms are unloaded when owner of the room disconnects with no users in it. Or when the owner is offline and it waits until the last person is when the owner is offline until it unloads it.
Understand?

Yep, totally and that's the point. If another user try to search / get room owned by a disconnected user, the rooms are inexistant for the emulator and the user who search for room get no rooms.
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,689
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Yep, totally and that's the point. If another user try to search / get room owned by a disconnected user, the rooms are inexistant for the emulator and the user who search for room get no rooms.
Then the rooms will be generated by MySQL and unload when the last one disconnects ;)
 
Newbie Spellweaver
Joined
May 19, 2012
Messages
44
Reaction score
12
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

ShyNoShy & Quackster your work on the emulator is good so far, but I would like to point a bug out with stacking, when your on a tile and you place a stackable item you go on top of the item...

P.S: If people make something like a code for wired/horses or what ever... can we post them to other users? cos sharing is caring... but if not don't worry :p
 
Newbie Spellweaver
Joined
Jun 3, 2007
Messages
49
Reaction score
13
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

ShyNoShy & Quackster your work on the emulator is good so far, but I would like to point a bug out with stacking, when your on a tile and you place a stackable item you go on top of the item...

P.S: If people make something like a code for wired/horses or what ever... can we post them to other users? cos sharing is caring... but if not don't worry :p

Guess it's normal behavior with stacking ?! Tried with Phoenix, and stacking work like that too.
 
Experienced Elementalist
Joined
Jul 5, 2006
Messages
262
Reaction score
193
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

P.S: If people make something like a code for wired/horses or what ever... can we post them to other users? cos sharing is caring... but if not don't worry :p

You mean so you can take it, put it into Sierra and call it Webbo Emu? Yeah, I know your game, we don't need people like you around here.

Quackster - Sierra ~ Java // Netty // MySQL // BoneCP // Plugin System (Like Bukkit!) - RaGEZONE Forums
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,689
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Fixed a memory leak, instead of calling the remove function for sessions it would return the session thus not removing it, ever.
And added a constant loop for Sessions with a success or a fail ping, it fails it will dispose your data and disconnect you.

Code:
package sierra.habbo;


import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;


import org.jboss.netty.channel.Channel;


public class SessionManager implements Runnable {


	private Thread connectionThread;
	private ConcurrentMap<Integer, Session> Sessions;


	public SessionManager()
	{
		Sessions = new ConcurrentHashMap<Integer, Session>();


		connectionThread = new Thread(this);
		/*
		 * Start ping event to check if the user is still connected.
		 */
		connectionThread.setPriority(Thread.NORM_PRIORITY);
		connectionThread.start();
	}


	/*
	 * Add session if the same session doesn't already exist
	 */
	public boolean addSession(Channel channel)
	{
		return Sessions.putIfAbsent(channel.getId(), new Session(channel)) == null;
	}


	/*
	 * Remove the session.
	 */
	public void removeSession(Channel channel)
	{
		try {
			Sessions.remove(channel.getId());
		} catch (Exception e) {
		}
	}


	/*
	 * Grab user by channel id.
	 */
	public Session GetUserByChannel(Channel channel)
	{
		return Sessions.get(channel.getId());
	}


	/*
	 * Return a collection of sessions
	 */
	public ConcurrentMap<Integer, Session> getSessions()
	{
		return Sessions;
	}


	/*
	 * Return a true/false if the session exists in the collection
	 */
	public boolean hasSession(Channel channel)
	{
		return Sessions.containsKey(channel.getId());
	}




	public boolean UserByIdOnline(int id)
	{
		for (Session Session : Sessions.values())
			if (Session.getHabbo() != null)
				if (Session.getHabbo().Id == id)
					return true;
		return false;
	}
	public Session GetUserByName(String Name)
	{
		for (Session Session : Sessions.values())
			if (Session.getHabbo() != null)
				if (Session.getHabbo().Username.equals(Name))
					return Session;
		return null;
	}
	public Session GetUserById(int UserId)
	{
		for (Session Session : Sessions.values())
			if (Session.getHabbo() != null)
				if (Session.getHabbo().Id == UserId)
					return Session;
		return null;
	}


	/*
	 * Thread loop for checking if Sessions have disconnected.
	 */
	@Override
	public void run()
	{
		while (true)
		{
			for (Session Session : Sessions.values())
			{
				if (!Session.PingOK)
				{
					Session.dispose();
					removeSession(Session.getChannel());
				}
			}
		}
	}
}
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,689
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Coded fuse rights, instead of rank checking, this allows you to customize the permissions even more!

Code:
package sierra.habbohotel.fuserights;


import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;


import sierra.Sierra;


public class FuserightEngine
{
    private static Map<Integer, List<String>> Fuserights = new HashMap<Integer, List<String>>();
    
    public static void LoadAll()
    {
        try
        {
            PreparedStatement Statement = Sierra.getDatabase().ExecuteQuery("SELECT * FROM `fuserights`");
            
            ResultSet Row = Statement.executeQuery();


            while (Row.next())
            {
                Integer Rank = Row.getInt("rank");
                
                if (Fuserights.containsKey(Rank) == false)
                {
                    Fuserights.put(Rank, new ArrayList<String>());
                    fillFuses(Rank);
                }
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
    public static void fillFuses(int Rank)
    {
        try
        {
            ResultSet Row = Sierra.getDatabase().ReadTable("SELECT * FROM fuserights WHERE rank = '" + Rank + "'");


            while (Row.next())
            {
                Fuserights.get(Rank).add(Row.getString("fuse"));
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
    
    public static List<String> getFusesrightsByRank(int Rank)
    {
        List<String> LoadedFuses = new ArrayList<String>();
        
        for (Entry<Integer, List<String>> KeyValue : Fuserights.entrySet())
        {
            if (KeyValue.getKey().equals(Rank) || KeyValue.getKey() < Rank)
            {
                for (String fuse : KeyValue.getValue())
                {
                    LoadedFuses.add(fuse);
                }
            }
        }
        return LoadedFuses;
    }
}

Code:
public Boolean hasStaffPermission(String Fuse)
	{
		return FuserightEngine.getFusesrightsByRank(Rank).contains(Fuse);
	}
 
Supreme Arcanarch
Loyal Member
Joined
Jul 7, 2011
Messages
944
Reaction score
205
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Coded fuse rights, instead of rank checking, this allows you to customize the permissions even more!

Code:
package sierra.habbohotel.fuserights;


import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;


import sierra.Sierra;


public class FuserightEngine
{
    private static Map<Integer, List<String>> Fuserights = new HashMap<Integer, List<String>>();
    
    public static void LoadAll()
    {
        try
        {
            PreparedStatement Statement = Sierra.getDatabase().ExecuteQuery("SELECT * FROM `fuserights`");
            
            ResultSet Row = Statement.executeQuery();


            while (Row.next())
            {
                Integer Rank = Row.getInt("rank");
                
                if (Fuserights.containsKey(Rank) == false)
                {
                    Fuserights.put(Rank, new ArrayList<String>());
                    fillFuses(Rank);
                }
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
    public static void fillFuses(int Rank)
    {
        try
        {
            ResultSet Row = Sierra.getDatabase().ReadTable("SELECT * FROM fuserights WHERE rank = '" + Rank + "'");


            while (Row.next())
            {
                Fuserights.get(Rank).add(Row.getString("fuse"));
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
    
    public static List<String> getFusesrightsByRank(int Rank)
    {
        List<String> LoadedFuses = new ArrayList<String>();
        
        for (Entry<Integer, List<String>> KeyValue : Fuserights.entrySet())
        {
            if (KeyValue.getKey().equals(Rank) || KeyValue.getKey() < Rank)
            {
                for (String fuse : KeyValue.getValue())
                {
                    LoadedFuses.add(fuse);
                }
            }
        }
        return LoadedFuses;
    }
}

Code:
public Boolean hasStaffPermission(String Fuse)
	{
		return FuserightEngine.getFusesrightsByRank(Rank).contains(Fuse);
	}

Looks good, nice idea to use fuserights, rather then rank checking.
Next thing: special user fuserights (so you can apply a fuserank to one user, as given away in a competition or something)
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,689
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Since you can talk, move, place items etc. Sierra is ready for a official hotel soon. And hey! Feel free to follow @SierraHotel_ :):

Quackster - Sierra ~ Java // Netty // MySQL // BoneCP // Plugin System (Like Bukkit!) - RaGEZONE Forums


Looks good, nice idea to use fuserights, rather then rank checking.
Next thing: special user fuserights (so you can apply a fuserank to one user, as given away in a competition or something)
Extremely low priority right now.
 
Last edited:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,689
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Hotel is taking longer than expected, unable to connect using Remote Desktop
 
Supreme Arcanarch
Loyal Member
Joined
Jul 7, 2011
Messages
944
Reaction score
205
Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

Nope. VNC still works. The panel still works. When I click allow Remote Desktop from any computer it still doesn't let anyone..

:):

Good luck with everything, Alex. poop your vps isn't working with Remote Desktop. It's kinda weird, also. Hopefully it will work in a few days, I would love to check out the hotel!
 
Status
Not open for further replies.
Back
Top